/// <summary> /// Verifies <paramref name="emailVerificationDTO"/>.UserName's email, if <paramref name="emailVerificationDTO"/>.TokenString is valid. /// </summary> /// <param name="emailVerificationDTO"></param> /// <returns></returns> public async Task <IdentityResult> VerifyEmailAsync(EmailVerificationDTO emailVerificationDTO) { var user = await _userRepository.GetFirstOrDefaultAsync(a => a.UserName == _userName).ConfigureAwait(false); user.ThrowIfParameterIsNull("InvalidVerificationToken"); var result = await _userManager.ConfirmEmailAsync(user, emailVerificationDTO.TokenString).ConfigureAwait(false); result.ThrowErrorMessagesIfNotSuccess(); return(await _userManager.ConfirmEmailAsync(user, emailVerificationDTO.TokenString).ConfigureAwait(false)); }
//check neccesity of from body public async Task VerifyEmailAsync(EmailVerificationDTO emailVerificationDTO) { EmailVerificationModel emailVerification = _mapper.Map <EmailVerificationModel>(emailVerificationDTO); await _userService.AddVerificationAsync(emailVerification); }
public async Task <IActionResult> VerifyEmailAsync([FromBody] EmailVerificationDTO emailVerificationDTO) => await _accountService.VerifyEmailAsync(emailVerificationDTO).ConfigureAwait(false).GetActivityResponseAsync(_sharedLocalizer["EmailVerificationSuccessfull"], _sharedLocalizer["AccountActivityErrorMessage"]).ConfigureAwait(false);