public IActionResult UpdateUserInfo(User user, string Salt, string NewPassword, string Password) { if (ModelState.IsValid) { user = authProvider.GetCurrentUser(); authProvider.ChangePassword(Password, NewPassword); return(RedirectToAction("UserHomePage", "User")); } return(View(user)); }
public IActionResult ChangePassword(ChangePasswordModel passwordIn) { if (ModelState.IsValid) { authProvider.ChangePassword(passwordIn.ExistingPassword, passwordIn.Password); return(RedirectToAction("Confirmation", "Account")); } else { return(View(passwordIn)); } }
public IActionResult ChangePassword(ChangePasswordViewModel cpvm) { if (ModelState.IsValid) { if (authProvider.ChangePassword(cpvm.OldPassword, cpvm.ConfirmPassword) == false) { return(RedirectToAction("Error", "Home")); } //else return(RedirectToAction("Index", "Account")); } return(View(cpvm)); }
public IActionResult ChangePassword(ChangePasswordViewModel changePasswordViewModel) { if (ModelState.IsValid) { authProvider.ChangePassword(changePasswordViewModel.CurrentPassword, changePasswordViewModel.NewPassword); // Register them as a new user (and set default role) // When a user registeres they need to be given a role. If you don't need anything special // just give them "User". // Redirect the user where you want them to go after registering return(RedirectToAction("Index", "Account")); } return(View(changePasswordViewModel)); }
public IActionResult ChangePassword(ChangePasswordModel changePasswordModel) { // Ensure the fields were filled out if (ModelState.IsValid) { // Check that they provided correct credentials bool validLogin = authProvider.ChangePassword(changePasswordModel.OldPassword, changePasswordModel.NewPassword); if (validLogin) { // Redirect the user where you want them to go after successful login return(RedirectToAction("Index", "Home")); } } return(View(changePasswordModel)); }
public IActionResult ChangePasswordSelf(User model) { Message message = null; model.Password = model.Password == null ? "" : model.Password; model.NewPassword = model.NewPassword == null ? "" : model.NewPassword; bool successfulChange = authProvider.ChangePassword(model.Password, model.NewPassword); if (successfulChange) { message = new Message("Password Changed Successfully"); } else { message = new Message("Password Not Changed"); } return(RedirectToAction("Feedback", message)); }
public IActionResult UpdatePassword(UpdateProfileVM user) { bool val = authProvider.ChangePassword(user.CurrentPassword, user.Password); if (val) { TempData["message"] = "Password succesfully changed"; User var2 = new User(); var2 = authProvider.GetCurrentUser(); UpdateProfileVM vm2 = new UpdateProfileVM(); vm2.Id = var2.Id; vm2.Username = var2.Username; vm2.Name = var2.Name; vm2.State = var2.State; vm2.DOB = var2.DOB; return(View("UpdateProfile", vm2)); } TempData["message2"] = "Please enter your current password"; User var = new User(); var = authProvider.GetCurrentUser(); UpdateProfileVM vm = new UpdateProfileVM(); vm.Id = var.Id; vm.Username = var.Username; vm.Name = var.Name; vm.State = var.State; vm.DOB = var.DOB; return(View("UpdateProfile", vm)); }
public IActionResult ChangePassword(ChangePasswordViewModel vm) { authProvider.ChangePassword(vm.OldPassword, vm.Password); return(RedirectToAction("Index", "Account")); }