Revert "feat(auth): hide password login when disable_password_auth is set (#4…" (#189)
This reverts commit a05f8dc4a4.
This commit is contained in:
@@ -105,7 +105,7 @@ const LoginView = () => {
|
||||
setChildName('')
|
||||
setPassword('')
|
||||
}
|
||||
const { data: resource, isLoading: resourceLoading } = useResource()
|
||||
const { data: resource } = useResource()
|
||||
const { showError } = useNotification()
|
||||
const { isAuthenticated, login: authLogin, user } = useAuth()
|
||||
const Navigate = useNavigate()
|
||||
@@ -411,10 +411,6 @@ 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 (
|
||||
<AuthShell
|
||||
@@ -481,7 +477,7 @@ const LoginView = () => {
|
||||
Use a different account
|
||||
</Button>
|
||||
</Box>
|
||||
) : showPasswordAuth ? (
|
||||
) : (
|
||||
<Box
|
||||
component='form'
|
||||
onSubmit={handleSubmit}
|
||||
@@ -558,12 +554,10 @@ const LoginView = () => {
|
||||
{loginType === 'sub' ? 'Sign in as sub account' : 'Sign in'}
|
||||
</AuthSubmitButton>
|
||||
</Box>
|
||||
) : null}
|
||||
|
||||
{hasSocialOptions && (userProfile || showPasswordAuth) && (
|
||||
<AuthDivider>or continue with</AuthDivider>
|
||||
)}
|
||||
|
||||
{hasSocialOptions && <AuthDivider>or continue with</AuthDivider>}
|
||||
|
||||
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 1.5 }}>
|
||||
{showSocialLogin && !Capacitor.isNativePlatform() && (
|
||||
<LoginSocialGoogle
|
||||
@@ -650,26 +644,24 @@ const LoginView = () => {
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{!userProfile &&
|
||||
showPasswordAuth &&
|
||||
!resource?.is_user_creation_disabled && (
|
||||
<Typography
|
||||
{!userProfile && !resource?.is_user_creation_disabled && (
|
||||
<Typography
|
||||
level='body-sm'
|
||||
sx={{ mt: 3, textAlign: 'center', color: 'text.secondary' }}
|
||||
>
|
||||
Don't have an account?{' '}
|
||||
<Link
|
||||
component='button'
|
||||
type='button'
|
||||
level='body-sm'
|
||||
sx={{ mt: 3, textAlign: 'center', color: 'text.secondary' }}
|
||||
fontWeight={600}
|
||||
underline='hover'
|
||||
onClick={() => Navigate('/signup')}
|
||||
>
|
||||
Don't have an account?{' '}
|
||||
<Link
|
||||
component='button'
|
||||
type='button'
|
||||
level='body-sm'
|
||||
fontWeight={600}
|
||||
underline='hover'
|
||||
onClick={() => Navigate('/signup')}
|
||||
>
|
||||
Create one
|
||||
</Link>
|
||||
</Typography>
|
||||
)}
|
||||
Create one
|
||||
</Link>
|
||||
</Typography>
|
||||
)}
|
||||
|
||||
<MFAVerificationModal
|
||||
open={mfaModalOpen}
|
||||
|
||||
Reference in New Issue
Block a user