B: Fix token validation issue

This commit is contained in:
Ivan 2025-06-10 22:45:52 +03:00
parent 2b7acfbd27
commit ac50a4fb05
2 changed files with 6 additions and 5 deletions

View File

@ -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='Установить пароль'

View File

@ -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