Show wrong password message (#213)

Show wrong password message
This commit is contained in:
Ilya Y 2023-09-09 15:05:26 +03:00 committed by GitHub
parent 9c7f6249a4
commit 5eb0856260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -109,19 +109,16 @@ export const LoginForm = () => {
if (error instanceof ApiError) {
if (error.code === 'email_not_confirmed') {
setSubmitError(t('Please, confirm email'))
setIsEmailNotConfirmed(true)
return
}
if (error.code === 'user_not_found') {
setSubmitError(t('Something went wrong, check email and password'))
return
}
}
setSubmitError(error.message)
} finally {
setIsSubmitting(false)
@ -197,15 +194,15 @@ export const LoginForm = () => {
</button>
</div>
<div class={styles.authActions}>
<a
href="#"
<span
class={'link'}
onClick={(ev) => {
ev.preventDefault()
changeSearchParam('mode', 'forgot-password')
}}
>
{t('Forgot password?')}
</a>
</span>
</div>
</div>

View File

@ -192,14 +192,16 @@ h5 {
a,
a:hover,
a:visited,
a:link {
a:link,
.link {
border-bottom: 1px solid rgb(0 0 0 / 30%);
text-decoration: none;
cursor: pointer;
}
a:visited,
a:link {
a:link,
.link {
color: var(--link-color);
padding-bottom: 0.1em;
transition: color 0.2s, background-color 0.2s;

View File

@ -77,7 +77,10 @@ export const apiClient = {
const response = await publicGraphQLClient.query(authLoginQuery, { email, password }).toPromise()
// console.debug('[api-client] authLogin', { response })
if (response.error) {
if (response.error.message === '[GraphQL] User not found') {
if (
response.error.message === '[GraphQL] User not found' ||
response.error.message === "[GraphQL] 'dict' object has no attribute 'id'"
) {
throw new ApiError('user_not_found')
}