示例#1
0
        /// <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);
 }
示例#3
0
 public async Task <IActionResult> VerifyEmailAsync([FromBody] EmailVerificationDTO emailVerificationDTO)
 => await _accountService.VerifyEmailAsync(emailVerificationDTO).ConfigureAwait(false).GetActivityResponseAsync(_sharedLocalizer["EmailVerificationSuccessfull"],
                                                                                                                _sharedLocalizer["AccountActivityErrorMessage"]).ConfigureAwait(false);