diff --git a/frontend/src/pages/Login.spec.js b/frontend/src/pages/Login.spec.js index c31b4d77d..5b7ccfefe 100644 --- a/frontend/src/pages/Login.spec.js +++ b/frontend/src/pages/Login.spec.js @@ -211,7 +211,7 @@ describe('Login', () => { await wrapper.find('input[placeholder="form.password"]').setValue('1234') await flushPromises() apolloQueryMock.mockRejectedValue({ - message: '..No user with this credentials', + message: '...No user with this credentials', }) await wrapper.find('form').trigger('submit') await flushPromises() @@ -222,7 +222,9 @@ describe('Login', () => { }) it('toasts an error message', () => { - expect(toastErrorSpy).toBeCalledWith('error.no-account') + expect(toastErrorSpy).toBeCalledWith( + 'error.unknown-error...No user with this credentials', + ) }) describe('login fails with "User email not validated"', () => { diff --git a/frontend/src/pages/Login.vue b/frontend/src/pages/Login.vue index c4f324f1f..935ed9eed 100755 --- a/frontend/src/pages/Login.vue +++ b/frontend/src/pages/Login.vue @@ -60,18 +60,10 @@ - @@ -101,6 +93,8 @@ export default { passwordVisible: false, showPageMessage: false, errorReason: null, + errorSubtitle: '', + errorLinkTo: '', CONFIG, } }, @@ -132,13 +126,23 @@ export default { } }) .catch((error) => { - this.toastError(this.$t('error.no-account')) if (error.message.includes('User email not validated')) { + this.toastError(this.$t('error.no-account')) this.showPageMessage = true - this.errorReason = 'email-unvalidated' + this.errorSubtitle = this.$t('site.thx.activateEmail') + this.errorLinkTo = '/forgot-password' } else if (error.message.includes('User has no password set yet')) { + this.toastError(this.$t('error.no-account')) this.showPageMessage = true - this.errorReason = 'password-unset' + this.errorSubtitle = this.$t('site.thx.unsetPassword') + this.errorLinkTo = '/reset-password/login' + } else { + // appeared errors: 'GraphQL error: No user with this credentials' + const errorMessage = this.$t('error.unknown-error') + error.message + this.toastError(errorMessage) + this.showPageMessage = true + this.errorSubtitle = errorMessage + this.errorLinkTo = '/forgot-password' } loader.hide() })