From a05f8dc4a4e337470ebc24e89da586f374cead63 Mon Sep 17 00:00:00 2001 From: Louis-Michel Couture Date: Mon, 3 Aug 2026 00:36:05 -0400 Subject: [PATCH] feat(auth): hide password login when disable_password_auth is set (#438) (#121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank yWhen 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) --- src/views/Authorization/LoginView.jsx | 48 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/views/Authorization/LoginView.jsx b/src/views/Authorization/LoginView.jsx index 1b0959d..a754f88 100644 --- a/src/views/Authorization/LoginView.jsx +++ b/src/views/Authorization/LoginView.jsx @@ -105,7 +105,7 @@ const LoginView = () => { setChildName('') setPassword('') } - const { data: resource } = useResource() + const { data: resource, isLoading: resourceLoading } = useResource() const { showError } = useNotification() const { isAuthenticated, login: authLogin, user } = useAuth() const Navigate = useNavigate() @@ -411,6 +411,10 @@ const LoginView = () => { const showSocialLogin = import.meta.env.VITE_IS_SELF_HOSTED !== 'true' const hasSocialOptions = showSocialLogin || Boolean(resource?.identity_provider?.client_id) + // On SSO-only instances the password form, its divider and the signup link + // are hidden. Wait for the resource query to settle first so the form never + // flashes before being hidden. + const showPasswordAuth = !resourceLoading && !resource?.disable_password_auth return ( { Use a different account - ) : ( + ) : showPasswordAuth ? ( { {loginType === 'sub' ? 'Sign in as sub account' : 'Sign in'} - )} + ) : null} - {hasSocialOptions && or continue with} + {hasSocialOptions && (userProfile || showPasswordAuth) && ( + or continue with + )} {showSocialLogin && !Capacitor.isNativePlatform() && ( @@ -644,24 +650,26 @@ const LoginView = () => { )} - {!userProfile && !resource?.is_user_creation_disabled && ( - - Don't have an account?{' '} - Navigate('/signup')} + sx={{ mt: 3, textAlign: 'center', color: 'text.secondary' }} > - Create one - - - )} + Don't have an account?{' '} + Navigate('/signup')} + > + Create one + + + )}