Rename code => nonce in webapp/

This commit is contained in:
roschaefer 2019-09-06 19:27:37 +02:00
parent e751571981
commit 2ca508ba2f
11 changed files with 56 additions and 56 deletions

View File

@ -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)
})

View File

@ -1,5 +1,5 @@
<template>
<ds-card class="verify-code">
<ds-card class="verify-nonce">
<ds-space margin="large">
<ds-form
v-if="!changePasswordResult"
@ -35,14 +35,14 @@
<template v-if="changePasswordResult === 'success'">
<sweetalert-icon icon="success" />
<ds-text>
{{ $t(`verify-code.form.change-password.success`) }}
{{ $t(`verify-nonce.form.change-password.success`) }}
</ds-text>
</template>
<template v-else>
<sweetalert-icon icon="error" />
<ds-text align="left">
{{ $t(`verify-code.form.change-password.error`) }}
{{ $t('verify-code.form.change-password.help') }}
{{ $t(`verify-nonce.form.change-password.error`) }}
{{ $t('verify-nonce.form.change-password.help') }}
</ds-text>
<a href="mailto:support@human-connection.org">support@human-connection.org</a>
</template>
@ -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 },

View File

@ -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)
})
})

View File

@ -1,5 +1,5 @@
<template>
<ds-card class="verify-code">
<ds-card class="verify-nonce">
<ds-space margin="large">
<ds-form
v-model="formData"
@ -9,19 +9,19 @@
@input-valid="handleInputValid"
>
<ds-input
:placeholder="$t('verify-code.form.code')"
model="code"
name="code"
id="code"
:placeholder="$t('verify-nonce.form.nonce')"
model="nonce"
name="nonce"
id="nonce"
icon="question-circle"
/>
<ds-space margin-botton="large">
<ds-text>
{{ $t('verify-code.form.description') }}
{{ $t('verify-nonce.form.description') }}
</ds-text>
</ds-space>
<ds-button :disabled="disabled" primary fullwidth name="submit" type="submit">
{{ $t('verify-code.form.next') }}
{{ $t('verify-nonce.form.next') }}
</ds-button>
</ds-form>
</ds-space>
@ -36,15 +36,15 @@ export default {
data() {
return {
formData: {
code: '',
nonce: '',
},
formSchema: {
code: {
nonce: {
type: 'string',
min: 6,
max: 6,
required: true,
message: this.$t('common.validations.verification-code'),
message: this.$t('common.validations.verification-nonce'),
},
},
disabled: true,
@ -58,9 +58,9 @@ export default {
this.disabled = false
},
handleSubmitVerify() {
const { code } = this.formData
const { nonce } = this.formData
const email = this.email
this.$emit('verification', { email, code })
this.$emit('verification', { email, nonce })
},
},
}

View File

@ -82,9 +82,9 @@
"success": "Dein Benutzerkonto wurde erstellt!"
}
},
"verify-code": {
"verify-nonce": {
"form": {
"code": "Code eingeben",
"nonce": "Code eingeben",
"description": "Öffne dein E-Mail Postfach und gib den Code ein, den wir geschickt haben.",
"next": "Weiter",
"change-password": {
@ -342,7 +342,7 @@
"validations": {
"email": "muss eine gültige E-Mail Adresse sein",
"url": "muss eine gültige URL sein",
"verification-code": "muss genau 6 Buchstaben lang sein"
"verification-nonce": "muss genau 6 Buchstaben lang sein"
}
},
"actions": {

View File

@ -82,9 +82,9 @@
"success": "Your account has been created!"
}
},
"verify-code": {
"verify-nonce": {
"form": {
"code": "Enter your code",
"nonce": "Enter your code",
"description": "Open your inbox and enter the code that we've sent to you.",
"next": "Continue",
"change-password": {
@ -342,7 +342,7 @@
"validations": {
"email": "must be a valid email address",
"url": "must be a valid URL",
"verification-code": "must be 6 characters long"
"verification-nonce": "must be 6 characters long"
}
},
"actions": {

View File

@ -37,9 +37,9 @@
"submitted": "Na adres <b>{email}</b> została wysłana wiadomość z dalszymi instrukcjami."
}
},
"verify-code": {
"verify-nonce": {
"form": {
"code": "Wprowadź swój kod",
"nonce": "Wprowadź swój kod",
"description": "Otwórz swoją skrzynkę odbiorczą i wpisz kod, który do Ciebie wysłaliśmy.",
"next": "Kontynuuj",
"change-password": {
@ -237,7 +237,7 @@
"reportContent": "Sprawozdanie",
"validations": {
"email": "musi być ważny adres e-mail.",
"verification-code": "musi mieć długość 6 znaków."
"verification-nonce": "musi mieć długość 6 znaków."
}
},
"actions": {

View File

@ -35,11 +35,11 @@ module.exports = {
'login',
'logout',
'password-reset-request',
'password-reset-verify-code',
'password-reset-verify-nonce',
'password-reset-change-password',
// 'registration-signup', TODO: uncomment to open public registration
'registration-signup-by-invitation-code',
'registration-verify-code',
// 'registration-signup', TODO: implement to open public registration
// 'registration-signup-by-invitation-code',
// 'registration-verify-nonce',
'registration-create-user-account',
'pages-slug',
'imprint',

View File

@ -1,7 +1,7 @@
<template>
<change-password
:email="email"
:code="code"
:nonce="nonce"
@passwordResetResponse="handlePasswordResetResponse"
/>
</template>
@ -11,8 +11,8 @@ import ChangePassword from '~/components/PasswordReset/ChangePassword'
export default {
data() {
const { email = '', code = '' } = this.$route.query
return { email, code }
const { email = '', nonce = '' } = this.$route.query
return { email, nonce }
},
components: {
ChangePassword,

View File

@ -11,7 +11,7 @@ export default {
},
methods: {
handlePasswordResetRequested({ email }) {
this.$router.push({ path: 'verify-code', query: { email } })
this.$router.push({ path: 'verify-nonce', query: { email } })
},
},
}

View File

@ -1,21 +1,21 @@
<template>
<verify-code :email="email" @verification="handleVerification" />
<verify-nonce :email="email" @verification="handleVerification" />
</template>
<script>
import VerifyCode from '~/components/PasswordReset/VerifyCode'
import VerifyNonce from '~/components/PasswordReset/VerifyNonce'
export default {
components: {
VerifyCode,
VerifyNonce,
},
data() {
const { email = '' } = this.$route.query
return { email }
},
methods: {
handleVerification({ email, code }) {
this.$router.push({ path: 'change-password', query: { email, code } })
handleVerification({ email, nonce }) {
this.$router.push({ path: 'change-password', query: { email, nonce } })
},
},
}