fix(auth): give Remember me a checkbox and stop it erasing the saved email - #1720
Open
MOHITKOURAV01 wants to merge 1 commit into
Open
fix(auth): give Remember me a checkbox and stop it erasing the saved email#1720MOHITKOURAV01 wants to merge 1 commit into
MOHITKOURAV01 wants to merge 1 commit into
Conversation
…email
auth.js carries a complete Remember me implementation - saveRememberMe,
clearRememberMe, loadRememberMe, an element handle and a branch in the login
success path - against a #remember-me checkbox that existed in no markup.
The result was worse than a missing feature. With elements.rememberMe
permanently null, this branch took the else arm on every successful login:
if (elements.rememberMe && elements.rememberMe.checked) {
saveRememberMe(email);
} else {
clearRememberMe();
}
so rememberedEmail was erased each time and the prefill in loadRememberMe()
could never find anything to read back. saveRememberMe() was called from
nowhere in the codebase.
Adds the checkbox to signin.html, sharing a row with the forgot-password link
that previously sat alone, with a wrapping label so the whole control is one
hit target.
The decision moves into applyRememberMePreference(), which returns early when
the control is absent. An absent control expresses no preference; only an
unchecked one means forget me. Treating the two as the same is what made the
feature self-defeating.
Closes AnthropicBots#1715
🔍 Quality Gate Report✅ All quality gates passed!
|
🤖 AI Code Review🔴 Score: 50/100 | AI review unavailable at this time. Automated AI review — a human maintainer will also review. |
|
@MOHITKOURAV01 is attempting to deploy a commit to the Bhuvansh's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
💡 Suggested reviewers based on relevant file history: @Aditya8369, @Pcmhacker-hero |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Closes #1715
frontend/scripts/auth.jscarries a complete "Remember me" implementation —saveRememberMe(),clearRememberMe(),loadRememberMe(), an element handle, and a branch in the login success path. The checkbox it all depends on,#remember-me, existed in no markup.The result is worse than a missing feature. With
elements.rememberMepermanentlynull, this branch takes the else arm on every successful login:So
rememberedEmailwas erased on each sign-in, and the prefill inloadRememberMe()could never find anything to read back.saveRememberMe()was called from nowhere in the codebase — the feature looked implemented in review while doing nothing at runtime.What changed
frontend/signin.html— adds the checkbox, sharing a row with the "Forgot Password?" link that previously sat alone in a right-aligned block. A wrapping<label for="remember-me">makes the label text part of the hit target.frontend/styles/auth.css— a.signin-optionsflex row and.remember-mecontrol styling, including a dark-theme colour. The row keeps the link's existing right alignment and pushes the checkbox to the left, rather than restyling the link.frontend/scripts/auth.js— the decision moves intoapplyRememberMePreference(email), which returns early when the control is absent:Deliberate choices
Tests
New
backend/tests/rememberMe.test.js, 19 cases: the checkbox's presence, type and label, its placement inside the sign-in form (asserting it appears exactly once, so it cannot have landed in one of the three password-reset forms on the same page), the options-row layout and dark-mode styling, the early-return guard, and the full round trip — store on opt-in, prefill on return, checkbox reflecting stored state. One test pins that the old unconditional-clear shape does not come back.Verified the guard is meaningful: with the frontend changes reverted and only the test applied, 13 of the 19 fail. With the fix in place all 19 pass.
check-a11y-landmarks(31 page(s)) andcheck-assets(594 local reference(s) resolve) both pass.Scope
One form row, one stylesheet block, one extracted function, one new test file. No backend, route or schema changes.
CI note
Syntax check is red on this branch, and on every open PR in the repo right now. The single failure is inherited from
main:No file this PR touches is implicated —
shop.jsis untouched here. It is tracked as #1696 with a fix open in #1701. Because Syntax check gates the rest of the workflow, Backend tests and Server boots reportskippingrather than running; both suites pass locally on this branch.The red Vercel check is the repo-wide
Authorization required to deploy(teambhuvanshs-projects) and is unrelated to this change.