From 9aee85d55ee2bcf8ef68068a7e568a9dc7fb922d Mon Sep 17 00:00:00 2001 From: James Brunton Date: Mon, 22 Jun 2026 14:59:28 +0100 Subject: [PATCH] Wrap first login popup in a form so enter works to change password (#6769) # Description of Changes > [!note] > GitHub absolutely mangles the diff unless you change to ignore whitespace changes This page has never had the Enter key bound to the Change Password button: image This PR changes the modal to be properly wrapped in a form so key commands work correctly on it. --- .../onboarding/slides/FirstLoginSlide.tsx | 172 +++++++++--------- .../components/shared/FirstLoginModal.tsx | 152 ++++++++-------- 2 files changed, 167 insertions(+), 157 deletions(-) diff --git a/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx b/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx index 4898c5a825..6f0e0e587c 100644 --- a/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx +++ b/frontend/editor/src/core/components/onboarding/slides/FirstLoginSlide.tsx @@ -31,7 +31,9 @@ function FirstLoginForm({ const [loading, setLoading] = useState(false); const [error, setError] = useState(""); - const handleSubmit = async () => { + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + // Validation if ( (!usingDefaultCredentials && !currentPassword) || @@ -115,102 +117,104 @@ function FirstLoginForm({ return (
- -
- - - {t( - "firstLogin.welcomeMessage", - "For security reasons, you must change your password on your first login.", - )} - -
+
+ +
+ + + {t( + "firstLogin.welcomeMessage", + "For security reasons, you must change your password on your first login.", + )} + +
- - {t("firstLogin.loggedInAs", "Logged in as")}:{" "} - {username} - + + {t("firstLogin.loggedInAs", "Logged in as")}:{" "} + {username} + - {error && ( - - } - color="red" - variant="light" - > - {error} - - )} + {error && ( + + } + color="red" + variant="light" + > + {error} + + )} + + {/* Only show current password field if not using default credentials */} + {!usingDefaultCredentials && ( + setCurrentPassword(e.currentTarget.value)} + required + styles={{ + input: { height: 44 }, + }} + /> + )} - {/* Only show current password field if not using default credentials */} - {!usingDefaultCredentials && ( setCurrentPassword(e.currentTarget.value)} + value={newPassword} + onChange={(e) => setNewPassword(e.currentTarget.value)} + minLength={8} required styles={{ input: { height: 44 }, }} /> - )} - setNewPassword(e.currentTarget.value)} - minLength={8} - required - styles={{ - input: { height: 44 }, - }} - /> + setConfirmPassword(e.currentTarget.value)} + required + minLength={8} + styles={{ + input: { height: 44 }, + }} + /> - setConfirmPassword(e.currentTarget.value)} - required - minLength={8} - styles={{ - input: { height: 44 }, - }} - /> - - -
+ + +
); diff --git a/frontend/editor/src/core/components/shared/FirstLoginModal.tsx b/frontend/editor/src/core/components/shared/FirstLoginModal.tsx index 00dc4594b5..4d7764f91d 100644 --- a/frontend/editor/src/core/components/shared/FirstLoginModal.tsx +++ b/frontend/editor/src/core/components/shared/FirstLoginModal.tsx @@ -37,7 +37,9 @@ export default function FirstLoginModal({ const [loading, setLoading] = useState(false); const [error, setError] = useState(""); - const handleSubmit = async () => { + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + // Validation if (!currentPassword || !newPassword || !confirmPassword) { setError(t("firstLogin.allFieldsRequired", "All fields are required")); @@ -125,86 +127,90 @@ export default function FirstLoginModal({ size="md" zIndex={Z_INDEX_OVER_FULLSCREEN_SURFACE} > - - } - title={t("firstLogin.welcomeTitle", "Welcome!")} - color="blue" - > - - {t( - "firstLogin.welcomeMessage", - "For security reasons, you must change your password on your first login.", - )} - - - - - {t("firstLogin.loggedInAs", "Logged in as")}:{" "} - {username} - - - {error && ( +
+ } - title={t("firstLogin.error", "Error")} - color="red" + icon={} + title={t("firstLogin.welcomeTitle", "Welcome!")} + color="blue" > - {error} + + {t( + "firstLogin.welcomeMessage", + "For security reasons, you must change your password on your first login.", + )} + - )} - + {t("firstLogin.loggedInAs", "Logged in as")}:{" "} + {username} + + + {error && ( + + } + title={t("firstLogin.error", "Error")} + color="red" + > + {error} + )} - value={currentPassword} - onChange={(e) => setCurrentPassword(e.currentTarget.value)} - required - /> - setNewPassword(e.currentTarget.value)} - minLength={8} - required - /> + setCurrentPassword(e.currentTarget.value)} + required + /> - setConfirmPassword(e.currentTarget.value)} - minLength={8} - required - /> + setNewPassword(e.currentTarget.value)} + minLength={8} + required + /> - - + setConfirmPassword(e.currentTarget.value)} + minLength={8} + required + /> + + + + ); }