diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 14ab9d906..7497648e1 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -18,7 +18,8 @@ "title": "Passwort zurücksetzen", "form": { "description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.", - "submit": "Email anfordern" + "submit": "Email anfordern", + "submitted": "Eine E-Mail zum Zurücksetzen wurde angefordert" } }, "editor": { @@ -201,7 +202,10 @@ "name": "Name", "loadMore": "mehr laden", "loading": "wird geladen", - "reportContent": "Melden" + "reportContent": "Melden", + "validations": { + "email": "muss eine gültige E-Mail Adresse sein" + } }, "actions": { "loading": "lade", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 3c2b7c8d8..fd7968428 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -18,7 +18,8 @@ "title": "Reset your password", "form": { "description": "A password reset email will be sent to the given email address.", - "submit": "Request email" + "submit": "Request email", + "submitted": "Reset email was requested" } }, "editor": { @@ -201,7 +202,10 @@ "name": "Name", "loadMore": "load more", "loading": "loading", - "reportContent": "Report" + "reportContent": "Report", + "validations": { + "email": "must be a valid email address" + } }, "actions": { "loading": "loading", diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js index 3c1f5b286..bba001614 100644 --- a/webapp/pages/password-reset.spec.js +++ b/webapp/pages/password-reset.spec.js @@ -1,4 +1,4 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils' +import { mount, createLocalVue } from '@vue/test-utils' import PasswordResetPage from './password-reset.vue' import Styleguide from '@human-connection/styleguide' @@ -25,9 +25,9 @@ describe('ProfileSlug', () => { } }) - describe('shallowMount', () => { + describe('mount', () => { Wrapper = () => { - return shallowMount(PasswordResetPage, { + return mount(PasswordResetPage, { mocks, localVue, }) @@ -37,5 +37,30 @@ describe('ProfileSlug', () => { wrapper = Wrapper() expect(wrapper.find('.password-reset-card').exists()).toBe(true) }) + + describe('submit', () => { + beforeEach(async () => { + wrapper = Wrapper() + wrapper.find('input#email').setValue('mail@example.org') + await wrapper.find('form').trigger('submit') + }) + + it('calls requestPasswordReset graphql mutation', () => { + expect(mocks.$apollo.mutate).toHaveBeenCalled() + }) + + it.todo('delivers email to backend') + it.todo('disables form to avoid re-submission') + it.todo('displays a message that a password email was requested') + }) + + describe('given password reset token as URL param', () => { + it.todo('displays a form to update your password') + describe('submitting new password', () => { + it.todo('calls resetPassword graphql mutation') + it.todo('delivers new password to backend') + it.todo('displays success message') + }) + }) }) }) diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index bd7da49be..0ad9b7997 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -5,10 +5,17 @@ -
+ @@ -17,10 +24,12 @@ {{ $t('password-reset.form.description') }} - + {{ $t('password-reset.form.submit') }} - +
@@ -30,7 +39,51 @@