Repository navigation
Make the Console's /set-password/code page follow the system's light or dark mode - #1166
Merged
Merged
Conversation
/set-password/code answered with a bare HTML fragment, so the browser showed it in its default colors whatever the system or Console Theme. It now extends the account layout, like /set-password, with the configured Theme; the default focus-auto follows the system's light or dark mode. The no-key reply uses the same page with its 503.
…Theme Address review: the no-key notice is one partial for both password pages, the code reply renders through the Console's page helper and picks its status once, and the test now configures a Theme and covers the 503 page.
Merged
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.
Summary
POST /set-password/codeused to answer with a bare HTML fragment that had no stylesheet and nodata-theme, so browsers showed it in their default light colours. It now renders on the Console's account layout, like/set-password. With the default Theme,focus-auto, the page follows the system's light or dark mode, and a pinned-light/-darkTheme still wins (ADR 0018).The answer is still the same for allowed and unknown addresses, and the handler still waits only on address-independent reads: the Resend key and the User config. One change is visible: a malformed User config now gets a 500 here, as it already did on
GET /set-password.Evidence
the_code_page_uses_the_console_theme_and_stylesheetalso failed, and its panic printed the bareIf this address is allowed, a code has been sent…fragment.After:
cd console && npm test: 61/61 passed. That run predates the new 503 assertion, which is in Rust.cargo test --test console: 65 passed.-D warningsandcargo fmt --checkare clean.scripts/affected-tests origin/mainselected the full Rust suite. Nextest isn't installed, so it fell back tocargo test. I rancargo test --no-fail-fastbefore the last test-only commit: 2377 passed and 3 failed. The three failures areworktree::synchronization_tests::*_shadowing_branch_and_tag_names, and they come from this machine's globaltag.gpgsign=true(git tag … fatal: no tag message?). With a clean global git config they pass (36/36). The selector's owncargo teststopped early onacquisition_adviceonly because I had overriddenGIT_CONFIG_GLOBAL. Under the normal config that file passes (8/8). After the last commit I rerancargo test --test consoleand the synchronization tests.Merge Danger
Door: two-way
Templates and one handler change. A revert restores the bare reply.
Blast Radius: cosmetic
Only the reply page of
POST /set-password/codechanges, plus a template partial shared with/set-passwordwhose text is unchanged. Status codes, wording and the email are the same. The one behaviour change: a broken User config now gives 500 on this route.Unaddressed findings
Standards
anonymous_page(src/console/auth.rs:220-221): not shared.anonymous_pagealso mints the sign-in cookie and form CSRF (auth.rs:226-227).codeneeds the wholeUserConfigfor delivery (src/console/auth/password.rs:90,&config.email). A shared loader would be a new type for one line.theme: String, email_enabled: booldata clump / Primitive Obsession: this predates the change. Every account template struct carriestheme: String(auth.rs:220,297,335).CodePagefollows them.CodePagerename toSentCodePage: kept. It names the/set-password/codepage, asPasswordPagenames/set-password. It also renders the email-off 503 notice, so "Sent" would be wrong. (foundwas renamedloaded.)OWNERduplicate: declined as out of scope. Make the web console's /set-password/code page follow the user's system for light / dark mode #1054 names only/set-password/code. The finding's test,a_wrong_code_reply_uses_the_console_themeonPOST /set-password, was run and fails as described (the response is the barePassword not set…fragment). Theming/set-password(password.rs:139-140) and the sign-in failures (auth.rs:265,271) is a scope call for the Day shift: Theme the Console's other sign-in and set-password replies #1167.GET /set-password, which loads the same config inanonymous_page(auth.rs:220) and returns 500 throughconsole::page. The answer still doesn't depend on the address./set-password, which has the Sign in link (src/console/set_password.html:24).console/tests/*.test.cjsstarts its own server this way.console::page(Ok(…))thenstatus_mut(): kept. It reuses the page helper's error reply. Overriding the status only afteris_success()is the idiomanonymous_pagealready uses for its cookie (auth.rs:226).failed("Can't read Console accounts"): this predates the change. Main's handler already sentResendKey::finderrors there (mainpassword.rs:87,error => failed(error)).Spec
POST /set-passwordreplies still unstyled: out of scope by the reviewer's own reading ("a different route from the one the spec names"). It is filed for triage in the same issue as Standards Continuation of an existing Issue branch #6: Theme the Console's other sign-in and set-password replies #1167.Every changed file was read by both reviewers. No changed file was left unread, and there were no generated-output exclusions.
Closes #1054
Built with claude · claude-opus-5-5 · high
Security review outcome
No unaddressed introduced findings.