2025-12-28 22:09:45 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en">
|
|
|
|
|
<head>
|
2025-12-28 22:15:16 -08:00
|
|
|
<script>document.documentElement.className = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'wa-dark' : 'wa-light';</script>
|
2025-12-28 22:09:45 -08:00
|
|
|
<meta charset="UTF-8">
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
2025-12-28 22:39:06 -08:00
|
|
|
<title>HCA Tickets</title>
|
2025-12-28 22:09:45 -08:00
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/styles/themes/default.css">
|
|
|
|
|
<script type="module" src="https://cdn.jsdelivr.net/npm/@awesome.me/webawesome@3/dist-cdn/webawesome.loader.js"></script>
|
2025-12-28 22:30:50 -08:00
|
|
|
<script src="https://accounts.google.com/gsi/client" async></script>
|
2025-12-28 22:09:45 -08:00
|
|
|
<style>
|
|
|
|
|
body {
|
2025-12-29 11:41:48 -08:00
|
|
|
font-family: var(--wa-font-sans);
|
2025-12-28 22:39:06 -08:00
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
margin: 0;
|
2025-12-28 22:09:45 -08:00
|
|
|
}
|
2025-12-29 11:41:48 -08:00
|
|
|
.profile {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 1rem;
|
|
|
|
|
}
|
|
|
|
|
.profile img {
|
|
|
|
|
width: 64px;
|
|
|
|
|
height: 64px;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
}
|
|
|
|
|
#signin, #welcome { display: none; }
|
2025-12-28 22:09:45 -08:00
|
|
|
</style>
|
|
|
|
|
</head>
|
2025-12-28 22:15:16 -08:00
|
|
|
<body style="opacity: 0">
|
2025-12-29 11:41:48 -08:00
|
|
|
<div id="signin">
|
|
|
|
|
<div id="g_id_onload"
|
|
|
|
|
data-client_id="{{.env.GOOGLE_CLIENT_ID}}"
|
|
|
|
|
data-callback="handleCredentialResponse"
|
|
|
|
|
data-use_fedcm_for_button="true"
|
|
|
|
|
data-auto_prompt="false">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="g_id_signin"
|
|
|
|
|
data-type="standard"
|
|
|
|
|
data-size="large"
|
|
|
|
|
data-theme="outline"
|
|
|
|
|
data-text="sign_in_with"
|
|
|
|
|
data-shape="rectangular"
|
|
|
|
|
data-logo_alignment="left">
|
|
|
|
|
</div>
|
2025-12-28 22:39:06 -08:00
|
|
|
</div>
|
2025-12-29 11:41:48 -08:00
|
|
|
<wa-card id="welcome">
|
|
|
|
|
<div class="profile" slot="header">
|
|
|
|
|
<img id="profile-picture" src="" alt="Profile">
|
|
|
|
|
<div>
|
|
|
|
|
<div><strong id="profile-name"></strong></div>
|
|
|
|
|
<div id="profile-email"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<p>Welcome to HCA Tickets!</p>
|
|
|
|
|
<wa-button variant="neutral" onclick="logout()">Switch User</wa-button>
|
|
|
|
|
</wa-card>
|
|
|
|
|
<script>
|
|
|
|
|
function getProfile() {
|
|
|
|
|
const data = localStorage.getItem('profile');
|
|
|
|
|
return data ? JSON.parse(data) : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setProfile(profile) {
|
|
|
|
|
localStorage.setItem('profile', JSON.stringify(profile));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function logout() {
|
|
|
|
|
localStorage.removeItem('profile');
|
|
|
|
|
location.reload();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async function handleCredentialResponse(response) {
|
|
|
|
|
const res = await fetch('/auth/google/callback', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
|
|
|
|
body: 'credential=' + encodeURIComponent(response.credential)
|
|
|
|
|
});
|
|
|
|
|
const profile = await res.json();
|
|
|
|
|
setProfile(profile);
|
|
|
|
|
render();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function render() {
|
|
|
|
|
const profile = getProfile();
|
|
|
|
|
if (profile) {
|
|
|
|
|
document.getElementById('profile-picture').src = profile.picture;
|
|
|
|
|
document.getElementById('profile-name').textContent = profile.name;
|
|
|
|
|
document.getElementById('profile-email').textContent = profile.email;
|
|
|
|
|
document.getElementById('signin').style.display = 'none';
|
|
|
|
|
document.getElementById('welcome').style.display = 'block';
|
|
|
|
|
} else {
|
|
|
|
|
document.getElementById('signin').style.display = 'block';
|
|
|
|
|
document.getElementById('welcome').style.display = 'none';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
render();
|
|
|
|
|
</script>
|
2025-12-28 22:15:16 -08:00
|
|
|
<script type="module">
|
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', e => {
|
|
|
|
|
document.documentElement.className = e.matches ? 'wa-dark' : 'wa-light';
|
|
|
|
|
});
|
2025-12-29 11:41:48 -08:00
|
|
|
await customElements.whenDefined('wa-card');
|
2025-12-28 22:15:16 -08:00
|
|
|
document.body.style.opacity = 1;
|
|
|
|
|
</script>
|
2025-12-28 22:09:45 -08:00
|
|
|
</body>
|
|
|
|
|
</html>
|