|
发表于 2018-1-31 15:15:37
|
显示全部楼层
后端登录前事件的修改为下面的
- public static void systemProcessBeforeLoginAction() throws Exception {
- String user = ((String) ContextHelper.getActionContext().getParameter("name"));
- Map<Object, Object> options = (Map<Object, Object>) ContextHelper.getActionContext().getParameter("options");
- String deviceType = (String) options.get("DeviceType");
- String userDeviceType = user+":"+deviceType;
- String onLine = (String) options.get("onLine");
- //获取登录输入的name和设备类型,判断map中是否存在
- if (OnLineMap.OnLineMaps.containsKey(userDeviceType)) {
- if(Utils.isNotEmptyString(onLine) && onLine.equals("已登录")){
- HttpSession session = (HttpSession) OnLineMap.OnLineMaps.get(userDeviceType);
- session.invalidate();
- }else
- throw new Exception("此用户已经在当前终端类型登录,请切换其他用户登录");
- }
- }
复制代码
前端在/UI2/portal/base/login/login.js中
- else
- throw justep.Error.create(result.message);
复制代码
修改为:
- else {
- var message = result.message;
- if (message == '此用户已经在当前终端类型登录,请切换其他用户登录') {
- var r = confirm("此用户已经在当前终端类型登录请确认是否退出已登录用户重新登录,若取消请换其他用户登录");
- if (r === true) {
- urlParams["options[onLine]"] = "已登录";
- var result2 = this.doLogin(urlParams);
- if (result2.flag === true) {
- var auto2 = autoLogin.val();
- if (remember.val()) {
- this.store('rememberme', "remember");
- this.store('username', urlParams.username);
- this.store('password', urlParams.password);
- this.store('autoLogin', auto2);
- }
- // 对话框返回数据
- this.comp("receiver").windowEnsure(result2.data);
- return false;
- } else {
- throw justep.Error.create(result2.message);
- }
- } else {
- return;
- }
- } else
- throw justep.Error.create(result.message);
- }
复制代码 |
|