From d0de0c420c2ddad7a538fc431eec9c8ae016be32 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Tue, 5 Aug 2025 20:39:43 +1000 Subject: [PATCH] Add logic to prefill email if it exist --- web/login.html | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/web/login.html b/web/login.html index 7a24cf2..e6983a0 100644 --- a/web/login.html +++ b/web/login.html @@ -274,6 +274,25 @@ return redirectParam || rdParam; } + // Extract email parameter from URL + function getEmailFromUrl() { + const urlParams = new URLSearchParams(window.location.search); + const emailParam = urlParams.get('email'); + + return emailParam; + } + + // Pre-fill email input if email parameter exists + function prefillEmail() { + const email = getEmailFromUrl(); + if (email) { + const emailInput = document.getElementById('email'); + if (emailInput) { + emailInput.value = decodeURIComponent(email); + } + } + } + function redirectAfterAuth() { const redirectUrl = getRedirectUrl(); console.log('Checking for redirect URL:', redirectUrl); @@ -895,6 +914,9 @@ // Load theme first loadTheme(); + // Pre-fill email if provided in URL parameters + prefillEmail(); + // Check if there's a redirect URL and update header const redirectUrl = getRedirectUrl(); if (redirectUrl) {