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

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