1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 16:42:50 -05:00

verify email apis and emails

This commit is contained in:
Kyle Spearrin
2017-07-01 23:20:19 -04:00
parent c8528384f8
commit 97ad8bd943
12 changed files with 111 additions and 3 deletions

View File

@ -10,7 +10,6 @@ using Bit.Core.Models.Table;
using Bit.Core.Enums;
using System.Linq;
using Bit.Core.Repositories;
using System.Collections.Generic;
namespace Bit.Api.Controllers
{
@ -104,6 +103,30 @@ namespace Bit.Api.Controllers
await Task.Delay(2000);
throw new BadRequestException(ModelState);
}
[HttpPost("verify-email")]
public async Task PostVerifyEmail()
{
var user = await _userService.GetUserByPrincipalAsync(User);
if(user == null)
{
throw new UnauthorizedAccessException();
}
await _userService.SendEmailVerificationAsync(user);
}
[HttpPost("verify-email-token")]
[AllowAnonymous]
public async Task PostVerifyEmailToken()
{
var user = await _userService.GetUserByIdAsync(new Guid());
if(user == null)
{
throw new UnauthorizedAccessException();
}
await _userService.ConfirmEmailAsync(user, "");
}
[HttpPut("password")]
[HttpPost("password")]