Skip to content

Commit

Permalink
1.3.0#
Browse files Browse the repository at this point in the history
登陆失败显示错误信息
  • Loading branch information
Hs1r1us committed Jul 7, 2020
1 parent 4d4ee9e commit 32d4054
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tgfc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 14
targetSdkVersion 28
versionCode 27
versionName "1.2.9"
versionName "1.3.0"
}

buildTypes {
Expand Down
12 changes: 11 additions & 1 deletion tgfc/src/main/java/net/jejer/hipda/async/LoginHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import de.greenrobot.event.EventBus;

Expand Down Expand Up @@ -143,7 +145,15 @@ private int doLogin(String formhash) {
mErrorMsg = "您输入的验证码不正确,请返回修改。";
return Constants.STATUS_SECCODE_FAIL_ABORT;
} else {
mErrorMsg = "登录失败,未知错误";
String mPattern = "<p>.*?<\\/p>";
Pattern r = Pattern.compile(mPattern);
Matcher m = r.matcher(rspStr.substring(rspStr.indexOf("</h1>")));
if (m.find()) {
String matcherStr = m.group();
mErrorMsg = "登录失败:" + matcherStr.substring(3,matcherStr.length()-4);
}else {
mErrorMsg = "登录失败,未知错误";
}
return Constants.STATUS_FAIL_ABORT;
}
} catch (Exception e) {
Expand Down
2 changes: 1 addition & 1 deletion tgfc/src/main/res/values/hipda.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<string name="login_success">"欢迎您回来"</string>
<string name="login_fail">"登录失败"</string>
<string name="login_seccode_fail">"验证码不正确"</string>
<string name="login_seccode_fail">"验证码"</string>
<string name="not_login">"logging.php?action=login"</string>
<string name="default_tail_text">"TGFC·NG"</string>
<string name="default_tail_url">"https://bbs.tgfcer.com/thread-7194126-1-1.html"</string>
Expand Down

0 comments on commit 32d4054

Please sign in to comment.