From a4fbc73480bec23fcdd79e975eb1968907420522 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 20 Jul 2021 14:59:06 +0200 Subject: [PATCH] use paddword confirmation component --- .../Inputs/InputPasswordConfirmation.vue | 8 ++- frontend/src/views/Pages/Register.spec.js | 31 +-------- frontend/src/views/Pages/Register.vue | 69 +++---------------- 3 files changed, 19 insertions(+), 89 deletions(-) diff --git a/frontend/src/components/Inputs/InputPasswordConfirmation.vue b/frontend/src/components/Inputs/InputPasswordConfirmation.vue index 08efaccfd..75c2ded47 100644 --- a/frontend/src/components/Inputs/InputPasswordConfirmation.vue +++ b/frontend/src/components/Inputs/InputPasswordConfirmation.vue @@ -13,7 +13,7 @@ :label="$t('form.password_new')" :showAllErrors="true" :immediate="true" - :name="$t('form.password_new')" + :name="createId($t('form.password_new'))" :placeholder="$t('form.password_new')" v-model="password" > @@ -24,6 +24,7 @@ @@ -51,6 +52,11 @@ export default { passwordRepeat: '', } }, + methods: { + createId(text) { + return text.replace(/ +/g, '-') + }, + }, computed: { passwordObject() { return { password: this.password, passwordRepeat: this.passwordRepeat } diff --git a/frontend/src/views/Pages/Register.spec.js b/frontend/src/views/Pages/Register.spec.js index 64c38f449..f428a186f 100644 --- a/frontend/src/views/Pages/Register.spec.js +++ b/frontend/src/views/Pages/Register.spec.js @@ -65,11 +65,11 @@ describe('Register', () => { }) it('has password input fields', () => { - expect(wrapper.find('#registerPassword').exists()).toBeTruthy() + expect(wrapper.find('input[name="form.password_new"]').exists()).toBeTruthy() }) it('has password repeat input fields', () => { - expect(wrapper.find('#registerPasswordRepeat').exists()).toBeTruthy() + expect(wrapper.find('input[name="form.password_new_repeat"]').exists()).toBeTruthy() }) it('has 1 checkbox input fields', () => { @@ -103,33 +103,8 @@ describe('Register', () => { 'validations.messages.required', ) }) - - /** - * it('shows a warning when no valid Email is entered', async () => { - wrapper.find('#registerEmail').setValue('no_valid@Email') - await flushPromises() - await expect(wrapper.find('#registerEmailLiveFeedback').text()).toEqual( - 'validations.messages.email', - ) - }) - */ - - it('shows 4 warnings when no password is set', async () => { - const passwords = wrapper.findAll('input[type="password"]') - passwords.at(0).setValue('') - passwords.at(1).setValue('') - await flushPromises() - await expect(wrapper.find('div.hints').text()).toContain( - 'site.signup.lowercase', - 'site.signup.uppercase', - 'site.signup.minimum', - 'site.signup.one_number', - ) - }) - - // TODO test different invalid password combinations }) - // TODO test submit button + // To Do: Test lines 156-197,210-213 }) }) diff --git a/frontend/src/views/Pages/Register.vue b/frontend/src/views/Pages/Register.vue index 1e5600008..a74e857aa 100755 --- a/frontend/src/views/Pages/Register.vue +++ b/frontend/src/views/Pages/Register.vue @@ -79,24 +79,8 @@
- - + - -
-
    -
  • - {{ error }} -
  • -
-
-
-

- {{ $t('site.signup.dont_match') }} - -

-
-
-
+
{{ $t('form.reset') }} {{ $t('signup') }} @@ -153,10 +127,10 @@