14b3031e63
Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/85d2244d-170a-48d3-8f6b-b4c124a49ed9
126 lines
6.1 KiB
HTML
126 lines
6.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>DocuElevate - Forgot Username</title>
|
|
<link rel="stylesheet" href="/static/styles.css" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
|
|
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
|
|
crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
|
</head>
|
|
<body class="bg-gray-100 min-h-screen flex items-center justify-center py-8">
|
|
<main class="bg-white rounded-lg shadow-lg p-8 max-w-md w-full" role="main">
|
|
<div class="flex justify-center mb-6">
|
|
<img src="/static/images/logo_writing.svg" alt="DocuElevate Logo" class="h-16">
|
|
</div>
|
|
|
|
<h1 class="text-2xl font-bold text-center text-gray-800 mb-2">Forgot your username?</h1>
|
|
<p class="text-center text-gray-500 text-sm mb-6">
|
|
Enter the email address associated with your account and we'll send you your username.
|
|
You can also sign in directly with your email address.
|
|
</p>
|
|
|
|
<div
|
|
x-data="{
|
|
email: '',
|
|
loading: false,
|
|
error: '',
|
|
success: false,
|
|
async submit() {
|
|
this.error = '';
|
|
this.loading = true;
|
|
try {
|
|
const resp = await fetch('/api/auth/forgot-username', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'X-CSRF-Token': '{{ csrf_token }}'
|
|
},
|
|
body: JSON.stringify({ email: this.email })
|
|
});
|
|
if (resp.ok) {
|
|
this.success = true;
|
|
} else {
|
|
const data = await resp.json().catch(() => ({}));
|
|
this.error = data.detail || 'Something went wrong. Please try again.';
|
|
}
|
|
} catch(e) {
|
|
this.error = 'Network error. Please try again.';
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
}
|
|
}"
|
|
>
|
|
<div x-show="success" x-cloak class="text-center py-4">
|
|
<div class="flex justify-center mb-4">
|
|
<div class="bg-green-100 rounded-full p-4">
|
|
<i class="fas fa-envelope-open-text text-green-600 text-4xl" aria-hidden="true"></i>
|
|
</div>
|
|
</div>
|
|
<p class="text-green-700 font-semibold mb-2">Check your inbox</p>
|
|
<p class="text-gray-500 text-sm mb-4">
|
|
If an account exists for that email address, your username has been sent.
|
|
Remember: you can also sign in using your email address directly.
|
|
</p>
|
|
<a href="/login"
|
|
class="inline-block py-2 px-6 rounded-md bg-indigo-600 text-white text-sm font-medium hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
|
|
style="min-height:44px;display:flex;align-items:center;justify-content:center;"
|
|
>Back to sign in</a>
|
|
</div>
|
|
|
|
<form x-show="!success" @submit.prevent="submit" class="space-y-4" novalidate>
|
|
<div x-show="error" x-cloak
|
|
class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 rounded"
|
|
role="alert" aria-live="polite">
|
|
<p x-text="error"></p>
|
|
</div>
|
|
|
|
<div class="bg-blue-50 border border-blue-200 rounded-md p-3 text-sm text-blue-700">
|
|
<i class="fas fa-info-circle mr-1" aria-hidden="true"></i>
|
|
<strong>Tip:</strong> You can sign in with either your username <em>or</em> your email address — no lookup needed.
|
|
</div>
|
|
|
|
<div>
|
|
<label for="email" class="block text-sm font-medium text-gray-700">
|
|
Email address <span aria-hidden="true" class="text-red-500">*</span>
|
|
</label>
|
|
<input
|
|
type="email" id="email" name="email" required
|
|
x-model="email"
|
|
autocomplete="email"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring focus:ring-indigo-500 focus:ring-opacity-50"
|
|
style="min-height:44px;"
|
|
aria-required="true"
|
|
placeholder="you@example.com"
|
|
>
|
|
</div>
|
|
|
|
<button
|
|
type="submit"
|
|
:disabled="loading"
|
|
class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 disabled:opacity-50"
|
|
style="min-height:44px;"
|
|
>
|
|
<span x-show="!loading">Send username reminder</span>
|
|
<span x-show="loading" x-cloak>
|
|
<i class="fas fa-spinner fa-spin mr-2" aria-hidden="true"></i>Sending…
|
|
</span>
|
|
</button>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="mt-6 text-center">
|
|
<a href="/login" class="text-sm font-medium text-blue-600 hover:text-blue-500">
|
|
<i class="fas fa-arrow-left mr-1" aria-hidden="true"></i> Back to sign in
|
|
</a>
|
|
</div>
|
|
</main>
|
|
<div class="fixed bottom-4 text-center w-full text-xs text-gray-500">
|
|
DocuElevate {{ app_version|default('', true) }}
|
|
</div>
|
|
</body>
|
|
</html>
|