public ActionResult ChangePassword(ChangePasswordModel model) { if (this.ModelState.IsValid) { UserPasswordService.UserPasswordChange(model.NewPassword, model.ConfirmPassword); return(this.RedirectToAction("LogOff")); } model.Tab = "Home"; return(this.View(model)); }
public void User_Password_Change_Password_And_Send_Message() { BusinessPrincipal.Login(); var user = UserService.UserNew(); var password = DataHelper.RandomString(10); user.Name = DataHelper.RandomString(20); user.FirstName = DataHelper.RandomString(20); user.LastName = DataHelper.RandomString(20); user.Email = DataHelper.RandomEmail(); user.Role = Role.FullControl; user.SetPassword(password); user = UserService.UserSave(user, new EmptyMessenger()); BusinessPrincipal.Logout(); BusinessPrincipal.Login(user.Name, password); user = UserService.UserFetch(user.UserId); user.SetPassword(DataHelper.RandomString(20)); var newPassword = DataHelper.RandomString(20); UserPasswordService.UserPasswordChange(newPassword, newPassword, MessengerHelper.InitMessengerForUserUpdatePassword()); user = UserService.UserFetch(user.UserId); Assert.IsTrue(user.Password != password); BusinessPrincipal.Logout(); BusinessPrincipal.Login(user.Name, newPassword); }