public bool ChangePassword(string user, string old_psw, string new_psw) { Database.SLW_DatabaseInfo db = new Database.SLW_DatabaseInfo(); Models.UserCredentials credentials = db.GetUserCredentials(user); if (VerifyCredentials(old_psw, credentials.hash)) { db.UpdatePassword(user, GetHash(new_psw)); return(true); } else { return(false); } }
public ActionResult SaveChangePassword(Models.UserCredentials userCredentials) { try { ServiceRepository serviceRepositorty = new ServiceRepository(configuration); HttpResponseMessage response = serviceRepositorty.PostRequest("api/Home/ForgotPassword", userCredentials); response.EnsureSuccessStatusCode(); if (response.Content.ReadAsAsync <bool>().Result) { return(View("SuccessPassword")); } else { return(View("ErrorPassword")); } } catch (Exception ex) { return(View("ErrorPassword")); } }