forked from mrroach9/Rowell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_accounts9.html
40 lines (40 loc) · 1.24 KB
/
login_accounts9.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
</head>
<body>
<div id="information"></div>
<script src='./js/jquery/jquery.min.js'></script>
<script src='./js/jquery/jquery.cookie.js'></script>
<script src='./js/bbs/config.js'></script>
<script src='./js/bbs/common.js'></script>
<script src='./js/bbs/bbs_login.js'></script>
<script src='./js/bbs/accounts9.js'></script>
<script type='text/javascript'>
$(function(){
var query = getQueryString();
if (query.code) {
Accounts9.getAccessToken(query.code, function (err, accessToken) {
if (err) return displayError(err);
$.cookie(accounts9_session_cookie, accessToken, {expires: 14});
Accounts9.getBBSUser(accessToken, function (err, bbsUser) {
if (err) return displayError(err);
if (!bbsUser) {
location.href = accounts9.server + accounts9.connect;
}
setSessionCookie(bbsUser.accessToken, true);
location.href = website_address;
});
});
}
if (query.error) {
displayError(query.error);
}
});
function displayError(err) {
$('#information').html('<h1>登录失败,请返回重试。</h1><p>' + err + '</p>');
}
</script>
</body>
</html>