|
|
|
@ -2,6 +2,7 @@ package com.fr.design.login;
|
|
|
|
|
|
|
|
|
|
import com.fr.design.DesignerEnvManager; |
|
|
|
|
import com.fr.design.actions.UpdateAction; |
|
|
|
|
import com.fr.design.os.impl.SupportOSImpl; |
|
|
|
|
import com.fr.design.utils.BrowseUtils; |
|
|
|
|
import com.fr.general.CloudCenter; |
|
|
|
|
import com.fr.general.log.MessageFormatter; |
|
|
|
@ -31,29 +32,31 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
|
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent event) { |
|
|
|
|
String url = getJumpUrl(); |
|
|
|
|
if (StringUtils.isNotEmpty(url)) { |
|
|
|
|
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
|
|
|
|
int uid = manager.getDesignerLoginUid(); |
|
|
|
|
if (uid > 0) { |
|
|
|
|
String ssoUrl = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); |
|
|
|
|
try { |
|
|
|
|
String code = generateLoginCode(); |
|
|
|
|
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(ssoUrl, new String[]{code, url}); |
|
|
|
|
BrowseUtils.browser(tuple.getMessage()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
if (!SupportOSImpl.DESIGNER_LOGIN.support()) { |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); |
|
|
|
|
int uid = manager.getDesignerLoginUid(); |
|
|
|
|
if (uid > 0) { |
|
|
|
|
String ssoUrl = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); |
|
|
|
|
try { |
|
|
|
|
String code = generateLoginCode(); |
|
|
|
|
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(ssoUrl, new String[]{code, url}); |
|
|
|
|
BrowseUtils.browser(tuple.getMessage()); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
boolean loginRemindBeforeJumpBBS = manager.isLoginRemindBeforeJumpBBS(); |
|
|
|
|
if (loginRemindBeforeJumpBBS) { |
|
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|
|
params.put("bbsJumpUrl", url); |
|
|
|
|
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.BBS_JUMP, params); |
|
|
|
|
manager.setLoginRemindBeforeJumpBBS(false); |
|
|
|
|
} else { |
|
|
|
|
boolean loginRemindBeforeJumpBBS = manager.isLoginRemindBeforeJumpBBS(); |
|
|
|
|
if (loginRemindBeforeJumpBBS) { |
|
|
|
|
Map<String, String> params = new HashMap<>(); |
|
|
|
|
params.put("bbsJumpUrl", url); |
|
|
|
|
DesignerLoginHelper.showLoginDialog(DesignerLoginSource.BBS_JUMP, params); |
|
|
|
|
manager.setLoginRemindBeforeJumpBBS(false); |
|
|
|
|
} else { |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
} |
|
|
|
|
BrowseUtils.browser(url); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|