public DCUser2 AuthenticateUser(string sessionid, string username, string pwd, string pwdattempts) { UserBiz m_ubiz = new UserBiz(); User2Detail dtuser = null; DCUser2 dcusr = null; GroupBiz m_gbiz = new GroupBiz(); try { dtuser = m_ubiz.AuthenticateUser(CryptoUtils.DecryptTripleDES(username), CryptoUtils.DecryptTripleDES(pwd), GMConvert.GetInt16(CryptoUtils.DecryptTripleDES(pwdattempts))); if (dtuser != null && dtuser.LastLogon.HasValue) { dtuser.Permissions = new List <int>(); List <Int32> groups = m_ubiz.GetGroups(dtuser.ID); foreach (int group in groups) { dtuser.Permissions.AddRange(m_gbiz.GetPermissions(group)); } dcusr = new DCUser2(); GMReflectionUtils.Copy(dtuser, dcusr); SetCache(sessionid, dcusr); } } catch (Exception exp) { throw exp; } finally { m_ubiz.Dispose(); m_gbiz.Dispose(); } return(dcusr); }
public void Save(User2Detail detusr, bool ispwdchangemanual) { if (ispwdchangemanual || !detusr.ID.HasValue || detusr.ID == 0)//when the password is getting changed manually or when a new user is created using the admin application { detusr.Password = GMUtilities.Security.CryptoUtils.EncryptSHA(detusr.Password); } m_db.Save(detusr); }
public User2Detail GetUserLogOn(string username, string pwd, Int16 pwdattempts, DateTime dtnow) { User2Map MapInstance = new User2Map(); this.SetParameter(User2Map.Name, username); this.SetParameter(User2Map.Password, pwd); this.SetParameter(CommonMap.PasswordAttempts, pwdattempts); this.SetParameter(CommonMap.ServerDatetime, dtnow); User2Detail det = new User2Detail(GetReader(User2Map.ProcedureGetUserLogOn), MapInstance); return(det); }
public void Save(DCUser2 dcusr) { try { User2Detail detusr = new User2Detail(); GMUtilities.GMReflectionUtils.Copy(dcusr, detusr); Save(detusr, (bool)dcusr.IsPasswordChangedManual); if ((bool)dcusr.IsPasswordChangedManual) { dcusr = GetCache(dcusr.SessionID); dcusr.Password = CryptoUtils.EncryptSHA(dcusr.Password); SetCache(dcusr.SessionID, dcusr); } } catch (Exception exp) { throw exp; } }
public User2Detail AuthenticateUser(string username, string pwd, Int16 pwdattempts) { Authentication auth = new Authentication(); User2Detail dtuser = null; try { dtuser = auth.AuthenticateUser(username, pwd, pwdattempts); } catch (Exception exp) { throw exp; } finally { auth.Dispose(); auth = null; } return(dtuser); }
public void ChangePassword(string sessionid, string userid, string oldpwd, string newpwd) { DCUser2 dcusr = GetCache(sessionid); if (string.Compare(dcusr.Password, CryptoUtils.EncryptSHA(oldpwd), true) != 0) { throw new ApplicationException(ErrorConstants.ExistingPassword); } User2Detail detusr = new User2Detail(); detusr.ID = (Int32?)GMConvert.GetInt32(userid); detusr.Password = CryptoUtils.EncryptSHA(newpwd); detusr.LastPassword = CryptoUtils.EncryptSHA(oldpwd); detusr.PasswordChangeDate = DateTime.Now; detusr.IsChangePasssword = false; detusr.ModifiedDate = DateTime.Now; Save(detusr); dcusr.Password = CryptoUtils.EncryptSHA(newpwd); dcusr.IsChangePasssword = false; }
public void Save(User2Detail det) { Save(det, User2Map.ProcedureSave); }
private void Save(User2Detail detusr, bool ispwdchangemanual) { m_biz.Save(detusr, ispwdchangemanual); }
private void Save(User2Detail detusr) { Save(detusr, false); }
public void Save(User2Detail det) { m_db.Save(det); }
public void Save(User2Detail detusr) { Save(detusr, false); }