31 lines
937 B
HTML
31 lines
937 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>yDropbox Login</title>
|
|
<link rel="stylesheet" href="/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>yDropbox</h1>
|
|
<form id="loginForm">
|
|
<input type="password" id="token" placeholder="Access Token" required>
|
|
<button type="submit">Login</button>
|
|
</form>
|
|
</div>
|
|
<script>
|
|
document.getElementById('loginForm').addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
const token = document.getElementById('token').value;
|
|
const res = await fetch('/api/login', {
|
|
method: 'POST',
|
|
headers: {'Content-Type': 'application/json'},
|
|
body: JSON.stringify({token})
|
|
});
|
|
if (res.ok) window.location.href = '/';
|
|
else alert('Invalid token');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|