resets passwords
This commit is contained in:
@@ -31,18 +31,14 @@
|
||||
<script>
|
||||
// Initialize Firebase configuration from template
|
||||
window.FIREBASE_CONFIG = {{ firebase_config|tojson }};
|
||||
|
||||
// Initialize Firebase app and auth
|
||||
const app = firebase.initializeApp(window.FIREBASE_CONFIG || {});
|
||||
const auth = firebase.auth();
|
||||
|
||||
// Get form and input elements
|
||||
const form = document.getElementById('login-form');
|
||||
const email = document.getElementById('email');
|
||||
const password = document.getElementById('password');
|
||||
const err = document.getElementById('error');
|
||||
|
||||
// Handle form submission
|
||||
form.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
err.classList.add('hidden');
|
||||
@@ -54,10 +50,17 @@
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ idToken })
|
||||
});
|
||||
if(!res.ok){
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error('Session exchange failed');
|
||||
}
|
||||
window.location.href = '/';
|
||||
|
||||
const data = await res.json();
|
||||
if (data.requires_password_reset) {
|
||||
window.location.href = '/require-password-reset';
|
||||
} else {
|
||||
window.location.href = '/';
|
||||
}
|
||||
} catch (e) {
|
||||
err.textContent = e.message || 'Authentication failed';
|
||||
err.classList.remove('hidden');
|
||||
|
||||
Reference in New Issue
Block a user