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

View File

@ -192,14 +192,16 @@ h5 {
a, a,
a:hover, a:hover,
a:visited, a:visited,
a:link { a:link,
.link {
border-bottom: 1px solid rgb(0 0 0 / 30%); border-bottom: 1px solid rgb(0 0 0 / 30%);
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }
a:visited, a:visited,
a:link { a:link,
.link {
color: var(--link-color); color: var(--link-color);
padding-bottom: 0.1em; padding-bottom: 0.1em;
transition: color 0.2s, background-color 0.2s; 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() const response = await publicGraphQLClient.query(authLoginQuery, { email, password }).toPromise()
// console.debug('[api-client] authLogin', { response }) // console.debug('[api-client] authLogin', { response })
if (response.error) { 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') throw new ApiError('user_not_found')
} }