起步软件技术论坛-X3

 找回密码
 立即注册
搜索
查看: 269|回复: 3

2617版本自动登录还是有问题,在线等待。

[复制链接]
发表于 2010-6-18 09:52:26 | 显示全部楼层 |阅读模式
web方式登录系统
运行了
X3X.Logon
X3X.Run("Biz:\\SYSTEM\\Init.Func","","","");
以后,可以进入系统,但是没有岗位信息,就算当前登录者只分配了一个岗位,系统还是没有找到他的岗位。
进入工作台后,工作台内的信息用到了
Dept := SystemUtils.TContextUtils.GetDept(Context).ID;
系统提示:在当前环境中找不到岗位!
修改成下面的方式:
  lContextCurrent := Business.Model.TContextCurrent.Create(Self.Context);
  try
    Dept   := lContextCurrent.Dept.ID;               //当前操作者部门ID
  finally
    lContextCurrent.Free;
  end;
系统提示:在当前环境链中,隔离级为[]POSITION]的不存在。

点击忽略后,工作台一片空白。

注销后重新登录,此时界面中有岗位选择,登录系统后,web页面工作台正常。

如何实现登录是能指定岗位或者默认岗位??
回复

使用道具 举报

发表于 2010-6-18 10:42:15 | 显示全部楼层
单点登录的方式,想实现以某个岗位登录的请参考
http://bbs.justep.com/forum.php?mod=viewthread&tid=22431
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-6-18 11:03:51 | 显示全部楼层
那个帖子我看了,但是2617版本里面的InternalLogon方法只有没有参数的版本。
需要自己重新写InternalLogon(Parameters);??
能把新版本的代码贴一下吗?
回复 支持 反对

使用道具 举报

发表于 2010-6-18 11:06:23 | 显示全部楼层
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;
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Justep Inc.

GMT+8, 2025-7-8 14:25 , Processed in 0.037032 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表