示例#1
0
 public bool ChangePassword(ChangePassword data)
 {
     if (dataProvider.ChangePassword(data.OldPassword, data.NewPassword))
     {
         dataProvider = new MsSqlDataProvider(CreateConnectionString(User.Login, data.NewPassword));
         return true;
     }
     return false;
 }
示例#2
0
        public ActionResult ChangePassword(ChangePassword data, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                var authenticator = ApplicationSettings.Authenticator;
                if (authenticator == null)
                {
                    return RedirectToAction("Login", new { returnUrl = returnUrl });
                }

                if (authenticator.ChangePassword(data))
                {
                    ApplicationSettings.Authenticator = authenticator;
                    return RedirectToLocal(returnUrl);
                }

                ModelState.AddModelError("", "Ошибка смены пароля. Проверьте корректность ввода текущего пароля");
            }

            return View(data);
        }