Example #1
0
        public async Task <IdentityResult> ConfirmEmail(ConfirmEmailInput input)
        {
            var user   = _userRepository.Get(input.UserId.ToString());
            var result = await _userManager.ConfirmEmailAsync(input.UserId.ToString(), input.ConfirmationCode);

            return(result);
        }
Example #2
0
        public async Task <ActionResult> ConfirmEmail([FromBody] ConfirmEmailInput input)
        {
            var user = await _authenticationAppService.FindUserByEmailAsync(input.Email);

            if (user == null)
            {
                return(NotFound("Email is not found!"));              // TODO: Make these messages static object
            }
            var result = await _authenticationAppService.ConfirmEmailAsync(user, input.Token);

            if (!result.Succeeded)
            {
                return(BadRequest(string.Join(Environment.NewLine, result.Errors.Select(e => e.Description))));
            }

            return(Ok());
        }
Example #3
0
        public IActionResult ConfirmEmail([FromBody] ConfirmEmailInput input)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var applicant = _dbContext.Applicants.FirstOrDefault(a => a.EmailConfirmationKey == input.EmailConfirmationKey);

            if (applicant == null)
            {
                return(NotFound(input));
            }

            applicant.IsEmailConfirmed     = true;
            applicant.EmailConfirmationKey = null;
            _dbContext.SaveChanges();

            return(Ok());
        }
        public async Task <IActionResult> ConfirmEmail(ConfirmEmailInput confirmEmailInput)
        {
            var user = await _userManager.FindByEmailAsync(confirmEmailInput.Email);

            if (user == null)
            {
                return(NotFound());
            }

            var code = Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(confirmEmailInput.Code));

            var result = await _userManager.ConfirmEmailAsync(user, code);

            if (result.Succeeded)
            {
                return(Ok());
            }

            return(StatusCode(500));
        }
Example #5
0
 public ActionResult ConfirmEmail(ConfirmEmailInput input)
 {
     _userAppService.ConfirmEmail(input);
     return(RedirectToAction("Login", new { loginMessage = "Congratulations! Your account is activated. Enter your email address and password to login" }));
 }
        public void ConfirmEmail(ConfirmEmailInput input)
        {
            var user = _userRepository.Get(input.UserId);

            user.ConfirmEmail(input.ConfirmationCode);
        }