Repository navigation
fix(oauth): clarify 2FA screen and add show-password toggle - #62
Conversation
Users were getting stuck on the enable_access two-step-verification screen: the copy under-emphasised that the field wants the Telegram cloud password, so people re-entered the 5-digit login code and saw "invalid password" with no way to check what they typed. - Bold "Telegram cloud password" and spell out that it is NOT the 5-digit login code from the previous screen. - Add a show/hide-password eye toggle. A real toggle needs JavaScript, so the password screen now emits one inline <script> authorized by a fresh per-request CSP nonce (script-src 'nonce-<random>'). The other enable_access screens keep the strict no-script CSP unchanged.
|
@codex review |
|
Claude finished @mashkovd's task in 1m 30s —— View job Review
P3 (2) · P2 (0) · P1 (0) — No P1/P2 findings, good to merge. The CSP nonce approach is implemented correctly: Findings:
|
| rec := httptest.NewRecorder() | ||
| renderEnablePhone(rec, enablePhonePage{}) | ||
| if csp := rec.Header().Get("Content-Security-Policy"); strings.Contains(csp, "script-src") { | ||
| t.Fatalf("phone screen must forbid scripts entirely, got CSP: %q", csp) |
There was a problem hiding this comment.
P3 — Only the phone screen is exercised here; the code and error screens have the same invariant but are untested. Consider ranging over all three:
| t.Fatalf("phone screen must forbid scripts entirely, got CSP: %q", csp) | |
| func TestRenderEnable_NonPasswordScreensHaveNoScriptSrc(t *testing.T) { | |
| cases := []struct { | |
| name string | |
| fn func(http.ResponseWriter) | |
| }{ | |
| {"phone", func(w http.ResponseWriter) { renderEnablePhone(w, enablePhonePage{}) }}, | |
| {"code", func(w http.ResponseWriter) { renderEnableCode(w, enableCodePage{}) }}, | |
| {"error", func(w http.ResponseWriter) { renderEnableError(w, "oops") }}, | |
| } | |
| for _, tc := range cases { | |
| rec := httptest.NewRecorder() | |
| tc.fn(rec) | |
| if csp := rec.Header().Get("Content-Security-Policy"); strings.Contains(csp, "script-src") { | |
| t.Errorf("%s screen must forbid scripts entirely, got CSP: %q", tc.name, csp) | |
| } | |
| } | |
| } |
|
Codex Review: Didn't find any major issues. Nice work! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Why
A new client got stuck on the
enable_accesstwo-step-verification screen. The copy under-emphasised that the field wants the Telegram cloud password, so users re-enter the 5-digit login code, getinvalid password, and have no way to see what they typed.Changes
<input>betweentype=password/type=text— so the password screen now emits a single inline<script>authorized by a fresh per-request CSP nonce (script-src 'nonce-<random>'). External and injected scripts stay blocked; the otherenable_accessscreens keep the strict no-script CSP unchanged.Tests
internal/oauth/enable_access_page_test.go:<script>nonce echoes the CSP header nonce; nounsafe-inline.go build/go vet/go test ./...all green.