public ActionResult ResetPassword(string EncryptUserClientId, ClientChangePassword ObjModel) { if (ModelState.IsValidField("NewPassword") && ModelState.IsValidField("ConfirmPassword")) { EncryptUserClientId = EncryptUserClientId.Replace("$", "+"); EncryptUserClientId = EncryptUserClientId.Replace("/", "!"); Encrypt64 encrypt = new Encrypt64(); string UserClientId = encrypt.Decrypt(EncryptUserClientId, ConfigurationManager.AppSettings["SecureKey"].ToString()); ObjModel.UserClientId = Convert.ToInt32(UserClientId); ClientLoginHelper clientLoginHelper = new ClientLoginHelper(); ClientLogOnModel clientLogOnModel = new ClientLogOnModel(); clientLogOnModel = clientLoginHelper.GetById(ObjModel.UserClientId); int Result = clientLoginHelper.ForgotChangePassword(ObjModel); if (Result == 0) { TempData["CommonMessage"] = AppLogic.setMessage(0, "Password changed sucessfully"); return(Redirect(Url.Content("~/" + clientLogOnModel.StrataPortalLink + "/Login"))); } else { TempData["CommonMessage"] = AppLogic.setMessage(1, "Please check password you have entered and Try again"); return(View()); } } else { return(View()); } }
public ActionResult ResetPassword(ClientChangePassword ObjModel) { // if (ModelState.IsValid) { ClientLoginHelper clientLoginHelper = new ClientLoginHelper(); int Result = clientLoginHelper.ResetChangePassword(ObjModel); if (Result == 0) { TempData["CommonMessage"] = AppLogic.setMessage(0, "Password changed sucessfully"); } else { TempData["CommonMessage"] = AppLogic.setMessage(1, "Please check password you have entered and Try again"); } } return(Redirect(Url.Content("~/" + ClientSessionData.ClientPortalLink + "/settings/resetpassword"))); }
public int ResetChangePassword(ClientChangePassword model) { string Constr = ConfigurationManager.ConnectionStrings["StratasFairConnectionStr"].ConnectionString; string a = AppLogic.DecryptPassword(model.OldPassword); model.OldPassword = AppLogic.EncryptPasswordString(model.OldPassword); model.NewPassword = AppLogic.EncryptPasswordString(model.NewPassword); SqlCommand Cmd; int err = 0; SqlConnection Con = new SqlConnection(Constr); Cmd = new SqlCommand("Usp_ChangePassword", Con); Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("@UserClientId", SqlDbType.VarChar, 100); Cmd.Parameters.Add("@oldpassword", SqlDbType.VarChar, 100); Cmd.Parameters.Add("@newPassword", SqlDbType.VarChar, 100); Cmd.Parameters.Add("@Type", SqlDbType.Int); Cmd.Parameters.Add("@msg", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output; Cmd.Parameters.Add("@err", SqlDbType.Int).Direction = ParameterDirection.Output; Cmd.Parameters["@UserClientId"].Value = ClientSessionData.UserClientId; Cmd.Parameters["@oldpassword"].Value = model.OldPassword; Cmd.Parameters["@newPassword"].Value = model.NewPassword; Cmd.Parameters["@Type"].Value = 3; try { Con.Open(); Cmd.ExecuteNonQuery(); err = (int)Cmd.Parameters["@err"].Value; return(err); } catch { throw; } finally { Con.Close(); Cmd.Dispose(); } }
public ActionResult ResetPassword() { ClientChangePassword ObjModel = new ClientChangePassword(); return(View(ObjModel)); }