Exemplo n.º 1
0
        private async System.Threading.Tasks.Task SendEmailConfirmationLinkAsync(Member member)
        {
            var token = await _userManager.GenerateEmailConfirmationTokenAsync(member);

            var emailConfirmationLink = Url.Action("ConfirmEmail", "Account", new { memberId = member.Id, token = token }, Request.Scheme);

            // TODO: Remove this line for public
            _logger.Log(LogLevel.Warning, emailConfirmationLink);

            EmailClient.SendLink(member, emailConfirmationLink, EmailType.EmailConfirmation);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                Member member = await _userManager.FindByEmailAsync(model.Email);

                if (member != null && member.EmailConfirmed)
                {
                    string token = await _userManager.GeneratePasswordResetTokenAsync(member);

                    var passwordResetLink = Url.Action("ResetPassword", "Account", new { email = model.Email, token = token }, Request.Scheme);

                    EmailClient.SendLink(member, passwordResetLink, EmailType.PasswordReset);

                    ViewBag.ConfirmMessage = "Your request to reset your password has been confirmed. Please check your email for reset link";
                    return(View("Confirmation"));
                }
            }

            return(View());
        }