Skip to content

feat(auth): hide password login when disable_password_auth is set (#438)#121

Open
louim wants to merge 1 commit into
donetick:developfrom
louim:pr/feat-438-disable-password-login
Open

feat(auth): hide password login when disable_password_auth is set (#438)#121
louim wants to merge 1 commit into
donetick:developfrom
louim:pr/feat-438-disable-password-login

Conversation

@louim

@louim louim commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

When the backend reports disable_password_auth, the login screen hides all username/password UI and shows only the SSO provider button(s). This is the client side of the SSO-only mode from #438.

Part of #438. Needs the backend companion: donetick/donetick#699.

Changes

src/views/Authorization/LoginView.jsx:

  • Reads disable_password_auth (and isLoading) from the useResource() hook.
  • Gates the password field, the Login button, the "Forgot password?" link, and the Sign-up button behind !resourceLoading && !resource?.disable_password_auth.
  • Leaves the SSO/OAuth provider buttons visible, so an SSO-only instance shows a single login path.
  • Uses the resourceLoading guard so the password form doesn't flash before the config resolves.

Most of the diff is re-indentation from wrapping the existing blocks in the new conditional. The behavior change is small.

Notes

This is a UX hint only. The backend rejects password auth with a 403 on its own (see the companion PR), so the protection holds even if a client ignores the flag.

On an SSO-only instance this hides password login for all users, including managed sub-accounts, since the flag is there to route every identity through the external IdP.

Screenshots

localhost_5173_login localhost_5173_login (1)

When the backend resource endpoint reports disable_password_auth, the login
view hides the username/password form, the 'or' divider and the 'Create new
account' button, leaving only the configured SSO button — so SSO-only
instances present a clean login.

Auth options render only once the resource query has settled, so the password
form never flashes before being hidden (no FOUC) on SSO-only instances.

Also drops a dead setUserProfile(user) call in the post-auth effect (the
symbol was removed earlier, leaving a no-undef that broke lint on this file);
the profile now comes from useUserProfile().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant