public ActionResult ChangePassword(int id, PasswordInputModel passwordInputModel) { if(passwordInputModel.Password != passwordInputModel.PasswordRepeat) ModelState.AddModelError("passwordInputModel.PasswordRepeat", "Det repiterade lösenordet skiljer sig!"); if (!ModelState.IsValid) return Settings(id); var user = _userService.Get(id); user.Password = Encrypter.Encrypt(passwordInputModel.Password); FlashSuccess("Lösenordet har uppdaterats!"); return RedirectToAction("Settings", new {id}); }
public SettingsViewModel(User user) { User = user; PasswordInputModel = new PasswordInputModel(); }