diff --git a/frontend/src/component/user/Profile/PasswordTab/PasswordTab.tsx b/frontend/src/component/user/Profile/PasswordTab/PasswordTab.tsx index 76ddcc0dd7..3725f92544 100644 --- a/frontend/src/component/user/Profile/PasswordTab/PasswordTab.tsx +++ b/frontend/src/component/user/Profile/PasswordTab/PasswordTab.tsx @@ -1,4 +1,5 @@ -import { Button, styled } from '@mui/material'; +import { Alert, Button, styled } from '@mui/material'; +import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { PageContent } from 'component/common/PageContent/PageContent'; import PasswordField from 'component/common/PasswordField/PasswordField'; import PasswordChecker, { @@ -6,6 +7,7 @@ import PasswordChecker, { } from 'component/user/common/ResetPasswordForm/PasswordChecker'; import PasswordMatcher from 'component/user/common/ResetPasswordForm/PasswordMatcher'; import { usePasswordApi } from 'hooks/api/actions/usePasswordApi/usePasswordApi'; +import useAuthSettings from 'hooks/api/getters/useAuthSettings/useAuthSettings'; import useToast from 'hooks/useToast'; import { SyntheticEvent, useState } from 'react'; import { formatUnknownError } from 'utils/formatUnknownError'; @@ -18,6 +20,9 @@ const StyledForm = styled('form')(({ theme }) => ({ })); export const PasswordTab = () => { + const { config: simpleAuthConfig, loading: authSettingsLoading } = + useAuthSettings('simple'); + const [loading, setLoading] = useState(false); const { setToastData, setToastApiError } = useToast(); const [validPassword, setValidPassword] = useState(false); @@ -55,51 +60,64 @@ export const PasswordTab = () => { setLoading(false); }; + if (authSettingsLoading) return null; + return ( - - - ) => - setPassword(e.target.value) - } - /> - ) => - setConfirmPassword(e.target.value) - } - /> - - - + + Password based login is currently disabled for your + Unleash instance. + + } + elseShow={ + + + + ) => setPassword(e.target.value)} + /> + + ) => setConfirmPassword(e.target.value)} + /> + + + + } + /> ); };