public async Task <IActionResult> ResetPassword(ViewModels.ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await userManager.FindByEmailAsync(model.Email);

                if (user != null)
                {
                    var result = await userManager.ResetPasswordAsync(user, model.Token, model.Password);

                    if (result.Succeeded)
                    {
                        if (await userManager.IsLockedOutAsync(user))
                        {
                            await userManager.SetLockoutEndDateAsync(user, DateTimeOffset.UtcNow);
                        }

                        return(View("ResetPasswordConfirmation"));
                    }

                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError("", error.Description);
                    }
                    return(View(model));
                }

                return(View("ResetPasswordConfirmation"));
            }

            return(View(model));
        }
Exemple #2
0
        public ResetPasswordPage()
        {
            InitializeComponent();

            BindingContext = new ViewModels.ResetPasswordViewModel();
        }