/// <summary> /// 修改口令 /// </summary> /// <param name="uname"></param> /// <param name="old_pass"></param> /// <param name="new_pass"></param> /// <returns></returns> public bool ChangePassWord(string uname, string old_pass, string new_pass, string _type) { C_SignOnBase _SignOnControler = new C_SignOnBase(); if (CheckPassword(uname, old_pass, _type)) { if (uname.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "NONE": break; case "TESTPASS": _SignOnControler = new C_SignOnTestPass(); break; case "BASE": //采用综合系统验证功能 _SignOnControler = new C_SignOnFromJS(); break; case "OGUPERMISSION": //采用海关通用授权平台验证WEB验证的功能(不再使用) _SignOnControler = new C_SignOnOGUPermission(); break; case "HGAD": //采用域验证的方式 _SignOnControler = new C_SignOnHGAD(); break; case "QDHB": _SignOnControler = new C_SignOnQDHBService(); break; case "HBSERVICE": _SignOnControler = new C_SignOnHBSecurityService(); break; default: _SignOnControler = new C_SignOnFromJS(); break; } } else { _SignOnControler = new C_SignOnAdmin(); } return(_SignOnControler.ChangePassword(uname, old_pass, new_pass, _type) == 1); } else { return(false); } }
/// <summary> /// 登录系统 /// </summary> /// <param name="_sysid"></param> /// <param name="_name"></param> /// <param name="_mwpass"></param> /// <returns></returns> public SinoUser LoginSys(string _sysid, string _name, string _mwpass, string _type) { //暂未实现 C_SignOnBase _SignOnControler = new C_SignOnBase(); string _pass = _mwpass; string _ipaddr = CallContext.GetData("ClientIP").ToString(); string _hostName = ""; try { _hostName = Dns.GetHostEntry(_ipaddr).HostName; } catch { _hostName = _ipaddr; } SinoUser _su = new SinoUser(); _su.LoginName = _name; _su.UserName = "******"; _su.DwName = "海关总署缉私局"; string _yhid = ""; if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "NONE": break; case "TESTPASS": _SignOnControler = new C_SignOnTestPass(); break; case "BASE": //采用综合系统验证功能 _SignOnControler = new C_SignOnFromJS(); break; case "OGUPERMISSION": //采用海关通用授权平台验证WEB验证的功能(不再使用) _SignOnControler = new C_SignOnOGUPermission(); break; case "HGAD": //采用域验证的方式 _SignOnControler = new C_SignOnHGAD(); break; case "QDHB": _SignOnControler = new C_SignOnQDHBService(); break; case "HBSERVICE": _SignOnControler = new C_SignOnHBSecurityService(); break; case "CUPPAPASSPORT": _SignOnControler = new C_SignOnCUPPAPassport(); break; default: _SignOnControler = new C_SignOnFromJS(); break; } } else { _SignOnControler = new C_SignOnAdmin(); } bool _signOn = _SignOnControler.Check(_name, _pass, _type); if (!_signOn) { throw new Exception("用户名/口令不正确!"); } //写入用户操作日志 //SystemLogWriter.WriteLog(string.Format("验证{0}的口令成功!", _name), EventLogEntryType.Information); if (_name.ToLower() != "administrator") { switch (ConfigFile.LoginType) { case "CUPPAPASSPORT": string _atype = C_SignOnCUPPAPassport.GetAuthType(_type); _yhid = C_GetUserInfo_Cuppa.GetYHIDByName(_name, _atype); break; default: _yhid = C_GetUserInfo.GetYHIDByName(_name, _pass); break; } } else { _yhid = "0"; } if (_yhid != "-1") { _su = C_GetUserInfo.GetUserInfoByYHID(_yhid); } else { _su = C_GetUserInfo.GetNoRegisterUserByUserName(_name); } //同步登录名信息用(处理三统一的问题) _su.LoginName = _name; //SystemLogWriter.WriteLog(string.Format("取{0}的用户信息成功!", _name), EventLogEntryType.Information); //写入用户操作日志 //SQLCommon.WriteUserLog(decimal.Parse(_yhid), "系统登录", string.Format("{1}使用用户名{0}登录成功!", _name, _su.UserName), 1, _ipaddr, _hostName); //CreateTicket(ref _su, _ipaddr); _su.EncryptedTicket = TicketLib.AddTicket(_name, _ipaddr); //SystemLogWriter.WriteLog(string.Format("生成{0}的验证票据成功!Address={1}", _name, _ipaddr), EventLogEntryType.Information); _su.IPAddress = _ipaddr; _su.SystemID = ConfigFile.SystemID; LogonUserLib.AddUserInfo(_su.LoginName, _su); //SystemLogWriter.WriteLog(string.Format("添加用户{0}到验证用户列表成功!", _name), EventLogEntryType.Information); return(_su); }