81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Login - Kitchen Agent</title>
|
|
<link rel="stylesheet" href="/public/css/style.css">
|
|
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
|
|
</head>
|
|
<body class="login-page">
|
|
<div class="login-container">
|
|
<div class="login-card">
|
|
<h1>Kitchen Agent</h1>
|
|
<h2>Login</h2>
|
|
|
|
<% if (error) { %>
|
|
<div class="alert alert-error">
|
|
<%= error %>
|
|
</div>
|
|
<% } %>
|
|
|
|
<form action="/auth/login" method="POST" id="loginForm">
|
|
<div class="form-group">
|
|
<label for="login">Email</label>
|
|
<input type="email" id="login" name="login" required autofocus>
|
|
</div>
|
|
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" required>
|
|
</div>
|
|
|
|
<button type="submit" class="btn btn-primary btn-block" id="submitBtn">
|
|
Login
|
|
</button>
|
|
|
|
<!-- Invisible reCAPTCHA -->
|
|
<div class="g-recaptcha"
|
|
data-sitekey="<%= recaptchaSiteKey %>"
|
|
data-callback="onRecaptchaSuccess"
|
|
data-size="invisible">
|
|
</div>
|
|
</form>
|
|
|
|
<div class="login-footer">
|
|
<p>ThinkLink Kitchen Agent System</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const form = document.getElementById('loginForm');
|
|
const submitBtn = document.getElementById('submitBtn');
|
|
|
|
form.addEventListener('submit', function(e) {
|
|
e.preventDefault();
|
|
submitBtn.disabled = true;
|
|
submitBtn.textContent = 'Logging in...';
|
|
|
|
// Execute reCAPTCHA
|
|
grecaptcha.execute();
|
|
});
|
|
|
|
function onRecaptchaSuccess(token) {
|
|
// reCAPTCHA token obtained, submit form
|
|
form.submit();
|
|
}
|
|
|
|
// Reset button if reCAPTCHA fails
|
|
window.addEventListener('load', function() {
|
|
if (window.grecaptcha) {
|
|
grecaptcha.ready(function() {
|
|
console.log('reCAPTCHA ready');
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|