3000后的版本中,InternalLogon的代码
static function TINIT.InternalLogon(AParam: String): Boolean;
const
MaxLogonFailCount = 3;
LogonErrorMsg01 = '登录失败';
LogonErrorMsg02 = '用户不存在或者密码错误,请注意大小写,密码是区分大小写的。';
LogonErrorMsg03 = '对不起,您已经 %d 次登录失败,将退出系统。';
var
I: Integer;
lAccept: Boolean;
sUser, sPass, lAccountID, lUserID, lMessage: String;
lPerson: Org.TPerson;
lLogonPerson: Org.TPersonMember;
begin
if not FInternalDisableAutoLogon then
begin
/////////////////////////外网登陆,那么校验usbkey码
{ if (not ET199USBKEY.TET199USBKEY.CheckIP(Business.System.JSSysUtils.GetLocalIPStr,'202.10.10.10')) AND
//(not ET199USBKEY.TET199USBKEY.CheckIP(Business.System.JSSysUtils.GetLocalIPStr,'192.168.1.10')) AND
(not ET199USBKEY.TET199USBKEY.CheckIP(Business.System.JSSysUtils.GetLocalIPStr,'10.10.10.10')) then
begin
if not ET199USBKEY.TET199USBKEY.VerifyUserPinFrm(Business.Model.BizSys.GlobalContext) then
begin
Dialogs.MessageDlg('USBKey码校验失败!', TMsgDlgType.mtError, [TMsgDlgBtn.mbOK] , 0);
Exit;
end;
end;}
////////////////////////////////////////////////////////////////////////////////
if UseAD and LoginUseAD then
begin
Result := True;
Exit;
end;
if AParam <> '' then
begin
lUserID := ''; // 去除警告
lAccountID := ''; // 去除警告
lMessage := ''; // 去除警告
Result := TAutoLogon.AutoLogon(AParam, lUserID, lMessage, lAccountID);
if not Result then
begin
Dialogs.MessageDlg(lMessage, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK] , 0);
Exit;
end;
BizSys.BizSystem.ClientAccount := lAccountID;
if not SysUtils.SameText(lUserID, 'System') then
begin
lPerson := Org.OrgSys.OrgSystem.FindPerson(lUserID);
Result := (not Opr.IsSystemManager(lUserID) or ExtUtils.ClientAccountExist(BizSys.BizSystem.ClientAccount)) and
TSystemCore.Logon(lPerson.LoginID, lPerson.Password);
end else begin
Result := TSystemCore.Logon(lUserID, ExtUtils.ReadUserSysMngerPassWord);
end;
Exit;
end
else
Result := False;
end
else
Result := False;
sUser := '';
sPass := '';
I := MaxLogonFailCount;
repeat
if I <> MaxLogonFailCount then
Dialogs.MessageDlg(LogonErrorMsg02, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK] , 0);
{ 旧调用模式
lAccept := TSystemCore.SystemInterface.ShowLogonForm(sUser, sPass);}
lAccept := TSystemCore.SystemInterface.ShowLogonFormEx(sUser, sPass, lLogonPerson);
if not lAccept then Break;
// IE嵌入登陆 sUser的返回可以为空(这个方案不好,为了做嵌入IE登陆)
if sUser <> '' then
begin
lAccountID := sUser;
lUserID := JSCommon.SplitStr('@', lAccountID);
BizSys.BizSystem.ClientAccount := lAccountID;
Result := (not Opr.IsSystemManager(lUserID) or ExtUtils.ClientAccountExist(BizSys.BizSystem.ClientAccount)) and
TSystemCore.LogonEx(lUserID, sPass, lLogonPerson);
end
else
Result := True;
if Result then Break;
Dec(I);
until I = 0;
if not Result then
if lAccept then
Dialogs.MessageDlg(SysUtils.Format(LogonErrorMsg03, [MaxLogonFailCount]),
TMsgDlgType.mtError, [TMsgDlgBtn.mbOK] , 0);
end; |