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