|
|
@ -14,6 +14,7 @@ import com.fr.general.FRFont; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.FRLogger; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.Inter; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
import com.fr.general.http.HttpClient; |
|
|
|
|
|
|
|
import com.fr.stable.EncodeConstants; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.*; |
|
|
|
import javax.swing.*; |
|
|
@ -24,8 +25,10 @@ import java.awt.event.ActionListener; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyAdapter; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyEvent; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
import java.awt.event.KeyListener; |
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
import java.net.HttpURLConnection; |
|
|
|
import java.net.HttpURLConnection; |
|
|
|
import java.net.URI; |
|
|
|
import java.net.URI; |
|
|
|
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author richie |
|
|
|
* @author richie |
|
|
@ -91,6 +94,7 @@ public class BBSLoginDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 构造函数 |
|
|
|
* 构造函数 |
|
|
|
|
|
|
|
* |
|
|
|
* @param parent 父窗口 |
|
|
|
* @param parent 父窗口 |
|
|
|
* @param userInfoLabel 登录状态label |
|
|
|
* @param userInfoLabel 登录状态label |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -276,17 +280,23 @@ public class BBSLoginDialog extends UIDialog { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 是否登陆成功 |
|
|
|
* 是否登陆成功 |
|
|
|
|
|
|
|
* |
|
|
|
* @param username 用户名 |
|
|
|
* @param username 用户名 |
|
|
|
* @param password 密码 |
|
|
|
* @param password 密码 |
|
|
|
* @return 同上 |
|
|
|
* @return 同上 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static boolean login(String username, String password) { |
|
|
|
public static boolean login(String username, String password) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
username = URLEncoder.encode(username, EncodeConstants.ENCODING_GBK); |
|
|
|
|
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
|
|
|
|
FRLogger.getLogger().error(e.getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
String url = URL + "&username=" + username + "&password=" + password; |
|
|
|
String url = URL + "&username=" + username + "&password=" + password; |
|
|
|
HttpClient client = new HttpClient(url); |
|
|
|
HttpClient client = new HttpClient(url); |
|
|
|
client.setTimeout(TIME_OUT); |
|
|
|
client.setTimeout(TIME_OUT); |
|
|
|
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) { |
|
|
|
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
String res = client.getResponseText("GBK"); |
|
|
|
String res = client.getResponseText(EncodeConstants.ENCODING_GBK); |
|
|
|
if (res.contains(LOGIN_SUCCESS_FLAG)) { |
|
|
|
if (res.contains(LOGIN_SUCCESS_FLAG)) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|