/// <summary> /// Gets the pass word_ data. /// </summary> /// <returns></returns> private Boolean GetPassWord_Data() { IPassword PasswordMgr; try { PasswordMgr = (IPassword)ObjectFactory.CreateInstance("BusinessProcess.Administration.BPassword, BusinessProcess.Administration"); DataSet DSGetPassData = PasswordMgr.GetUserData(Convert.ToInt32(Session["AppUserId"].ToString())); Utility theUtil = new Utility(); string thePass = theUtil.Decrypt(DSGetPassData.Tables[0].Rows[0]["Password"].ToString()); if (txtExisPassword.Text.Trim() != thePass) { IQCareMsgBox.Show("ExistPasswordNotMatch", this); return(false); } if (Session["MandatoryChange"] != null) { if ((Session["MandatoryChange"].ToString() == "1") || (Session["MandatoryChange"].ToString() == "2")) { if (txtNewPassword.Text == thePass) { IQCareMsgBox.Show("PasswordMatchSame", this); return(false); } } } if (txtNewPassword.Text == txtConfirmpassword.Text) { PasswordMgr.UpdatePassword(Convert.ToInt32(Session["AppUserId"].ToString()), txtNewPassword.Text); } else { IQCareMsgBox.Show("NewConfirmPasswordNotMatch", this); return(false); } } catch (Exception err) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["MessageText"] = err.Message.ToString(); IQCareMsgBox.Show("#C1", theBuilder, this); } finally { PasswordMgr = null; } return(true); }
private string EncryptPassword(string password) { var passWordHash = PasswordMgr.Encrypt(password); return(passWordHash); }
private string DecryptPassword(string passwordHash) { var password = PasswordMgr.Decrypt(passwordHash); return(password); }