mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-31 01:16:01 +02:00
fix: "Reset password" page works when password authentication is disabled (#2126)
fix: password reset with only sso enabled show correct error message
This commit is contained in:
parent
0e4734af38
commit
df11ad9135
@ -11,14 +11,17 @@ import StandaloneLayout from '../common/StandaloneLayout/StandaloneLayout';
|
||||
import ResetPasswordForm from '../common/ResetPasswordForm/ResetPasswordForm';
|
||||
import ResetPasswordError from '../common/ResetPasswordError/ResetPasswordError';
|
||||
import { useAuthResetPasswordApi } from 'hooks/api/actions/useAuthResetPasswordApi/useAuthResetPasswordApi';
|
||||
import { useAuthDetails } from 'hooks/api/getters/useAuth/useAuthDetails';
|
||||
|
||||
const ResetPassword = () => {
|
||||
const { classes: styles } = useStyles();
|
||||
const { token, loading, setLoading, isValidToken } = useResetPassword();
|
||||
const { token, loading, isValidToken } = useResetPassword();
|
||||
const { resetPassword, loading: actionLoading } = useAuthResetPasswordApi();
|
||||
const { authDetails } = useAuthDetails();
|
||||
const ref = useLoading(loading || actionLoading);
|
||||
const navigate = useNavigate();
|
||||
const [hasApiError, setHasApiError] = useState(false);
|
||||
const passwordDisabled = authDetails?.defaultHidden === true;
|
||||
|
||||
const onSubmit = async (password: string) => {
|
||||
try {
|
||||
@ -39,7 +42,7 @@ const ResetPassword = () => {
|
||||
<StandaloneLayout>
|
||||
<div className={styles.resetPassword}>
|
||||
<ConditionallyRender
|
||||
condition={!isValidToken}
|
||||
condition={!isValidToken || passwordDisabled}
|
||||
show={<InvalidToken />}
|
||||
elseShow={
|
||||
<>
|
||||
|
Loading…
Reference in New Issue
Block a user