Skip to content

Commit

Permalink
V1.0.1 修正自服务无法登录的bug + acid自动尝试bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CHN-STUDENT committed Jun 9, 2019
1 parent 25b4fd1 commit b863024
Show file tree
Hide file tree
Showing 5 changed files with 368 additions and 16 deletions.
2 changes: 1 addition & 1 deletion EHAUT/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ android {
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
257 changes: 257 additions & 0 deletions EHAUT/app/src/main/assets/web/service.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
<!DOCTYPE html>
<html lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="author" content="E-HAUT Team">
<meta name="copyright" content="&#39; E-HAUT Team">
<meta name="ViewPort" content="initial-scale=1, minimum-scale=1, width=device-width">
<meta name="HandheldFriendly" content="true">
<meta name="renderer" content="webkit">
<title>移动端校园网客户端自服务系统</title>
<link rel="shortcut icon" type="image/png" href="data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAQAAABKfvVzAAABK0lEQVR4Ab3LwUpUYRwF8N+92r29iKKPUKDSovYFSsOEGxd3UNf1DIFQQUHPYOajyOCuKG3SeoTuzGz+wV18MB/T3QT+zurAOe7cffvO/TQ398OZoUqPgd8iy41dS5U+CuFCY02lsm5kLIT3Srlu/seBRYVG210yg26+ZZkdrbCLpPZLOPAvI+FGJdkXLsAbMyew0ApjYSg5FxowE1rI2qHwSTIR1sCJ1mvI2oZwLZkLlT61MPuPw0RY12dTuJJ8FkZY9V1k+WIFx8Kp5IUwVmDbdGHeeoDCpTCQ1G6FBmz7luZfPQRHwkQlYU9o7YBVT7zy0mMr4JGp8Ezmg9BqFBIUjrr5OzlldwljhzbUapuOXQrhrdJSe25FlomnetSGzlybmbpy6rl77thfv0iYemrko00AAAAASUVORK5CYII=">


<style type="text/css">
html,
body {
width: 100%;
height: 100%;
cursor: default
}

html,
body,
p,
h2,

div {
text-align:center;
margin: 0;
padding: 0
}

body {
background: #ebeef3;
text-align: center;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
margin: 0 auto;
}


html {
font: 12px "Segoe UI", "Microsoft YaHei", FreeSans, Arimo, "Droid Sans", "Hiragino Sans GB", "Hiragino Sans GB W3", Arial, sans-serif
}

h2 {
margin-bottom: 25px;
font-size: 24px;
font-weight: 300;
color: #515354
}


p {
line-height: 1.5em;
font-size: 12px;
color: #95a2a9;
margin-bottom: 5px
}

.title {
position: relative;
top: 75px;
margin-bottom: .7em;
line-height: 30px;
font-size: 26px;
font-weight: 300;
color: #fff;
text-shadow: 0 0 4px #666666
}

.box {
position: relative;
top: 80px;
width: 350px;
max-width: 85%;
margin: 0 auto;
background: #fff;
padding: 15px;
border-radius: 8px;
box-shadow: 0 0 20px rgba(0,0,0,.2)
}

.main {
font-size: 18px;
color: #000;
font-weight: 500;
line-height: 1.7em;
margin: 0 0 10px
}

.foot {
position: relative;
top: 80px;
margin: 15px 15px 0;
font-size: 12px;
color: rgba(0,0,0,.87)
}

pre {
background: #3498DB;
color: #ffffff;
padding: 15px 20px;
margin: 25px -15px -15px;
line-height: 1.4em;
font-size: 14px;
text-align: left;
word-break: break-all;
border-bottom-right-radius:8px;
border-bottom-left-radius:8px;
white-space: pre-wrap
}

a {
color: #1678C2;
text-decoration: none;
}

.m{
padding: 0px 0px 8px 0px;
}

.ui input[type=text],.ui input[type=password],.ui input[type=number]{
margin: 0;
outline: 0;
-webkit-appearance: none;
tap-highlight-color: rgba(255,255,255,0);
line-height: 1.2142em;
padding: .67861429em 1em;
background: #FFF;
border: 1px solid rgba(34,36,38,.15);
color: rgba(0,0,0,.87);
border-radius: .28571429rem;
box-shadow: 0 0 0 0 transparent inset;
-webkit-transition: color .1s ease,border-color .1s ease;
transition: color .1s ease,border-color .1s ease
}
.ui input:focus{
border-style:solid;
border-color: #03a9f4;
}
.field {
clear: both;
margin: 0 0 1em;
font-size:18px;
}
.ui.button {
cursor: pointer;
display: inline-block;
min-height: 1em;
outline: 0;
border: none;
vertical-align: baseline;
background: #2185D0;
color: rgb(255, 255, 255);
margin: 0 25px;
padding: .78571429em 1.5em;
text-transform: none;
text-shadow: none;
font-weight: 700;
font-size: 15px;
line-height: 1em;
font-style: normal;
text-decoration: none;
border-radius: .28571429rem;
box-shadow: 0 0 0 0 rgba(34,36,38,.15) inset;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;
transition: opacity .1s ease,background-color .1s ease,color .1s ease,box-shadow .1s ease,background .1s ease;
will-change: '';
-webkit-tap-highlight-color: transparent
}
.ui.button:hover {
background-color: #1678c2;
box-shadow: 0 0 0 1px transparent inset,0 0 0 0 rgba(34,36,38,.15) inset;
}

.ui.red.button{background: #95a2a9;}
.ui.red.button:hover {
background-color: #515354;
box-shadow: 0 0 0 1px transparent inset,0 0 0 0 rgba(34,36,38,.15) inset;}
.ui.set.button{font-size: 12px;background: #3498DB;padding: 0.9em 1.1em;}
.ui.set.button:hover {background-color: #287AB1;
box-shadow: 0 0 0 1px transparent inset,0 0 0 0 rgba(34,36,38,.15) inset;
}
.aleft{float:left;}
.acenter{float:none;}
.aright{float:right;}
.aset{color:rgb(0, 0, 0);text-decoration: underline;}

</style>
</head>

<body>
<div class="container">
<div class="box">
<h2>移动端校园网客户端自服务系统</h2>
<p class="main">
</p><div class="ui field">
学号:<input id="username" type="text" name="text"><br>
</div>
<div class="ui field">
密码:<input id="password" type="password" name="password"><br>
</div>
<div class="m">
<button class="ui button" type="submit" onclick="selfService()">打开自服务</button>
</div>
<br><p>声明:本第三方网页仅用于解决移动端无法登录官方自服务情况。<br>网页不会储存您的个人信息,仅调用接口帮您跳转登录。</p><br>
<div>
<a class="acenter aset" href="http://172.16.154.130:8800/" target="_blank">跳转官方自助服务</a>
</div>
</div>

</div>

<br><br>
<p class="foot"> © <script>document.write(new Date().getFullYear())</script> Powered By <b><font><a href="https://github.com/ehaut" target="_blank">E-HAUT</a></font></b> Team</p>
</body>
<script src="http://172.16.154.130/static/bower/all/1.0.0/all.min.js?v=20180302?v=2.00.20180614"></script>
<script>
function selfService() {
var username = $("#username").val();
if (username == "") {
alert("请输入您的用户名!");
$("#username").focus()
return;
}
//password is empty
var password = $("#password").val();
if (password == "") {
alert("请输入您的密码!");
$("#password").focus()
return;
}
if (typeof username != "undefined" && username != "") {
var ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
base64 = $.base64;
base64.setAlpha(ALPHA);
var data = "";
if (typeof password != "undefined" && password != "") {
var pwd = md5(password);
data = base64.encode(username+":"+pwd);
}
if (data != "") {
window.open("http://172.16.154.130:8800/site/sso?data="+data);
return;
}
}
}
</script>

</html>
12 changes: 10 additions & 2 deletions EHAUT/app/src/main/java/cn/ehaut/srun3000/LoginActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.os.Message
import android.util.Log
import android.widget.Toast
Expand Down Expand Up @@ -61,7 +60,11 @@ class LoginActivity : AppCompatActivity() {
} else {
PostResult.isLoginOK = false
if (PostResult.result.contains("login_error#INFO failed, BAS respond timeout.")) {
ServerInfo.acid = "2"
if(ServerInfo.acid == "1"){
ServerInfo.acid = "2"
} else {
ServerInfo.acid = "1"
}
Network.Login(UserInfo.username, UserInfo.password.toCharArray())
}
else {
Expand All @@ -81,6 +84,10 @@ class LoginActivity : AppCompatActivity() {
preferences = applicationContext.getSharedPreferences("UserInfo", Context.MODE_PRIVATE)
loadUserInfo()
link_service1.setOnClickListener{
val username = input_username.getText().toString()
val password = input_password.getText().toString()
UserInfo.username = username
UserInfo.password = password
startActivity(Intent(this, WebActivity::class.java))
}
btn_login.setOnClickListener {
Expand Down Expand Up @@ -171,4 +178,5 @@ class LoginActivity : AppCompatActivity() {
override fun onBackPressed() {
moveTaskToBack(true)
}

}
4 changes: 1 addition & 3 deletions EHAUT/app/src/main/java/cn/ehaut/srun3000/LogoutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import android.os.Message
import android.util.Log
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_logout.*
import java.text.SimpleDateFormat
import java.util.*
import kotlin.concurrent.schedule


class LogoutActivity : AppCompatActivity() {
private val TAG = "LogoutActivity"
Expand Down
Loading

0 comments on commit b863024

Please sign in to comment.