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(() => { beforeEach(() => {
propsData.email = 'mail@example.org' propsData.email = 'mail@example.org'
propsData.code = '123456' propsData.nonce = '123456'
}) })
describe('submitting new password', () => { describe('submitting new password', () => {
@ -59,14 +59,14 @@ describe('ChangePassword ', () => {
it('delivers new password to backend', () => { it('delivers new password to backend', () => {
const expected = expect.objectContaining({ 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) expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected)
}) })
describe('password reset successful', () => { describe('password reset successful', () => {
it('displays success message', () => { 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) expect(mocks.$t).toHaveBeenCalledWith(expected)
}) })

View File

@ -1,5 +1,5 @@
<template> <template>
<ds-card class="verify-code"> <ds-card class="verify-nonce">
<ds-space margin="large"> <ds-space margin="large">
<ds-form <ds-form
v-if="!changePasswordResult" v-if="!changePasswordResult"
@ -35,14 +35,14 @@
<template v-if="changePasswordResult === 'success'"> <template v-if="changePasswordResult === 'success'">
<sweetalert-icon icon="success" /> <sweetalert-icon icon="success" />
<ds-text> <ds-text>
{{ $t(`verify-code.form.change-password.success`) }} {{ $t(`verify-nonce.form.change-password.success`) }}
</ds-text> </ds-text>
</template> </template>
<template v-else> <template v-else>
<sweetalert-icon icon="error" /> <sweetalert-icon icon="error" />
<ds-text align="left"> <ds-text align="left">
{{ $t(`verify-code.form.change-password.error`) }} {{ $t(`verify-nonce.form.change-password.error`) }}
{{ $t('verify-code.form.change-password.help') }} {{ $t('verify-nonce.form.change-password.help') }}
</ds-text> </ds-text>
<a href="mailto:support@human-connection.org">support@human-connection.org</a> <a href="mailto:support@human-connection.org">support@human-connection.org</a>
</template> </template>
@ -64,7 +64,7 @@ export default {
}, },
props: { props: {
email: { type: String, required: true }, email: { type: String, required: true },
code: { type: String, required: true }, nonce: { type: String, required: true },
}, },
data() { data() {
const passwordForm = PasswordForm({ translate: this.$t }) const passwordForm = PasswordForm({ translate: this.$t })
@ -82,13 +82,13 @@ export default {
methods: { methods: {
async handleSubmitPassword() { async handleSubmitPassword() {
const mutation = gql` const mutation = gql`
mutation($code: String!, $email: String!, $password: String!) { mutation($nonce: String!, $email: String!, $password: String!) {
resetPassword(code: $code, email: $email, newPassword: $password) resetPassword(nonce: $nonce, email: $email, newPassword: $password)
} }
` `
const { password } = this.formData const { password } = this.formData
const { email, code } = this const { email, nonce } = this
const variables = { password, email, code } const variables = { password, email, nonce }
try { try {
const { const {
data: { resetPassword }, data: { resetPassword },

View File

@ -1,12 +1,12 @@
import { mount, createLocalVue } from '@vue/test-utils' import { mount, createLocalVue } from '@vue/test-utils'
import VerifyCode from './VerifyCode' import VerifyNonce from './VerifyNonce.vue'
import Styleguide from '@human-connection/styleguide' import Styleguide from '@human-connection/styleguide'
const localVue = createLocalVue() const localVue = createLocalVue()
localVue.use(Styleguide) localVue.use(Styleguide)
describe('VerifyCode ', () => { describe('VerifyNonce ', () => {
let wrapper let wrapper
let Wrapper let Wrapper
let mocks let mocks
@ -25,27 +25,27 @@ describe('VerifyCode ', () => {
beforeEach(jest.useFakeTimers) beforeEach(jest.useFakeTimers)
Wrapper = () => { Wrapper = () => {
return mount(VerifyCode, { return mount(VerifyNonce, {
mocks, mocks,
localVue, localVue,
propsData, propsData,
}) })
} }
it('renders a verify code form', () => { it('renders a verify nonce form', () => {
wrapper = Wrapper() 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(() => { beforeEach(() => {
wrapper = Wrapper() wrapper = Wrapper()
wrapper.find('input#code').setValue('123456') wrapper.find('input#nonce').setValue('123456')
wrapper.find('form').trigger('submit') wrapper.find('form').trigger('submit')
}) })
it('emits `verifyCode`', () => { it('emits `verification`', () => {
const expected = [[{ code: '123456', email: 'mail@example.org' }]] const expected = [[{ nonce: '123456', email: 'mail@example.org' }]]
expect(wrapper.emitted('verification')).toEqual(expected) expect(wrapper.emitted('verification')).toEqual(expected)
}) })
}) })

View File

@ -1,5 +1,5 @@
<template> <template>
<ds-card class="verify-code"> <ds-card class="verify-nonce">
<ds-space margin="large"> <ds-space margin="large">
<ds-form <ds-form
v-model="formData" v-model="formData"
@ -9,19 +9,19 @@
@input-valid="handleInputValid" @input-valid="handleInputValid"
> >
<ds-input <ds-input
:placeholder="$t('verify-code.form.code')" :placeholder="$t('verify-nonce.form.nonce')"
model="code" model="nonce"
name="code" name="nonce"
id="code" id="nonce"
icon="question-circle" icon="question-circle"
/> />
<ds-space margin-botton="large"> <ds-space margin-botton="large">
<ds-text> <ds-text>
{{ $t('verify-code.form.description') }} {{ $t('verify-nonce.form.description') }}
</ds-text> </ds-text>
</ds-space> </ds-space>
<ds-button :disabled="disabled" primary fullwidth name="submit" type="submit"> <ds-button :disabled="disabled" primary fullwidth name="submit" type="submit">
{{ $t('verify-code.form.next') }} {{ $t('verify-nonce.form.next') }}
</ds-button> </ds-button>
</ds-form> </ds-form>
</ds-space> </ds-space>
@ -36,15 +36,15 @@ export default {
data() { data() {
return { return {
formData: { formData: {
code: '', nonce: '',
}, },
formSchema: { formSchema: {
code: { nonce: {
type: 'string', type: 'string',
min: 6, min: 6,
max: 6, max: 6,
required: true, required: true,
message: this.$t('common.validations.verification-code'), message: this.$t('common.validations.verification-nonce'),
}, },
}, },
disabled: true, disabled: true,
@ -58,9 +58,9 @@ export default {
this.disabled = false this.disabled = false
}, },
handleSubmitVerify() { handleSubmitVerify() {
const { code } = this.formData const { nonce } = this.formData
const email = this.email 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!" "success": "Dein Benutzerkonto wurde erstellt!"
} }
}, },
"verify-code": { "verify-nonce": {
"form": { "form": {
"code": "Code eingeben", "nonce": "Code eingeben",
"description": "Öffne dein E-Mail Postfach und gib den Code ein, den wir geschickt haben.", "description": "Öffne dein E-Mail Postfach und gib den Code ein, den wir geschickt haben.",
"next": "Weiter", "next": "Weiter",
"change-password": { "change-password": {
@ -342,7 +342,7 @@
"validations": { "validations": {
"email": "muss eine gültige E-Mail Adresse sein", "email": "muss eine gültige E-Mail Adresse sein",
"url": "muss eine gültige URL 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": { "actions": {

View File

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

View File

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

View File

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

View File

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

View File

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