/// <summary> /// 验证旧口令的正确性 /// </summary> /// <param name="_oldPass"></param> private bool ValidOldPass(string _oldPass) { using (AuthorizeService.AuthorizeServiceClient _asc = new AuthorizeService.AuthorizeServiceClient()) { return(_asc.CheckPassword(SessionClass.CurrentSinoUser.LoginName, _oldPass, SessionClass.CurrentCheckType)); } }
private void simpleButton1_Click(object sender, EventArgs e) { if (ValidNewPass()) { string _oldPass = this.te_oldPass.EditValue.ToString(); string _newPass = this.te_newPass.EditValue.ToString(); using (AuthorizeService.AuthorizeServiceClient _asc = new AuthorizeService.AuthorizeServiceClient()) { if (_asc.ChangePassWord(SessionClass.CurrentSinoUser.LoginName, _oldPass, _newPass)) { XtraMessageBox.Show("修改口令成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } else { XtraMessageBox.Show("修改口令失败!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } } } }
public void Login() { SinoUser _su; try { string ls_name = textUser.EditValue.ToString().Trim(); string ls_pass = textPass.EditValue.ToString(); string ls_checktype = ConvertToCheckType(cb_CheckType.EditValue.ToString()); if (ls_checktype == "windows") { string cdn = GetDomainName(); if (cdn == "") { #if DEBUG ls_name = "lijianlin"; #else throw new Exception("未登录到域,不可进行域认证!"); #endif } ls_pass = StrUtils.EncodeByDESC(ls_name, "DOMAINCK"); } // 取数据接口 using (AuthorizeService.AuthorizeServiceClient _client = new AuthorizeService.AuthorizeServiceClient()) { _su = _client.LoginSys(ConfigFile.SystemID, ls_name, ls_pass, ls_checktype); } if (_su != null) { SessionClass.CurrentLogonName = ls_name; SessionClass.CurrentLogonPass = ls_pass; SessionClass.CurrentSinoUser = _su; SessionClass.CurrentCheckType = ls_checktype; SessionClass.CurrentTicket = new SinoSZTicketInfo(_su.UserID, _su.IPAddress, _su.EncryptedTicket); SinoBestTicketCache.CurrentTicket = _su.EncryptedTicket; using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient()) { SessionClass.ServerConfigData = _cs.GetServerConfig(); DataRow[] _drs = _UserDs.User.Select(string.Format("Username='******'", ls_name)); if (_drs.Length == 0) { DataRow row = _UserDs.User.NewRow(); row["Username"] = ls_name; _UserDs.User.Rows.Add(row); _UserDs.WriteXml(_schemaFile, XmlWriteMode.IgnoreSchema); } _su.DwID = _su.CurrentPost.PostDwID; loginTimes = 0; System.ComponentModel.ISynchronizeInvoke synchronizer = this; MethodInvoker invoker = new MethodInvoker(LoginSuccess); synchronizer.Invoke(invoker, null); } } else { XtraMessageBox.Show("用户名/口令不正确或过期!", "系统提示"); System.ComponentModel.ISynchronizeInvoke synchronizer = this; MethodInvoker invoker = new MethodInvoker(ResetForm); synchronizer.Invoke(invoker, null); } loginTimes++; if (loginTimes > 2) { System.ComponentModel.ISynchronizeInvoke synchronizer = this; MethodInvoker invoker = new MethodInvoker(CancelApplicaton); synchronizer.Invoke(invoker, null); } } catch (Exception e) { ShowMessageDelegate showProgress = new ShowMessageDelegate(ShowMessage); string _msg = string.Format("发生错误:{0}", e.Message); this.Invoke(showProgress, new object[] { _msg }); } }