コード例 #1
0
        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});
        }
コード例 #2
0
        public SettingsViewModel(User user)
        {
            User = user;

            PasswordInputModel = new PasswordInputModel();
        }