index.ejs
3.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://apis.google.com/js/platform.js" async defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cafe Map</title>
<meta name="google-signin-client_id" content=<%=client_id%>>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" integrity="undefined" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@700&display=swap" rel="stylesheet">
<style>
img {
max-width: 100%;
height: 100% !important;
}
h1 {
font-family: "Noto Sans KR", sans-serif;
}
h4 {
font-family: "Noto Sans KR", sans-serif;
}
h2 {
font-family: "Noto Sans KR", sans-serif;
}
h3 {
font-family: "Noto Sans KR", sans-serif;
}
h5 {
font-family: "Noto Sans KR", sans-serif;
}
.center {
background-color: #848484;
margin-right: 20%;
margin-left: 20%;
margin-top: 5%;
text-align: center;
}
.g-signin2 {
width: 100%;
}
.g-signin2 > div {
margin: 0 auto;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<a class="navbar-brand" href="/" style="margin-left: 10px"><strong>Home</strong></a>
</div>
</nav>
<br /><br />
<div class="center">
<br />
<h5 class="display-5 font-weight-bold" style="color: white">
Cafe Recommend
</h5>
<br /><br />
<div
class="g-signin2"
data-onsuccess="onSignIn"
-theme="light"
data-width="300"
data-height="50"
data-longtitle="true"
>
button
</div>
<br /><br />
</div>
</head>
</body>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js"
integrity="undefined"
crossorigin="anonymous"
></script>
<script>
function onSignIn(googleUser) {
var id_token = googleUser.getAuthResponse().id_token;
var xhr = new XMLHttpRequest();
xhr.open("POST", "/index");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onload = function () {
console.log("Signed in as: " + xhr.responseText);
if (xhr.responseText == "success") {
signOut();
location.assign("/login");
}
};
xhr.send(JSON.stringify({ token: id_token }));
}
function signOut() {
var auth2 = gapi.auth2.getAuthInstance();
auth2.signOut().then(function () {
console.log("User signed out.");
});
}
</script>
</html>