Browse Source

Merge remote-tracking branch 'origin/feature/10.0' into feature/10.0

feature/10.0
pengda 4 years ago
parent
commit
c5aae7b9e0
  1. 60
      designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java
  2. 5
      designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java
  3. 52
      designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java
  4. 13
      designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java
  5. 5
      designer-base/src/main/java/com/fr/design/upm/UpmBridge.java
  6. 54
      designer-base/src/main/resources/com/fr/design/login/lib/locale/login_en_US.js
  7. 54
      designer-base/src/main/resources/com/fr/design/login/lib/locale/login_ja_JP.js
  8. 54
      designer-base/src/main/resources/com/fr/design/login/lib/locale/login_ko_KR.js
  9. 54
      designer-base/src/main/resources/com/fr/design/login/lib/locale/login_zh_TW.js
  10. 2
      designer-base/src/main/resources/com/fr/design/login/login.js
  11. 22
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java
  12. 11
      designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoPane.java
  13. 15
      designer-realize/src/main/java/com/fr/design/share/SharableManager.java
  14. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

60
designer-base/src/main/java/com/fr/design/login/AbstractDesignerSSO.java

@ -1,22 +1,14 @@
package com.fr.design.login; package com.fr.design.login;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.actions.UpdateAction; import com.fr.design.actions.UpdateAction;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.utils.BrowseUtils; import com.fr.design.utils.BrowseUtils;
import com.fr.general.CloudCenter;
import com.fr.general.log.MessageFormatter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils;
import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.security.SecureRandom;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/** /**
* @author Lanlan * @author Lanlan
@ -25,30 +17,19 @@ import javax.crypto.spec.SecretKeySpec;
*/ */
public abstract class AbstractDesignerSSO extends UpdateAction { public abstract class AbstractDesignerSSO extends UpdateAction {
private static final String PRODUCT_FINEREPORT = "product-finereport";
private static final String KEY = "i7hP48WAcuTrmxfN";
@Override @Override
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
String url = getJumpUrl(); String url = getJumpUrl();
if (!SupportOSImpl.DESIGNER_LOGIN.support()) {
BrowseUtils.browser(url);
return;
}
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
int uid = manager.getDesignerLoginUid(); int uid = manager.getDesignerLoginUid();
if (uid > 0) { if (uid > 0) {
String ssoUrl = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}"); String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(url);
try { BrowseUtils.browser(ssoUrl);
String code = generateLoginCode(); } else {
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(ssoUrl, new String[]{code, url}); if (!SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv()) {
BrowseUtils.browser(tuple.getMessage());
} catch (Exception e) {
BrowseUtils.browser(url); BrowseUtils.browser(url);
FineLoggerFactory.getLogger().error(e.getMessage(), e); return;
} }
} else {
boolean loginRemindBeforeJumpBBS = manager.isLoginRemindBeforeJumpBBS(); boolean loginRemindBeforeJumpBBS = manager.isLoginRemindBeforeJumpBBS();
if (loginRemindBeforeJumpBBS) { if (loginRemindBeforeJumpBBS) {
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
@ -61,32 +42,5 @@ public abstract class AbstractDesignerSSO extends UpdateAction {
} }
} }
private String generateLoginCode() throws Exception {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
JSONObject jo = JSONObject.create();
jo.put("uid", manager.getDesignerLoginUid());
jo.put("username", manager.getDesignerLoginUsername());
jo.put("source", PRODUCT_FINEREPORT);
byte[] iv = randomIv();
return new String(Hex.encode(iv)) + encrypt(jo.toString(), KEY.getBytes(), iv);
}
private static byte[] randomIv() {
byte[] salt = new byte[16];
SecureRandom secureRandom = new SecureRandom();
secureRandom.setSeed(System.currentTimeMillis());
secureRandom.nextBytes(salt);
return salt;
}
public static String encrypt(String content, byte[] key, byte[] iv) throws Exception {
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CTR/PKCS5Padding");
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
byte[] resultBytes = cipher.doFinal(content.getBytes());
return new String(Hex.encode(resultBytes));
}
public abstract String getJumpUrl(); public abstract String getJumpUrl();
} }

5
designer-base/src/main/java/com/fr/design/login/guide/DesignerGuideHelper.java

@ -1,10 +1,12 @@
package com.fr.design.login.guide; package com.fr.design.login.guide;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog; import com.fr.design.dialog.UIDialog;
import com.fr.design.event.DesignerOpenedListener; import com.fr.design.event.DesignerOpenedListener;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.update.push.DesignerPushUpdateManager;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.WindowConstants; import javax.swing.WindowConstants;
@ -32,7 +34,8 @@ public class DesignerGuideHelper {
} }
public static void prepareShowGuideDialog() { public static void prepareShowGuideDialog() {
if (!SupportOSImpl.DESIGNER_LOGIN.support()) { // 如果存在更新升级的弹窗,则不显示引导页面
if (!SupportOSImpl.DESIGNER_LOGIN.support() || !FRContext.isChineseEnv() || DesignerPushUpdateManager.getInstance().isShouldPopUp()) {
return; return;
} }
if (isActivatedForOneWeek()) { if (isActivatedForOneWeek()) {

52
designer-base/src/main/java/com/fr/design/login/utils/DesignerLoginUtils.java

@ -2,9 +2,18 @@ package com.fr.design.login.utils;
import com.fr.design.DesignerEnvManager; import com.fr.design.DesignerEnvManager;
import com.fr.design.mainframe.toast.DesignerToastMsgUtil; import com.fr.design.mainframe.toast.DesignerToastMsgUtil;
import com.fr.general.CloudCenter;
import com.fr.general.GeneralContext; import com.fr.general.GeneralContext;
import com.fr.general.log.MessageFormatter;
import com.fr.json.JSONObject;
import com.fr.log.FineLoggerFactory;
import com.fr.third.org.bouncycastle.util.encoders.Hex;
import java.security.SecureRandom;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/** /**
* @author Lanlan * @author Lanlan
@ -13,6 +22,10 @@ import java.util.Map;
*/ */
public class DesignerLoginUtils { public class DesignerLoginUtils {
private static final String PRODUCT_FINEREPORT = "product-finereport";
private static final String KEY = "i7hP48WAcuTrmxfN";
public static Map<String, String> renderMap() { public static Map<String, String> renderMap() {
Map<String, String> map4Tpl = new HashMap<>(); Map<String, String> map4Tpl = new HashMap<>();
map4Tpl.put("language", GeneralContext.getLocale().toString()); map4Tpl.put("language", GeneralContext.getLocale().toString());
@ -32,4 +45,43 @@ public class DesignerLoginUtils {
} }
} }
} }
public static String generateDesignerSSOUrl(String referrer) {
String ssoTemplate = CloudCenter.getInstance().acquireUrlByKind("designer.sso.api", "https://id.fanruan.com/api/app/?code={}&referrer={}");
try {
String code = generateLoginCode();
MessageFormatter.FormattingTuple tuple = MessageFormatter.arrayFormat(ssoTemplate, new String[]{code, referrer});
return tuple.getMessage();
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return referrer;
}
private static String generateLoginCode() throws Exception {
DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
JSONObject jo = JSONObject.create();
jo.put("uid", manager.getDesignerLoginUid());
jo.put("username", manager.getDesignerLoginUsername());
jo.put("source", PRODUCT_FINEREPORT);
byte[] iv = randomIv();
return new String(Hex.encode(iv)) + encrypt(jo.toString(), KEY.getBytes(), iv);
}
private static byte[] randomIv() {
byte[] salt = new byte[16];
SecureRandom secureRandom = new SecureRandom();
secureRandom.setSeed(System.currentTimeMillis());
secureRandom.nextBytes(salt);
return salt;
}
private static String encrypt(String content, byte[] key, byte[] iv) throws Exception {
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CTR/PKCS5Padding");
IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
byte[] resultBytes = cipher.doFinal(content.getBytes());
return new String(Hex.encode(resultBytes));
}
} }

13
designer-base/src/main/java/com/fr/design/update/push/DesignerPushUpdateManager.java

@ -27,6 +27,8 @@ public class DesignerPushUpdateManager {
private DesignerUpdateInfo updateInfo; private DesignerUpdateInfo updateInfo;
private boolean shouldPopUp = false;
private DesignerPushUpdateManager() { private DesignerPushUpdateManager() {
} }
@ -91,13 +93,14 @@ public class DesignerPushUpdateManager {
* 检查更新如果有合适的更新版本则弹窗 * 检查更新如果有合适的更新版本则弹窗
*/ */
private void checkAndPop() { private void checkAndPop() {
checkUpdateService.execute(new Runnable() {
@Override
public void run() {
if (!shouldPopUp()) { if (!shouldPopUp()) {
this.shouldPopUp = true;
FineLoggerFactory.getLogger().debug("skip push update"); FineLoggerFactory.getLogger().debug("skip push update");
return; return;
} }
checkUpdateService.execute(new Runnable() {
@Override
public void run() {
final DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); final DesignerFrame designerFrame = DesignerContext.getDesignerFrame();
DesignerPushUpdateDialog.createAndShow(designerFrame, updateInfo); DesignerPushUpdateDialog.createAndShow(designerFrame, updateInfo);
} }
@ -139,6 +142,10 @@ public class DesignerPushUpdateManager {
return StringUtils.isNotEmpty(prefix) && fullCurrentVersion.contains(SPLIT_CHAR); return StringUtils.isNotEmpty(prefix) && fullCurrentVersion.contains(SPLIT_CHAR);
} }
public boolean isShouldPopUp() {
return shouldPopUp;
}
/** /**
* 跳转到更新升级窗口并自动开始更新 * 跳转到更新升级窗口并自动开始更新
*/ */

5
designer-base/src/main/java/com/fr/design/upm/UpmBridge.java

@ -18,9 +18,11 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsRegisterMark;
import com.fr.design.locale.impl.BbsResetMark; import com.fr.design.locale.impl.BbsResetMark;
import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.upm.event.DownloadEvent; import com.fr.design.upm.event.DownloadEvent;
import com.fr.design.upm.exec.UpmBrowserExecutor; import com.fr.design.upm.exec.UpmBrowserExecutor;
import com.fr.design.upm.task.UpmTaskWorker; import com.fr.design.upm.task.UpmTaskWorker;
import com.fr.design.utils.BrowseUtils;
import com.fr.event.EventDispatcher; import com.fr.event.EventDispatcher;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import com.fr.general.locale.LocaleCenter; import com.fr.general.locale.LocaleCenter;
@ -424,7 +426,8 @@ public class UpmBridge {
public void getPriviteMessage() { public void getPriviteMessage() {
try { try {
LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class); LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class);
Desktop.getDesktop().browse(new URI(spaceMark.getValue())); String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(spaceMark.getValue());
BrowseUtils.browser(ssoUrl);
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage()); FineLoggerFactory.getLogger().info(exp.getMessage());
} }

54
designer-base/src/main/resources/com/fr/design/login/lib/locale/login_en_US.js

@ -1,5 +1,59 @@
var Store = { var Store = {
i18n : { i18n : {
'Designer-Login_User_Name': 'Username/Email/Phone number',
'Designer-Login_User_Name_Hint': 'Please enter username/email/phone number',
'Designer-Login_Password': 'Password',
'Designer-Login_Password_Hint': 'Please enter the password',
'Designer-Login': 'Login',
'Designer-Login_Title': 'FanRuan Passport Login',
'Designer-Login_I_Have_Read': 'I have read',
'Designer-Login_Service_Terms': 'Terms of Service',
'Designer-Login_Forget_Password': 'Forgot your password?',
'Designer-Login_Sms': 'SMS login',
'Designer-Login_Normal': 'Password login',
'Designer-Login_Phone': 'Phone number',
'Designer-Login_Phone_Hint': 'Please enter your phone number',
'Designer-Login_Code': 'Captcha',
'Designer-Login_Code_Hint': 'Please enter the captcha',
'Designer-Login_Code_Request': 'Get captcha',
'Designer-Login_Code_Request_Again': 'Re-acquire',
'Designer-Login_Register_Or_Login': 'Register/Login',
'Designer-Basic_Chinese_Mainland': 'Mainland China',
'Designer-Basic_Chinese_Hong_Kong': 'Hong Kong',
'Designer-Basic_Chinese_Macao': 'Macao',
'Designer-Basic_Chinese_Taiwan': 'Taiwan',
'Designer-Basic_Turkey': 'Turkey',
'Designer-Basic_South_Korea': 'South Korea',
'Designer-Basic_Japan': 'Japan',
'Designer-Basic_Singapore': 'Singapore',
'Designer-Basic_Malaysia': 'Malaysia',
'Designer-Login_Username_Not_Null': 'Username cannot be empty',
'Designer-Login_Password_Not_Null': 'Password cannot be empty',
'Designer-Login_Username_Or_Password_Incorrect': 'The username or password is incorrect, please check',
'Designer-Login_Phone_Not_Null': 'The phone number format is illegal',
'Designer-Login_Code_Not_Null': 'The captcha cannot be empty',
'Designer-Login_Code_Incorrect': 'The captcha has expired, please get it again',
'Designer-Login_Password_Setting_Hint': 'Enter the login password (6-16 digits password can be entered)',
'Designer-Login_Store_User_Not_Exist': 'The username does not exist',
'Designer-Login_Store_User_Password_Error': 'Username or password is incorrect',
'Designer-Login_Token_Request_Failed': 'Failed to get registration token',
'Designer-Login_Unexpected_Error': 'Unexpected error',
'Designer-Login_Internal_Error': 'Server internal error',
'Designer-Guide_Do_Not_Remind': 'No reminders within one month',
'Designer-Guide_Login': 'Login now',
'Designer-BBS_Register_Timeout': 'Register timeout, please resend the captcha',
'Designer-BBS_Phone_Is_Register': 'The phone number is already registered',
'Designer-BBS_Captcha_Send_Exceed_Limit': 'The captcha can only be sent once every 60s',
'Designer-BBS_Phone_Format_Error': 'Failed to send, the phone number format is incorrect',
'Designer-BBS_Captcha_Out_Of_Date': 'The captcha has expired, please get it again',
'Designer-BBS_Captcha_Try_Exceed_Limit': 'The number of attempts of the captcha has reached the upper limit, please get it again',
'Designer-BBS_Captcha_Error': 'Captcha error',
'Designer-BBS_Username_Format_Error': 'The nickname only supports Chinese, English and numbers',
'Designer-BBS_Username_Too_Short': 'The length of the nickname is too short',
'Designer-BBS_Username_Too_Long': 'The length of this nickname has reached the upper limit',
'Designer-BBS_Username_Is_Register': 'The user has been registered',
'Designer-BBS_Please_Enter_Correct_Phone': 'Please enter the correct phone number',
'Designer-Login_Network_Connected_Failed': 'Network connection failed',
}} }}
window.Store = Store; window.Store = Store;

54
designer-base/src/main/resources/com/fr/design/login/lib/locale/login_ja_JP.js

@ -1,5 +1,59 @@
var Store = { var Store = {
i18n : { i18n : {
'Designer-Login_User_Name': 'ユーザ名/メールアドレス/携帯番号',
'Designer-Login_User_Name_Hint': 'ユーザ名/メールアドレス/携帯番号を入力してください。',
'Designer-Login_Password': 'パスワード',
'Designer-Login_Password_Hint': 'パスワードを入力してください。',
'Designer-Login': 'ログイン',
'Designer-Login_Title': 'FanRuanアカウントでログイン',
'Designer-Login_I_Have_Read': '承認する',
'Designer-Login_Service_Terms': '利用規約',
'Designer-Login_Forget_Password': 'パスワードをお忘れですか',
'Designer-Login_Sms': '認証コードログイン',
'Designer-Login_Normal': 'パスワードでログイン',
'Designer-Login_Phone': '携帯番号',
'Designer-Login_Phone_Hint': '携帯番号を入力してください。',
'Designer-Login_Code': '認証コード',
'Designer-Login_Code_Hint': '認証コードを入力してください。',
'Designer-Login_Code_Request': '認証コードを取得',
'Designer-Login_Code_Request_Again': '再取得',
'Designer-Login_Register_Or_Login': '登録/ログイン',
'Designer-Basic_Chinese_Mainland': '中国大陸',
'Designer-Basic_Chinese_Hong_Kong': '中国香港',
'Designer-Basic_Chinese_Macao': '中国澳門',
'Designer-Basic_Chinese_Taiwan': '中国台湾',
'Designer-Basic_Turkey': 'トルコ共和国',
'Designer-Basic_South_Korea': '韓国',
'Designer-Basic_Japan': '日本',
'Designer-Basic_Singapore': 'シンガポール',
'Designer-Basic_Malaysia': 'マレーシア',
'Designer-Login_Username_Not_Null': 'ユーザ名は空白不可。',
'Designer-Login_Password_Not_Null': 'パスワードは空白不可。',
'Designer-Login_Username_Or_Password_Incorrect': 'ユーザ名又はパスワードが間違っています。ご確認ください。',
'Designer-Login_Phone_Not_Null': '携帯番号の形式が正しくない。',
'Designer-Login_Code_Not_Null': '認証コードは空白不可。',
'Designer-Login_Code_Incorrect': '認証コードが無効になりました。再取得してください。',
'Designer-Login_Password_Setting_Hint': 'パスワードを入力してください。(6‐16桁入力可能)',
'Designer-Login_Store_User_Not_Exist': 'ユーザ名は存在しません',
'Designer-Login_Store_User_Password_Error': 'ユーザ名又はパスワードが間違っています。',
'Designer-Login_Token_Request_Failed': '登録Token取得に失敗',
'Designer-Login_Unexpected_Error': '未知のエラー',
'Designer-Login_Internal_Error': 'サーバ内部エラー',
'Designer-Guide_Do_Not_Remind': '一か月内アラートしません。',
'Designer-Guide_Login': 'ログイン',
'Designer-BBS_Register_Timeout': '登録Timeout、検証コードをもう一度取得してください。',
'Designer-BBS_Phone_Is_Register': 'この携帯は既に登録されています。',
'Designer-BBS_Captcha_Send_Exceed_Limit': '認証コードは60s内に一回しか送信できません。',
'Designer-BBS_Phone_Format_Error': '携帯番号の形式が間違っています、検証コード送信失敗。',
'Designer-BBS_Captcha_Out_Of_Date': '認証コードが無効になりました。再取得してください。',
'Designer-BBS_Captcha_Try_Exceed_Limit': '認証コードの試行回数が上限に達しています。再取得してください。',
'Designer-BBS_Captcha_Error': '認証コードが間違っています。',
'Designer-BBS_Username_Format_Error': 'ユーザ名は漢字、アルバイトと数字しかサポートできません。',
'Designer-BBS_Username_Too_Short': 'ユーザ名が短すぎます。',
'Designer-BBS_Username_Too_Long': 'ユーザ名が長すぎます。',
'Designer-BBS_Username_Is_Register': 'このユーザは登録済みです。',
'Designer-BBS_Please_Enter_Correct_Phone': '正確な携帯番号を入力してください。',
'Designer-Login_Network_Connected_Failed': 'インターネット接続失敗',
}} }}
window.Store = Store; window.Store = Store;

54
designer-base/src/main/resources/com/fr/design/login/lib/locale/login_ko_KR.js

@ -1,5 +1,59 @@
var Store = { var Store = {
i18n : { i18n : {
'Designer-Login_User_Name': 'Username/Email/Phone number',
'Designer-Login_User_Name_Hint': 'Please enter username/email/phone number',
'Designer-Login_Password': 'Password',
'Designer-Login_Password_Hint': 'Please enter the password',
'Designer-Login': 'Login',
'Designer-Login_Title': 'FanRuan Passport Login',
'Designer-Login_I_Have_Read': 'I have read',
'Designer-Login_Service_Terms': 'Terms of Service',
'Designer-Login_Forget_Password': 'Forgot your password?',
'Designer-Login_Sms': 'SMS login',
'Designer-Login_Normal': 'Password login',
'Designer-Login_Phone': 'Phone number',
'Designer-Login_Phone_Hint': 'Please enter your phone number',
'Designer-Login_Code': 'Captcha',
'Designer-Login_Code_Hint': 'Please enter the captcha',
'Designer-Login_Code_Request': 'Get captcha',
'Designer-Login_Code_Request_Again': 'Re-acquire',
'Designer-Login_Register_Or_Login': 'Register/Login',
'Designer-Basic_Chinese_Mainland': 'Mainland China',
'Designer-Basic_Chinese_Hong_Kong': 'Hong Kong',
'Designer-Basic_Chinese_Macao': 'Macao',
'Designer-Basic_Chinese_Taiwan': 'Taiwan',
'Designer-Basic_Turkey': 'Turkey',
'Designer-Basic_South_Korea': 'South Korea',
'Designer-Basic_Japan': 'Japan',
'Designer-Basic_Singapore': 'Singapore',
'Designer-Basic_Malaysia': 'Malaysia',
'Designer-Login_Username_Not_Null': 'Username cannot be empty',
'Designer-Login_Password_Not_Null': 'Password cannot be empty',
'Designer-Login_Username_Or_Password_Incorrect': 'The username or password is incorrect, please check',
'Designer-Login_Phone_Not_Null': 'The phone number format is illegal',
'Designer-Login_Code_Not_Null': 'The captcha cannot be empty',
'Designer-Login_Code_Incorrect': 'The captcha has expired, please get it again',
'Designer-Login_Password_Setting_Hint': 'Enter the login password (6-16 digits password can be entered)',
'Designer-Login_Store_User_Not_Exist': 'The username does not exist',
'Designer-Login_Store_User_Password_Error': 'Username or password is incorrect',
'Designer-Login_Token_Request_Failed': 'Failed to get registration token',
'Designer-Login_Unexpected_Error': 'Unexpected error',
'Designer-Login_Internal_Error': 'Server internal error',
'Designer-Guide_Do_Not_Remind': 'No reminders within one month',
'Designer-Guide_Login': 'Login now',
'Designer-BBS_Register_Timeout': 'Register timeout, please resend the captcha',
'Designer-BBS_Phone_Is_Register': 'The phone number is already registered',
'Designer-BBS_Captcha_Send_Exceed_Limit': 'The captcha can only be sent once every 60s',
'Designer-BBS_Phone_Format_Error': 'Failed to send, the phone number format is incorrect',
'Designer-BBS_Captcha_Out_Of_Date': 'The captcha has expired, please get it again',
'Designer-BBS_Captcha_Try_Exceed_Limit': 'The number of attempts of the captcha has reached the upper limit, please get it again',
'Designer-BBS_Captcha_Error': 'Captcha error',
'Designer-BBS_Username_Format_Error': 'The nickname only supports Chinese, English and numbers',
'Designer-BBS_Username_Too_Short': 'The length of the nickname is too short',
'Designer-BBS_Username_Too_Long': 'The length of this nickname has reached the upper limit',
'Designer-BBS_Username_Is_Register': 'The user has been registered',
'Designer-BBS_Please_Enter_Correct_Phone': 'Please enter the correct phone number',
'Designer-Login_Network_Connected_Failed': 'Network connection failed',
}} }}
window.Store = Store; window.Store = Store;

54
designer-base/src/main/resources/com/fr/design/login/lib/locale/login_zh_TW.js

@ -1,5 +1,59 @@
var Store = { var Store = {
i18n : { i18n : {
'Designer-Login_User_Name': '帳號/郵箱/手機號',
'Designer-Login_User_Name_Hint': '請輸入帳號/郵箱/手機號',
'Designer-Login_Password': '密碼',
'Designer-Login_Password_Hint': '請輸入密碼',
'Designer-Login': '登入',
'Designer-Login_Title': '帆軟通行證登入',
'Designer-Login_I_Have_Read': '我已閱讀',
'Designer-Login_Service_Terms': '服務條款',
'Designer-Login_Forget_Password': '忘記密碼?',
'Designer-Login_Sms': '驗證碼登入',
'Designer-Login_Normal': '密碼登入',
'Designer-Login_Phone': '手機號碼',
'Designer-Login_Phone_Hint': '請輸入手機號碼',
'Designer-Login_Code': '驗證碼',
'Designer-Login_Code_Hint': '請輸入驗證碼',
'Designer-Login_Code_Request': '獲取驗證碼',
'Designer-Login_Code_Request_Again': '重新獲取',
'Designer-Login_Register_Or_Login': '註冊/登入',
'Designer-Basic_Chinese_Mainland': '中國大陸',
'Designer-Basic_Chinese_Hong_Kong': '中國香港',
'Designer-Basic_Chinese_Macao': '中國澳門',
'Designer-Basic_Chinese_Taiwan': '中國臺灣',
'Designer-Basic_Turkey': '土耳其',
'Designer-Basic_South_Korea': '韓國',
'Designer-Basic_Japan': '日本',
'Designer-Basic_Singapore': '新加坡',
'Designer-Basic_Malaysia': '馬來西亞',
'Designer-Login_Username_Not_Null': '使用者名稱不能為空',
'Designer-Login_Password_Not_Null': '密碼不能為空',
'Designer-Login_Username_Or_Password_Incorrect': '使用者名稱或者密碼錯誤,請檢查',
'Designer-Login_Phone_Not_Null': '手機號碼格式不正確',
'Designer-Login_Code_Not_Null': '驗證碼不能為空',
'Designer-Login_Code_Incorrect': '驗證碼已過期,請重新獲取',
'Designer-Login_Password_Setting_Hint': '輸入登入密碼(可輸入6-16位密碼)',
'Designer-Login_Store_User_Not_Exist': '帳號不存在',
'Designer-Login_Store_User_Password_Error': '帳號或密碼錯誤',
'Designer-Login_Token_Request_Failed': '註冊令牌獲取失敗',
'Designer-Login_Unexpected_Error': '未知錯誤',
'Designer-Login_Internal_Error': '伺服器內部錯誤',
'Designer-Guide_Do_Not_Remind': '一個月內不再提醒',
'Designer-Guide_Login': '立即登入',
'Designer-BBS_Register_Timeout': '註冊超時,請重新發送驗證碼',
'Designer-BBS_Phone_Is_Register': '該手機號碼已註冊',
'Designer-BBS_Captcha_Send_Exceed_Limit': '驗證碼每60s只能傳送一次',
'Designer-BBS_Phone_Format_Error': '傳送失敗,手機號格式錯誤',
'Designer-BBS_Captcha_Out_Of_Date': '驗證碼已過期,請重新獲取',
'Designer-BBS_Captcha_Try_Exceed_Limit': '驗證碼嘗試次數已達上限,請重新獲取',
'Designer-BBS_Captcha_Error': '驗證碼錯誤',
'Designer-BBS_Username_Format_Error': '暱稱只支援中英文和數字',
'Designer-BBS_Username_Too_Short': '暱稱長度太短',
'Designer-BBS_Username_Too_Long': '這個暱稱長度已經達到了上限',
'Designer-BBS_Username_Is_Register': '該帳號已被註冊',
'Designer-BBS_Please_Enter_Correct_Phone': '請輸入正確的手機號',
'Designer-Login_Network_Connected_Failed': '網路連線失敗',
}} }}
window.Store = Store; window.Store = Store;

2
designer-base/src/main/resources/com/fr/design/login/login.js

File diff suppressed because one or more lines are too long

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

@ -14,14 +14,12 @@ import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.locale.impl.BbsSpaceMark; import com.fr.design.locale.impl.BbsSpaceMark;
import com.fr.design.login.DesignerLoginHelper; import com.fr.design.login.DesignerLoginHelper;
import com.fr.design.login.DesignerLoginSource; import com.fr.design.login.DesignerLoginSource;
import com.fr.design.login.utils.DesignerLoginUtils;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.os.impl.SupportOSImpl; import com.fr.design.os.impl.SupportOSImpl;
import com.fr.design.upm.event.CertificateEvent; import com.fr.design.utils.BrowseUtils;
import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.concurrent.ThreadFactoryBuilder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
@ -31,17 +29,14 @@ import com.fr.general.locale.LocaleMark;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.EncodeConstants; import com.fr.stable.EncodeConstants;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.Color;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Frame; import java.awt.Frame;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URI;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -80,13 +75,17 @@ public class UserInfoLabel extends UILabel {
@Override @Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR)); UserInfoLabel.this.setCursor(new Cursor(Cursor.HAND_CURSOR));
if (StringUtils.isEmpty(DesignerEnvManager.getEnvManager().getDesignerLoginUsername())) {
UserInfoLabel.this.setBackground(UIConstants.DESIGNER_LOGIN_BACKGROUND_ONCLICK); UserInfoLabel.this.setBackground(UIConstants.DESIGNER_LOGIN_BACKGROUND_ONCLICK);
} }
}
@Override @Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
if (StringUtils.isEmpty(DesignerEnvManager.getEnvManager().getDesignerLoginUsername())) {
UserInfoLabel.this.setBackground(UIConstants.DESIGNER_LOGIN_BACKGROUND); UserInfoLabel.this.setBackground(UIConstants.DESIGNER_LOGIN_BACKGROUND);
} }
}
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
@ -104,7 +103,8 @@ public class UserInfoLabel extends UILabel {
if (StringUtils.isNotEmpty(userName)) { if (StringUtils.isNotEmpty(userName)) {
try { try {
LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class); LocaleMark<String> spaceMark = LocaleCenter.getMark(BbsSpaceMark.class);
Desktop.getDesktop().browse(new URI(spaceMark.getValue())); String ssoUrl = DesignerLoginUtils.generateDesignerSSOUrl(spaceMark.getValue());
BrowseUtils.browser(ssoUrl);
} catch (Exception exp) { } catch (Exception exp) {
FineLoggerFactory.getLogger().info(exp.getMessage()); FineLoggerFactory.getLogger().info(exp.getMessage());
} }
@ -211,12 +211,6 @@ public class UserInfoLabel extends UILabel {
DesignerLoginHelper.showLoginDialog(source); DesignerLoginHelper.showLoginDialog(source);
} }
}); });
EventDispatcher.listen(CertificateEvent.LOGIN, new Listener<String>() {
@Override
public void on(Event event, String text) {
setText(text);
}
});
} }
private void clearLoginInformation() { private void clearLoginInformation() {

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

@ -9,6 +9,10 @@ import com.fr.design.DesignerEnvManager;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.BasicPane;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.upm.event.CertificateEvent;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.DateUtils; import com.fr.general.DateUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -75,6 +79,13 @@ public class UserInfoPane extends BasicPane {
autoPushLoginDialog(); autoPushLoginDialog();
this.add(userInfoLabel, BorderLayout.CENTER); this.add(userInfoLabel, BorderLayout.CENTER);
EventDispatcher.listen(CertificateEvent.LOGIN, new Listener<String>() {
@Override
public void on(Event event, String text) {
markSignIn(text);
}
});
} }
public UserInfoLabel getUserInfoLabel() { public UserInfoLabel getUserInfoLabel() {

15
designer-realize/src/main/java/com/fr/design/share/SharableManager.java

@ -9,15 +9,21 @@ import com.fr.design.mainframe.share.collect.ComponentCollector;
import com.fr.design.mainframe.share.collect.SharableCollectorManager; import com.fr.design.mainframe.share.collect.SharableCollectorManager;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler; import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptSelectionClipboardHandler;
import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler; import com.fr.design.mainframe.share.encrypt.clipboard.impl.EncryptTransferableClipboardHandler;
import com.fr.design.mainframe.share.ui.block.LocalWidgetBlock;
import com.fr.design.mainframe.share.ui.local.LocalWidgetRepoPane;
import com.fr.design.mainframe.share.util.ShareComponentUtils; import com.fr.design.mainframe.share.util.ShareComponentUtils;
import com.fr.design.share.utils.EffectItemUtils; import com.fr.design.share.utils.EffectItemUtils;
import com.fr.form.share.ShareLoader;
import com.fr.general.GeneralContext;
import com.fr.json.JSONArray; import com.fr.json.JSONArray;
import com.fr.stable.EnvChangedListener;
import java.util.List; import java.util.List;
public class SharableManager { public class SharableManager {
public static void start() { public static void start() {
SharableCollectorManager.getInstance().execute(); SharableCollectorManager.getInstance().execute();
listenEnv();
ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance()); ClipboardFilter.registerClipboardHandler(EncryptSelectionClipboardHandler.getInstance());
ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance()); ClipboardFilter.registerClipboardHandler(EncryptTransferableClipboardHandler.getInstance());
} }
@ -44,4 +50,13 @@ public class SharableManager {
} }
} }
} }
private static void listenEnv() {
GeneralContext.addEnvChangedListenerToLast(new EnvChangedListener() {
@Override
public void envChanged() {
LocalWidgetRepoPane.getInstance().refreshPane();
}
});
}
} }

4
designer-realize/src/main/java/com/fr/start/module/DesignerActivator.java

@ -118,6 +118,7 @@ import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder; import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider; import com.fr.start.BBSGuestPaneProvider;
import com.fr.task.Once; import com.fr.task.Once;
import com.fr.workspace.WorkContext;
import com.fr.xml.ReportXMLUtils; import com.fr.xml.ReportXMLUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -424,6 +425,9 @@ public class DesignerActivator extends Activator implements Prepare {
} }
private void migrateBBSInfoFromFineDB() { private void migrateBBSInfoFromFineDB() {
if (!WorkContext.getCurrent().isLocal()) {
return;
}
DesignerEnvManager manager = DesignerEnvManager.getEnvManager(); DesignerEnvManager manager = DesignerEnvManager.getEnvManager();
if (manager.isCurrentVersionFirstLaunch()) { if (manager.isCurrentVersionFirstLaunch()) {
int newUid = manager.getDesignerLoginUid(); int newUid = manager.getDesignerLoginUid();

Loading…
Cancel
Save