Example #1
0
        public async Task <ActionResult> SendResetPasswordEmail(Guid id)
        {
            User user = _dispatcher.Dispatch(new GetUserQuery {
                Id = id
            });

            if (user != null)
            {
                var token = await _userManager.GeneratePasswordResetTokenAsync(user);

                var resetUrl = $"{_configuration["IdentityServerAuthentication:Authority"]}/Account/ResetPassword?token={HttpUtility.UrlEncode(token)}&email={user.Email}";

                _emailMessageService.CreateEmailMessage(new EmailMessageDTO
                {
                    From    = "*****@*****.**",
                    Tos     = user.Email,
                    Subject = "Forgot Password",
                    Body    = string.Format("Reset Url: {0}", resetUrl),
                });
            }
            else
            {
                // email user and inform them that they do not have an account
            }

            return(Ok());
        }