Ejemplo n.º 1
0
        public async Task <IActionResult> ResetPassAsync(string email)
        {
            var user = await userManager.FindByEmailAsync(email);

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

            var newPass = Guid.NewGuid().ToString();

            await userManager.RemovePasswordAsync(user);

            await userManager.AddPasswordAsync(user, newPass);

            await emailsService.SendAsync(user.Email, "TheBookApp password reset", $"Your new password is: {newPass}");

            return(Ok());
        }