This repository was archived by the owner on Feb 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.php
More file actions
60 lines (50 loc) · 1.8 KB
/
token.php
File metadata and controls
60 lines (50 loc) · 1.8 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
include("config.php");
$token = $_GET["token"];
if (empty($token)){
header('Location: /auth', true, 303);
print '<meta http-equiv="Location" content="/auth">';
print '<script> window.location = "/auth"; </script>';
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="description" content=""/>
<meta name="author" content=""/>
<link rel="icon" href="/favicon.ico"/>
<title><?= $_CONFIG["PAGE_TITLE"] ?></title>
</head>
<body>
<script src="/third-party/jquery/jquery.min.js"></script>
<script src="/third-party/alertify/alertify.js"></script>
<script src="/include/haxdb.api.js"></script>
<script src="/include/haxdb.js"></script>
<script>
check_token = function (data){
if (data && data.success && data.success==1 && data.value){
if (data.meta && data.meta.people_name){
localStorage.setItem("identity", data.meta.people_name);
}else{
localStorage.setItem("identity", "unknown");
}
localStorage.setItem("api_key", data.value);
document.location = '/';
}else{
if (data && data.message){
document.location = "/auth?error=" + escape(data.message);
}else{
document.location = "/auth?error=" + escape("Unknown Error");
}
}
}
var API_URL = "<?= $_CONFIG["API_URL"] ?>";
var call = "AUTH/token/" + "<?= urlencode($token) ?>";
api(call,{},check_token);
</script>
</body>
</html>