コード例 #1
0
        public ActionResult ChangePassword(UserPasswordModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    this.UserManagementRepository.SetPassword(model.Username, model.Password);
                    TempData["Message"] = Resources.UserController.ProfileUpdated;
                    return RedirectToAction("Index");
                }
                catch (ValidationException ex)
                {
                    ModelState.AddModelError("", ex.Message);
                }
                catch
                {
                    ModelState.AddModelError("", "Error updating password");
                }
            }

            return View("ChangePassword", model);
        }
コード例 #2
0
 public ActionResult ChangePassword(string username)
 {
     UserPasswordModel model = new UserPasswordModel();
     model.Username = username;
     return View(model);
 }