示例#1
0
        public async Task PostVerifyEmailToken([FromBody] VerifyEmailRequestModel model)
        {
            var user = await _userService.GetUserByIdAsync(new Guid(model.UserId));

            if (user == null)
            {
                throw new UnauthorizedAccessException();
            }
            var result = await _userService.ConfirmEmailAsync(user, model.Token);

            if (result.Succeeded)
            {
                return;
            }

            foreach (var error in result.Errors)
            {
                ModelState.AddModelError(string.Empty, error.Description);
            }

            await Task.Delay(2000);

            throw new BadRequestException(ModelState);
        }
 public IActionResult VerifyEmail(VerifyEmailRequestModel model)
 {
     _userService.VerifyEmail(model.Token);
     return(Ok(new { message = "Verification successful, you can now login" }));
 }
示例#3
0
        public async Task VerifyEmail(VerifyEmailModel verifyEmailModel)
        {
            var requestModel = new VerifyEmailRequestModel(verifyEmailModel);

            await PostAsync(Resources.VerifyEmailAction, requestModel);
        }