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 + + + )}