login-error-fix

This commit is contained in:
Untone 2024-05-06 17:42:18 +03:00
parent 75c7ef00f6
commit 1c02d3f29b
3 changed files with 13 additions and 2 deletions

View File

@ -97,7 +97,12 @@ export const LoginForm = () => {
const { errors } = await signIn({ email: email(), password: password() })
console.error('[signIn errors]', errors)
if (errors?.length > 0) {
if (errors.some((error) => error.message.includes('bad user credentials'))) {
if (
errors.some(
(error) =>
error.message.includes('bad user credentials') || error.message.includes('user not found'),
)
) {
setValidationErrors((prev) => ({
...prev,
password: t('Something went wrong, check email and password'),

View File

@ -61,7 +61,12 @@ export const SendResetLinkForm = () => {
redirect_uri: window.location.origin,
})
console.debug('[SendResetLinkForm] authorizer response:', data)
if (errors?.some((error) => error.message.includes('bad user credentials'))) {
if (
errors?.some(
(error) =>
error.message.includes('bad user credentials') || error.message.includes('user not found'),
)
) {
setIsUserNotFound(true)
}
if (data.message) setMessage(data.message)

View File

@ -57,6 +57,7 @@ export const HeaderAuth = (props: Props) => {
toggleEditorPanel()
}
// FIXME: use or remove
const handleSaveClick = () => {
const hasTopics = form.selectedTopics?.length > 0
if (hasTopics) {