mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-25 20:40:36 +03:00
B: Fix password reset
Multiple triggers for token validation
This commit is contained in:
parent
e65fe97019
commit
e39a0c2f83
|
@ -19,8 +19,8 @@ function useTokenValidation(token: string, isPending: boolean) {
|
|||
|
||||
const validate = async () => {
|
||||
if (!isTokenValidating && !isPending) {
|
||||
await validateToken({ token });
|
||||
setIsTokenValidating(true);
|
||||
await validateToken({ token });
|
||||
}
|
||||
};
|
||||
return { isTokenValidating, validate };
|
||||
|
@ -44,10 +44,7 @@ export function Component() {
|
|||
void resetPassword({
|
||||
password: newPassword,
|
||||
token: token
|
||||
}).then(() => {
|
||||
router.replace({ path: urls.home });
|
||||
router.push({ path: urls.login });
|
||||
});
|
||||
}).then(() => router.replace({ path: urls.login }));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,6 +80,9 @@ export function Component() {
|
|||
setNewPasswordRepeat(event.target.value);
|
||||
}}
|
||||
/>
|
||||
{newPasswordRepeat && newPassword !== newPasswordRepeat ? (
|
||||
<div className='text-sm text-destructive'>Пароли не совпадают</div>
|
||||
) : null}
|
||||
|
||||
<SubmitButton
|
||||
text='Установить пароль'
|
||||
|
|
|
@ -35,6 +35,7 @@ export function Component() {
|
|||
<form className='cc-column w-96 mx-auto px-6 mt-3' onSubmit={handleSubmit} onChange={clearServerError}>
|
||||
<TextInput
|
||||
id='email'
|
||||
type='email'
|
||||
autoComplete='email'
|
||||
required
|
||||
allowEnter
|
||||
|
|
Loading…
Reference in New Issue
Block a user