Browse Source

REPORT-60288 用户登录逻辑问题修复

zheng-1641779399395
Lanlan 3 years ago
parent
commit
abb2b1554b
  1. 9
      designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java
  2. 28
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  3. 6
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java

9
designer-base/src/main/java/com/fr/design/login/service/DesignerPassportManager.java

@ -5,6 +5,7 @@ import com.fr.design.login.DesignerLoginType;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.event.EventDispatcher;
import com.fr.json.JSONObject;
import com.fr.stable.StringUtils;
/**
* @author Lanlan
@ -96,6 +97,14 @@ public class DesignerPassportManager {
return uid;
}
/**
* 登出帆软通行证
*/
public void logout() {
saveUserInfo(-1, StringUtils.EMPTY, StringUtils.EMPTY, StringUtils.EMPTY, DesignerLoginType.UNKNOWN, StringUtils.EMPTY);
EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY);
}
/**
* 保存登录信息
*/

28
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java

@ -6,6 +6,7 @@ package com.fr.design.mainframe.bbs;
import com.fr.design.DesignerEnvManager;
import com.fr.design.bbs.BBSLoginUtils;
import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.extra.LoginContextListener;
import com.fr.design.extra.UserLoginContext;
import com.fr.design.gui.ilable.UILabel;
@ -14,6 +15,7 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource;
import com.fr.design.login.service.DesignerPassportManager;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl;
@ -29,6 +31,7 @@ import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import java.awt.Cursor;
import java.awt.Frame;
@ -120,8 +123,33 @@ public class UserInfoLabel extends UILabel {
UserLoginContext.fireLoginContextListener(DesignerLoginSource.SWITCH_ACCOUNT);
}
});
//退出登录
UIMenuItem logout = new UIMenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout"));
logout.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
String[] options = new String[]{
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Button_Cancel")
};
int rv = FineJOptionPane.showConfirmDialog(
DesignerLoginHelper.getDialog(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Logout_Tip"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"),
JOptionPane.OK_CANCEL_OPTION,
JOptionPane.WARNING_MESSAGE,
null,
options,
options[1]
);
if (rv == JOptionPane.YES_OPTION) {
DesignerPassportManager.getInstance().logout();
}
}
});
menu.add(priviteMessage);
menu.add(closeOther);
menu.add(logout);
GUICoreUtils.showPopupMenu(menu, UserInfoLabel.this, 0, MENU_HEIGHT);
} else {
UserLoginContext.fireLoginContextListener(DesignerLoginSource.NORMAL);

6
designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java

@ -86,6 +86,12 @@ public class UserInfoPane extends BasicPane {
markSignIn(text);
}
});
EventDispatcher.listen(CertificateEvent.LOGOUT, new Listener<String>() {
@Override
public void on(Event event, String text) {
markUnSignIn();
}
});
}
public UserInfoLabel getUserInfoLabel() {

Loading…
Cancel
Save