B: Fix password reset
Some checks are pending
Frontend CI / build (22.x) (push) Waiting to run
Frontend CI / notify-failure (push) Blocked by required conditions

Multiple triggers for token validation
This commit is contained in:
Ivan 2025-06-10 22:46:03 +03:00
parent e65fe97019
commit e39a0c2f83
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