Browse Source

设计器内论坛登录

master
李攀 8 years ago
parent
commit
1e7c7d2afb
  1. 2
      designer_base/src/com/fr/design/extra/LoginPane.java
  2. 14
      designer_base/src/com/fr/design/extra/LoginWebBridge.java
  3. 8
      designer_base/src/com/fr/design/extra/QQLoginWebBridge.java

2
designer_base/src/com/fr/design/extra/LoginPane.java

@ -16,7 +16,7 @@ public class LoginPane extends BasicPane {
public LoginPane() {
setLayout(new BorderLayout());
if (System.getProperty("java.version").startsWith("1.8")) {
if (StableUtils.getMajorJavaVersion() == 8) {
String installHome;
if (StableUtils.isDebug()) {
URL url = ClassLoader.getSystemResource("");

14
designer_base/src/com/fr/design/extra/LoginWebBridge.java

@ -25,6 +25,10 @@ import java.net.URLEncoder;
public class LoginWebBridge {
private static final String LOGIN_SUCCESS_FLAG = "http://bbs.finereport.com";
private static final String LOGININ = "0";
private static final String LOGIN_INFO_EMPTY = "-1";
private static final String DISCONNECTED = "-2";
private static final String UNKNOWN_ERROR = "-3";
private static final int TIME_OUT = 10000;
private static com.fr.design.extra.LoginWebBridge helper;
@ -102,19 +106,17 @@ public class LoginWebBridge {
*/
public String defaultLogin(String username, String password) {
if (!StringUtils.isNotBlank(username) && !StringUtils.isNotBlank(password)) {
//用户名密码为空
return "-1";
return LOGIN_INFO_EMPTY;
}
if (!testConnection()) {
//网络测试连接不通过
return "-2";
return DISCONNECTED;
}
if (login(username, password)) {
updateUserInfo(username, password);
loginSuccess(username);
return "0";
return LOGININ;
}else {
return "-3";
return UNKNOWN_ERROR;
}
}

8
designer_base/src/com/fr/design/extra/QQLoginWebBridge.java

@ -1,6 +1,5 @@
package com.fr.design.extra;
import com.fr.base.FRContext;
import com.fr.design.DesignerEnvManager;
import com.fr.design.dialog.UIDialog;
import com.fr.design.gui.ilable.UILabel;
@ -17,6 +16,7 @@ public class QQLoginWebBridge {
private static com.fr.design.extra.QQLoginWebBridge helper;
private WebEngine webEngine;
private static String LOGINSUCCESS = "ok";
private static String LOGINFAILED = "failed";
private UIDialog uiDialog;
private UILabel uiLabel;
private UIDialog qqDialog;
@ -95,9 +95,11 @@ public class QQLoginWebBridge {
String username = jo.get("username").toString();
closeQQWindow();
closeParentWindow();
//设置label的用户名
uiLabel.setText(username);
}else {
DesignerEnvManager.getEnvManager().setBBSName(username);
}else if (status.equals(LOGINFAILED)){
//账号没有QQ授权
closeQQWindow();
}
}
}

Loading…
Cancel
Save