From 2ca508ba2f479941676467bf3e39a88802ff4d57 Mon Sep 17 00:00:00 2001 From: roschaefer Date: Fri, 6 Sep 2019 19:27:37 +0200 Subject: [PATCH] Rename code => nonce in webapp/ --- .../PasswordReset/ChangePassword.spec.js | 8 +++---- .../PasswordReset/ChangePassword.vue | 18 +++++++------- ...VerifyCode.spec.js => VerifyNonce.spec.js} | 18 +++++++------- .../{VerifyCode.vue => VerifyNonce.vue} | 24 +++++++++---------- webapp/locales/de.json | 6 ++--- webapp/locales/en.json | 6 ++--- webapp/locales/pl.json | 6 ++--- webapp/nuxt.config.js | 8 +++---- .../pages/password-reset/change-password.vue | 6 ++--- webapp/pages/password-reset/request.vue | 2 +- .../{verify-code.vue => verify-nonce.vue} | 10 ++++---- 11 files changed, 56 insertions(+), 56 deletions(-) rename webapp/components/PasswordReset/{VerifyCode.spec.js => VerifyNonce.spec.js} (62%) rename webapp/components/PasswordReset/{VerifyCode.vue => VerifyNonce.vue} (70%) rename webapp/pages/password-reset/{verify-code.vue => verify-nonce.vue} (55%) diff --git a/webapp/components/PasswordReset/ChangePassword.spec.js b/webapp/components/PasswordReset/ChangePassword.spec.js index a6722f016..e93d5d00d 100644 --- a/webapp/components/PasswordReset/ChangePassword.spec.js +++ b/webapp/components/PasswordReset/ChangePassword.spec.js @@ -39,10 +39,10 @@ describe('ChangePassword ', () => { }) } - describe('given email and verification code', () => { + describe('given email and verification nonce', () => { beforeEach(() => { propsData.email = 'mail@example.org' - propsData.code = '123456' + propsData.nonce = '123456' }) describe('submitting new password', () => { @@ -59,14 +59,14 @@ describe('ChangePassword ', () => { it('delivers new password to backend', () => { const expected = expect.objectContaining({ - variables: { code: '123456', email: 'mail@example.org', password: 'supersecret' }, + variables: { nonce: '123456', email: 'mail@example.org', password: 'supersecret' }, }) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) describe('password reset successful', () => { it('displays success message', () => { - const expected = 'verify-code.form.change-password.success' + const expected = 'verify-nonce.form.change-password.success' expect(mocks.$t).toHaveBeenCalledWith(expected) }) diff --git a/webapp/components/PasswordReset/ChangePassword.vue b/webapp/components/PasswordReset/ChangePassword.vue index f59edffa1..3de4f048a 100644 --- a/webapp/components/PasswordReset/ChangePassword.vue +++ b/webapp/components/PasswordReset/ChangePassword.vue @@ -1,5 +1,5 @@ @@ -64,7 +64,7 @@ export default { }, props: { email: { type: String, required: true }, - code: { type: String, required: true }, + nonce: { type: String, required: true }, }, data() { const passwordForm = PasswordForm({ translate: this.$t }) @@ -82,13 +82,13 @@ export default { methods: { async handleSubmitPassword() { const mutation = gql` - mutation($code: String!, $email: String!, $password: String!) { - resetPassword(code: $code, email: $email, newPassword: $password) + mutation($nonce: String!, $email: String!, $password: String!) { + resetPassword(nonce: $nonce, email: $email, newPassword: $password) } ` const { password } = this.formData - const { email, code } = this - const variables = { password, email, code } + const { email, nonce } = this + const variables = { password, email, nonce } try { const { data: { resetPassword }, diff --git a/webapp/components/PasswordReset/VerifyCode.spec.js b/webapp/components/PasswordReset/VerifyNonce.spec.js similarity index 62% rename from webapp/components/PasswordReset/VerifyCode.spec.js rename to webapp/components/PasswordReset/VerifyNonce.spec.js index 22cdfd885..ebe552f0d 100644 --- a/webapp/components/PasswordReset/VerifyCode.spec.js +++ b/webapp/components/PasswordReset/VerifyNonce.spec.js @@ -1,12 +1,12 @@ import { mount, createLocalVue } from '@vue/test-utils' -import VerifyCode from './VerifyCode' +import VerifyNonce from './VerifyNonce.vue' import Styleguide from '@human-connection/styleguide' const localVue = createLocalVue() localVue.use(Styleguide) -describe('VerifyCode ', () => { +describe('VerifyNonce ', () => { let wrapper let Wrapper let mocks @@ -25,27 +25,27 @@ describe('VerifyCode ', () => { beforeEach(jest.useFakeTimers) Wrapper = () => { - return mount(VerifyCode, { + return mount(VerifyNonce, { mocks, localVue, propsData, }) } - it('renders a verify code form', () => { + it('renders a verify nonce form', () => { wrapper = Wrapper() - expect(wrapper.find('.verify-code').exists()).toBe(true) + expect(wrapper.find('.verify-nonce').exists()).toBe(true) }) - describe('after verification code given', () => { + describe('after verification nonce given', () => { beforeEach(() => { wrapper = Wrapper() - wrapper.find('input#code').setValue('123456') + wrapper.find('input#nonce').setValue('123456') wrapper.find('form').trigger('submit') }) - it('emits `verifyCode`', () => { - const expected = [[{ code: '123456', email: 'mail@example.org' }]] + it('emits `verification`', () => { + const expected = [[{ nonce: '123456', email: 'mail@example.org' }]] expect(wrapper.emitted('verification')).toEqual(expected) }) }) diff --git a/webapp/components/PasswordReset/VerifyCode.vue b/webapp/components/PasswordReset/VerifyNonce.vue similarity index 70% rename from webapp/components/PasswordReset/VerifyCode.vue rename to webapp/components/PasswordReset/VerifyNonce.vue index de1495e36..94ae13564 100644 --- a/webapp/components/PasswordReset/VerifyCode.vue +++ b/webapp/components/PasswordReset/VerifyNonce.vue @@ -1,5 +1,5 @@