diff --git a/KUASWifiAutoLogin/.idea/workspace.xml b/KUASWifiAutoLogin/.idea/workspace.xml index 9e9ee3f..ff4c151 100644 --- a/KUASWifiAutoLogin/.idea/workspace.xml +++ b/KUASWifiAutoLogin/.idea/workspace.xml @@ -2,11 +2,24 @@ - + + + + + + + + + + + @style/AppTheme + + + - @@ -37,73 +50,79 @@ - - + + - + - - + + - - + + - - + + + + + - - - + + + + + - - + + + + + - - - - - + + + - - + + - + - - + + - + - - + + - + @@ -1296,7 +1315,7 @@ @@ -1678,10 +1698,9 @@ - + - @@ -1694,46 +1713,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1842,28 +1799,6 @@ - - - - - - - - - - - - - - - - - - - - - - + @@ -1935,7 +1853,7 @@ - + @@ -2159,7 +2077,7 @@ - + @@ -2194,6 +2112,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2285,13 +2260,6 @@ - - - - - - - @@ -2345,13 +2313,6 @@ - - - - - - - @@ -2369,142 +2330,165 @@ - + - - + + - + - - + + - - - - + - - - + + - + - - - + + + + + - - - - + - - + - + - - + + - + - - + + - + - + - + - + - + - + - + - + - + - + + + + + + + + - + - + - + - + - + - + - + + + + - - + + + + + + + + + + + + + - + + + + + + + + + \ No newline at end of file diff --git a/KUASWifiAutoLogin/app/app.iml b/KUASWifiAutoLogin/app/app.iml index a56ed2c..6d97960 100644 --- a/KUASWifiAutoLogin/app/app.iml +++ b/KUASWifiAutoLogin/app/app.iml @@ -95,8 +95,8 @@ - + diff --git a/KUASWifiAutoLogin/app/build.gradle b/KUASWifiAutoLogin/app/build.gradle index e2d39d2..5cecf9f 100644 --- a/KUASWifiAutoLogin/app/build.gradle +++ b/KUASWifiAutoLogin/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "tw.edu.kuas.wifiautologin" minSdkVersion 9 targetSdkVersion 22 - versionCode 213 - versionName "2.1.3" + versionCode 214 + versionName "2.1.4" } buildTypes { release { diff --git a/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/callbacks/Reason.java b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/callbacks/Reason.java new file mode 100644 index 0000000..ae0913a --- /dev/null +++ b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/callbacks/Reason.java @@ -0,0 +1,36 @@ +package tw.edu.kuas.wifiautologin.callbacks; + +public class Reason { + + public static String dumpReason(int reason) + { + switch (reason) + { + case 1: return "登入頁面出現了系統錯誤!"; + case 2: return "沒有指定認證策略!"; + case 3: return "認證策略中自動增加指定的組不存在!"; + case 7: return "用戶已經被列入黑名單!"; + case 8: return "超出帳號最大登入數!"; + case 9: return "帳號綁定檢查失敗!"; + case 10: case 44: case 56: return "帳號不存在!"; + case 11: case 45: case 57: return "密碼不正確!"; + case 12: return "該帳號已經被凍結!"; + case 20:case 21:case 22:case 25: return "連接RADIUS伺服器時,發生了故障(" + reason +")!"; + case 24: return "無法連接到指定的RADIUS伺服器!"; + case 26: return "RADIUS伺服器回應數據不正確!"; + case 27:case 35: return "認證失敗,請檢查您的帳號及密碼 "; + case 30: return "無法連接到指定的POP3伺服器!"; + case 31:case 32: return "連接POP3伺服器時,發生了故障(" + reason + ")!"; + case 33:case 34: return "POP3伺服器回應數據不正確(" + reason + ")!"; + case 40:case 42:case 43: return "連接LDAP伺服器時,發生了故障(" + reason + ")!"; + case 41: return "無法連接到指定的LDAP伺服器!"; + case 50: return "AD伺服器域名配置錯誤!"; + case 51:case 53:case 54: return "連接AD伺服器時,發生了故障(" + reason + ")!"; + case 52: return "無法連接到指定的AD伺服器!"; + case 55: return "AD伺服器的查詢密碼不正確!"; + case 60: return "登入失敗次數超出最大限制!"; + default: return "web_auth_error_" + reason; + } + } + +} \ No newline at end of file diff --git a/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/LoginHelper.java b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/LoginHelper.java index 4329046..5778b45 100644 --- a/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/LoginHelper.java +++ b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/LoginHelper.java @@ -34,6 +34,7 @@ import tw.edu.kuas.wifiautologin.callbacks.Constant; import tw.edu.kuas.wifiautologin.callbacks.GeneralCallback; import tw.edu.kuas.wifiautologin.callbacks.Memory; +import tw.edu.kuas.wifiautologin.callbacks.Reason; public class LoginHelper { private static AsyncHttpClient mClient = init(); @@ -100,8 +101,9 @@ public void onSuccess(int statusCode, Header[] headers, byte[] bytes) { if (callback != null) { loginSuccess(context, loginType, callback, - (_IP.split("\\.")[0].equals("172") && _IP.split("\\.")[1].equals("17")) ? Constant.JIANGONG_WIFI_SERVER : Constant.YANCHAO_WIFI_SERVER - , resultString, false); + (_IP.split("\\.")[0].equals("172") && _IP.split("\\.")[1].equals("17")) ? + Constant.JIANGONG_WIFI_SERVER : Constant.YANCHAO_WIFI_SERVER + , resultString, false); Toast.makeText(context, resultString, Toast.LENGTH_SHORT).show(); tracker.send(new HitBuilders.EventBuilder() @@ -166,7 +168,7 @@ private static void login(final Context context, final LinkedHashMap= 3)) - mNotificationManager - .notify(Constant.NOTIFICATION_LOGIN_ID, mBuilder.build()); + mNotificationManager.notify(Constant.NOTIFICATION_LOGIN_ID, mBuilder.build()); errorTimes++; Memory.setInt(context, Constant.MEMORY_KEY_ERRORTIMES, errorTimes); @@ -400,6 +424,11 @@ private static void loginSuccess(Context context, String loginType, GeneralCallb (loginServer.equals(Constant.JIANGONG_WIFI_SERVER) ? context.getString(R.string.jiangong) : context.getString(R.string.yanchao))); break; + case "Teacher": + resultString = String.format(context.getString(R.string.login_teacher_successfully), + (loginServer.equals(Constant.JIANGONG_WIFI_SERVER) ? context.getString(R.string.jiangong) : + context.getString(R.string.yanchao))); + break; default: resultString = String.format(context.getString(R.string.login_guest_successfully), (loginServer.equals(Constant.JIANGONG_WIFI_SERVER) ? context.getString(R.string.jiangong) : diff --git a/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/Utils.java b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/Utils.java index d1642eb..06c5857 100644 --- a/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/Utils.java +++ b/KUASWifiAutoLogin/app/src/main/java/tw/edu/kuas/wifiautologin/libs/Utils.java @@ -48,13 +48,15 @@ else if (user.length() == 10 && !user.substring(0,2).equals("09")) return user + "@kuas.edu.tw" + ",1,Student"; else return user + "@gm.kuas.edu.tw" + ",@gm.kuas.edu.tw,Student"; + else if (user.length() == 5) + return user + "@kuas.edu.tw" + ",,Teacher"; else if (user.contains("@") && !user.contains("@guest")) return user + ",,Cyber"; else - if (user.contains("@guest")) - return user + ",,Guest"; - else - return user + "@guest,,Guest"; + if (user.contains("@guest")) + return user + ",,Guest"; + else + return user + "@guest,,Guest"; } } diff --git a/KUASWifiAutoLogin/app/src/main/res/drawable-nodpi/ic_main.png b/KUASWifiAutoLogin/app/src/main/res/drawable-nodpi/ic_main.png index 5810127..67ab995 100644 Binary files a/KUASWifiAutoLogin/app/src/main/res/drawable-nodpi/ic_main.png and b/KUASWifiAutoLogin/app/src/main/res/drawable-nodpi/ic_main.png differ diff --git a/KUASWifiAutoLogin/app/src/main/res/layout-land/activity_main.xml b/KUASWifiAutoLogin/app/src/main/res/layout-land/activity_main.xml index 43b0cb8..2fdb8db 100644 --- a/KUASWifiAutoLogin/app/src/main/res/layout-land/activity_main.xml +++ b/KUASWifiAutoLogin/app/src/main/res/layout-land/activity_main.xml @@ -17,18 +17,11 @@ android:orientation="vertical"> - - - - + android:layout_width="match_parent" + android:layout_height="180dp" + android:layout_marginLeft="30sp" + android:layout_marginRight="30sp" + android:scaleType="fitCenter" + android:src="@drawable/ic_main"/> 賓客登入成功,歡迎來到高應大%s校區! 漫遊登入成功,歡迎來到高應大%s校區! 宿舍登入成功,歡迎回到高應大%s宿舍! + 教師登入成功,歡迎回到高應大%s校區! 您已經登入或是有可用網路了。 - 登出成功。 + WiFi登出成功。 已連接到 %s。 不支援的 SSID:%s。 正在登入 %s… 已經登入了。 登入失敗,請再嘗試一次。 + 認證失敗,請檢查您的帳號及密碼。 請求 Wi-Fi 伺服器的連線逾時。 - 已經登出了。 + 您已經登出或是尚未登入WiFi。 登出失敗。 關於 開放原始碼資訊 diff --git a/KUASWifiAutoLogin/app/src/main/res/values/strings.xml b/KUASWifiAutoLogin/app/src/main/res/values/strings.xml index a2d8217..ec8df43 100644 --- a/KUASWifiAutoLogin/app/src/main/res/values/strings.xml +++ b/KUASWifiAutoLogin/app/src/main/res/values/strings.xml @@ -15,6 +15,7 @@ Guest login successful,Welcome to KUAS (%s)! Cyber login successful,Welcome to KUAS (%s)! Dorm login successful,Welcome back to KUAS Dorm (%s)! + Teacher login successful,Welcome to KUAS (%s)! Already logged in. Logout successful. Connected to %s. @@ -22,6 +23,7 @@ Login to %s… Already logged in. Failed to login. + The username or password is incorrect. Connection Timeout. Already logged out. Failed to logout. diff --git a/README.md b/README.md index 91ee5dd..4748c74 100644 --- a/README.md +++ b/README.md @@ -12,4 +12,4 @@ KUAS Wifi Auto Login - 流量統計 ## 許願池: -- Windows版 +- Windows版 \ No newline at end of file