Skip to content

Commit 40f7745

Browse files
committed
google support
1 parent 8e282d4 commit 40f7745

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

auth.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
</head>
1818

1919
<body>
20+
<div
21+
id="g_id_onload"
22+
data-client_id="228445846106-ttt7glup5n94jfhlj7idmsj4r0vo6bs4.apps.googleusercontent.com"
23+
data-callback="handleCredential"
24+
data-auto_prompt="false">
25+
</div>
2026
<div id="navbar-placeholder"></div>
2127
<div class="modal">
2228
<div class="modal-content">
@@ -133,6 +139,15 @@ <h1>Welcome to Rotur</h1>
133139
<i class="fas fa-sign-in-alt"></i>
134140
Sign In
135141
</button>
142+
<div
143+
class="g_id_signin"
144+
data-type="standard"
145+
data-size="large"
146+
data-text="continue_with"
147+
data-theme="outline"
148+
data-shape="rectangular"
149+
data-logo_alignment="left">
150+
</div>
136151
<button class="btn-welcome btn-welcome-secondary" id="welcome-signup-btn">
137152
<i class="fas fa-user-plus"></i>
138153
Create Account
@@ -806,6 +821,26 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</
806821
}
807822
});
808823

824+
function handleCredential(response) {
825+
fetch("https://api.rotur.dev/auth/google", {
826+
method: "POST",
827+
headers: { "Content-Type": "application/json" },
828+
body: JSON.stringify({
829+
id_token: response.credential,
830+
system: systemName || 'rotur'
831+
})
832+
})
833+
.then(response => response.json())
834+
.then(data => {
835+
if (data.error) {
836+
console.error(data.error);
837+
return;
838+
}
839+
account = data;
840+
updateModalForLoggedInUser();
841+
});
842+
}
843+
809844
async function requestAccount(username, password) {
810845
const response = await fetch(`https://api.rotur.dev/get_user?username=${username}&password=${password}`);
811846
const json = await response.json();
@@ -894,6 +929,7 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</
894929
});
895930
</script>
896931
<script src="https://kit.fontawesome.com/16f6b70bf6.js" crossorigin="anonymous"></script>
932+
<script src="https://accounts.google.com/gsi/client" async defer></script>
897933
</body>
898934

899935
</html>

0 commit comments

Comments
 (0)