refactor: restructure translations and components

This commit is contained in:
roschaefer 2019-10-04 23:05:36 +02:00 committed by mattwr18
parent 7a276db42f
commit bb5d581906
18 changed files with 344 additions and 325 deletions

View File

@ -1,12 +1,12 @@
import { mount, createLocalVue } from '@vue/test-utils' import { mount, createLocalVue } from '@vue/test-utils'
import VerifyNonce from './VerifyNonce.vue' import EnterNonce from './EnterNonce.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('VerifyNonce ', () => { describe('EnterNonce ', () => {
let wrapper let wrapper
let Wrapper let Wrapper
let mocks let mocks
@ -25,28 +25,28 @@ describe('VerifyNonce ', () => {
beforeEach(jest.useFakeTimers) beforeEach(jest.useFakeTimers)
Wrapper = () => { Wrapper = () => {
return mount(VerifyNonce, { return mount(EnterNonce, {
mocks, mocks,
localVue, localVue,
propsData, propsData,
}) })
} }
it('renders a verify nonce form', () => { it('renders an enter nonce form', () => {
wrapper = Wrapper() wrapper = Wrapper()
expect(wrapper.find('.verify-nonce').exists()).toBe(true) expect(wrapper.find('form').exists()).toBe(true)
}) })
describe('after verification nonce given', () => { describe('after nonce entered', () => {
beforeEach(() => { beforeEach(() => {
wrapper = Wrapper() wrapper = Wrapper()
wrapper.find('input#nonce').setValue('123456') wrapper.find('input#nonce').setValue('123456')
wrapper.find('form').trigger('submit') wrapper.find('form').trigger('submit')
}) })
it('emits `verification`', () => { it('emits `nonceEntered`', () => {
const expected = [[{ nonce: '123456', email: 'mail@example.org' }]] const expected = [[{ nonce: '123456', email: 'mail@example.org' }]]
expect(wrapper.emitted('verification')).toEqual(expected) expect(wrapper.emitted('nonceEntered')).toEqual(expected)
}) })
}) })
}) })

View File

@ -0,0 +1,65 @@
<template>
<ds-space margin="large">
<ds-form
v-model="formData"
:schema="formSchema"
@submit="handleSubmitVerify"
@input="handleInput"
@input-valid="handleInputValid"
>
<ds-input
:placeholder="$t('components.enter-nonce.form.nonce')"
model="nonce"
name="nonce"
id="nonce"
icon="question-circle"
/>
<ds-space margin-botton="large">
<ds-text>
{{ $t('components.enter-nonce.form.description') }}
</ds-text>
</ds-space>
<ds-button :disabled="disabled" primary fullwidth name="submit" type="submit">
{{ $t('components.enter-nonce.form.next') }}
</ds-button>
</ds-form>
</ds-space>
</template>
<script>
export default {
props: {
email: { type: String, required: true },
},
data() {
return {
formData: {
nonce: '',
},
formSchema: {
nonce: {
type: 'string',
min: 6,
max: 6,
required: true,
message: this.$t('components.enter-nonce.form.validations.length'),
},
},
disabled: true,
}
},
methods: {
async handleInput() {
this.disabled = true
},
async handleInputValid() {
this.disabled = false
},
handleSubmitVerify() {
const { nonce } = this.formData
const email = this.email
this.$emit('nonceEntered', { email, nonce })
},
},
}
</script>

View File

@ -39,7 +39,7 @@ describe('ChangePassword ', () => {
}) })
} }
describe('given email and verification nonce', () => { describe('given email and nonce', () => {
beforeEach(() => { beforeEach(() => {
propsData.email = 'mail@example.org' propsData.email = 'mail@example.org'
propsData.nonce = '123456' propsData.nonce = '123456'
@ -66,7 +66,7 @@ describe('ChangePassword ', () => {
describe('password reset successful', () => { describe('password reset successful', () => {
it('displays success message', () => { it('displays success message', () => {
const expected = 'verify-nonce.form.change-password.success' const expected = 'components.password-reset.change-password.success'
expect(mocks.$t).toHaveBeenCalledWith(expected) expect(mocks.$t).toHaveBeenCalledWith(expected)
}) })

View File

@ -1,54 +1,58 @@
<template> <template>
<ds-card class="verify-nonce"> <ds-space margin-top="base" margin-bottom="xxx-small">
<ds-space margin="large"> <ds-form
<ds-form v-if="!changePasswordResult"
v-if="!changePasswordResult" v-model="formData"
v-model="formData" :schema="formSchema"
:schema="formSchema" @submit="handleSubmitPassword"
@submit="handleSubmitPassword" class="change-password"
class="change-password" >
> <template slot-scope="{ errors }">
<template slot-scope="{ errors }"> <ds-input
<ds-input id="password"
id="password" model="password"
model="password" type="password"
type="password" autocomplete="off"
autocomplete="off" :label="$t('settings.security.change-password.label-new-password')"
:label="$t('settings.security.change-password.label-new-password')" />
/> <ds-input
<ds-input id="passwordConfirmation"
id="passwordConfirmation" model="passwordConfirmation"
model="passwordConfirmation" type="password"
type="password" autocomplete="off"
autocomplete="off" :label="$t('settings.security.change-password.label-new-password-confirm')"
:label="$t('settings.security.change-password.label-new-password-confirm')" />
/> <password-strength :password="formData.password" />
<password-strength :password="formData.password" /> <ds-space margin-top="base" margin-bottom="xxx-small">
<ds-space margin-top="base"> <ds-button :loading="$apollo.loading" :disabled="errors" primary>
<ds-button :loading="$apollo.loading" :disabled="errors" primary> {{ $t('settings.security.change-password.button') }}
{{ $t('settings.security.change-password.button') }} </ds-button>
</ds-button> </ds-space>
</ds-space> </template>
</template> </ds-form>
</ds-form> <ds-text v-else>
<ds-text v-else> <template v-if="changePasswordResult === 'success'">
<template v-if="changePasswordResult === 'success'"> <sweetalert-icon icon="success" />
<sweetalert-icon icon="success" /> <ds-text>
<ds-text> {{ $t('components.password-reset.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>
<ds-text align="left"> <p>
{{ $t(`verify-nonce.form.change-password.error`) }} {{ $t(`components.password-reset.change-password.error`) }}
{{ $t('verify-nonce.form.change-password.help') }} </p>
</ds-text> <p>
<a href="mailto:support@human-connection.org">support@human-connection.org</a> {{ $t('components.password-reset.change-password.help') }}
</template> <br />
</ds-text> <a href="mailto:support@human-connection.org">support@human-connection.org</a>
</ds-space> </p>
</ds-card> </ds-text>
</template>
<slot></slot>
</ds-text>
</ds-space>
</template> </template>
<script> <script>

View File

@ -18,7 +18,7 @@ describe('Request', () => {
success: jest.fn(), success: jest.fn(),
error: jest.fn(), error: jest.fn(),
}, },
$t: jest.fn(), $t: jest.fn(t => t),
$apollo: { $apollo: {
loading: false, loading: false,
mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }), mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }),
@ -45,7 +45,7 @@ describe('Request', () => {
it('renders a password reset form', () => { it('renders a password reset form', () => {
wrapper = Wrapper() wrapper = Wrapper()
expect(wrapper.find('.password-reset').exists()).toBe(true) expect(wrapper.find('form').exists()).toBe(true)
}) })
describe('submit', () => { describe('submit', () => {
@ -69,7 +69,10 @@ describe('Request', () => {
}) })
it('displays a message that a password email was requested', () => { it('displays a message that a password email was requested', () => {
const expected = ['password-reset.form.submitted', { email: 'mail@example.org' }] const expected = [
'components.password-reset.request.form.submitted',
{ email: 'mail@example.org' },
]
expect(mocks.$t).toHaveBeenCalledWith(...expected) expect(mocks.$t).toHaveBeenCalledWith(...expected)
}) })

View File

@ -1,76 +1,55 @@
<template> <template>
<ds-card class="password-reset"> <ds-form
<ds-flex gutter="small"> v-if="!submitted"
<ds-flex-item :width="{ base: '100%', sm: '50%' }" centered> @input="handleInput"
<client-only> @input-valid="handleInputValid"
<locale-switch offset="5" /> v-model="formData"
</client-only> :schema="formSchema"
<ds-space margin-top="small" margin-bottom="xxx-small" centered> @submit="handleSubmit"
<img class="login-image" alt="Human Connection" src="/img/sign-up/humanconnection.svg" /> >
</ds-space> <ds-space margin="small">
</ds-flex-item> <ds-input
<ds-flex-item :width="{ base: '100%', sm: '50%' }" centered> :placeholder="$t('login.email')"
<ds-form type="email"
v-if="!submitted" id="email"
@input="handleInput" model="email"
@input-valid="handleInputValid" name="email"
v-model="formData" icon="envelope"
:schema="formSchema" />
@submit="handleSubmit" </ds-space>
> <ds-space margin-botton="large">
<ds-space margin="small"> <ds-text align="left">{{ $t('components.password-reset.request.form.description') }}</ds-text>
<ds-input </ds-space>
:placeholder="$t('login.email')" <ds-button
type="email" :disabled="disabled"
id="email" :loading="$apollo.loading"
model="email" primary
name="email" fullwidth
icon="envelope" name="submit"
/> type="submit"
</ds-space> icon="envelope"
<ds-space margin-botton="large"> >
<ds-text align="left">{{ $t('password-reset.form.description') }}</ds-text> {{ $t('components.password-reset.request.form.submit') }}
</ds-space> </ds-button>
<ds-button <slot></slot>
:disabled="disabled" </ds-form>
:loading="$apollo.loading" <div v-else>
primary <transition name="ds-transition-fade">
fullwidth <ds-flex centered>
name="submit" <sweetalert-icon icon="info" />
type="submit" </ds-flex>
icon="envelope" </transition>
> <ds-text v-html="submitMessage" align="left" />
{{ $t('password-reset.form.submit') }} </div>
</ds-button>
</ds-form>
<div v-else>
<transition name="ds-transition-fade">
<ds-flex centered>
<sweetalert-icon icon="info" />
</ds-flex>
</transition>
<ds-text v-html="submitMessage" align="left" />
</div>
<ds-space margin-bottom="small" />
<div>
<nuxt-link to="/login">{{ $t('site.login') }}</nuxt-link>
</div>
</ds-flex-item>
</ds-flex>
<ds-space margin="x-small"></ds-space>
</ds-card>
</template> </template>
<script> <script>
import gql from 'graphql-tag' import gql from 'graphql-tag'
import { SweetalertIcon } from 'vue-sweetalert-icons' import { SweetalertIcon } from 'vue-sweetalert-icons'
import LocaleSwitch from '../LocaleSwitch/LocaleSwitch'
export default { export default {
components: { components: {
SweetalertIcon, SweetalertIcon,
LocaleSwitch,
}, },
data() { data() {
return { return {
@ -91,7 +70,7 @@ export default {
computed: { computed: {
submitMessage() { submitMessage() {
const { email } = this.formData const { email } = this.formData
return this.$t('password-reset.form.submitted', { email }) return this.$t('components.password-reset.request.form.submitted', { email })
}, },
}, },
methods: { methods: {
@ -128,7 +107,4 @@ export default {
width: 90%; width: 90%;
max-width: 200px; max-width: 200px;
} }
.password-reset {
position: relative;
}
</style> </style>

View File

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

View File

@ -42,7 +42,7 @@ describe('Signup', () => {
describe('without invitation code', () => { describe('without invitation code', () => {
it('renders signup form', () => { it('renders signup form', () => {
wrapper = Wrapper() wrapper = Wrapper()
expect(wrapper.find('.signup').exists()).toBe(true) expect(wrapper.find('form').exists()).toBe(true)
}) })
describe('submit', () => { describe('submit', () => {

View File

@ -8,7 +8,9 @@
:schema="formSchema" :schema="formSchema"
@submit="handleSubmit" @submit="handleSubmit"
> >
<h1>{{ invitation ? $t('profile.invites.title') : $t('registration.signup.title') }}</h1> <h1>
{{ invitation ? $t('profile.invites.title') : $t('components.registration.signup.title') }}
</h1>
<ds-space v-if="token" margin-botton="large"> <ds-space v-if="token" margin-botton="large">
<ds-text v-html="$t('registration.signup.form.invitation-code', { code: token })" /> <ds-text v-html="$t('registration.signup.form.invitation-code', { code: token })" />
</ds-space> </ds-space>
@ -17,7 +19,7 @@
{{ {{
invitation invitation
? $t('profile.invites.description') ? $t('profile.invites.description')
: $t('registration.signup.form.description') : $t('components.registration.signup.form.description')
}} }}
</ds-text> </ds-text>
</ds-space> </ds-space>
@ -38,7 +40,7 @@
type="submit" type="submit"
icon="envelope" icon="envelope"
> >
{{ $t('registration.signup.form.submit') }} {{ $t('components.registration.signup.form.submit') }}
</ds-button> </ds-button>
</ds-form> </ds-form>
<div v-else> <div v-else>

View File

@ -1,4 +1,49 @@
{ {
"components": {
"password-reset": {
"request": {
"form": {
"description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.",
"submit": "Email anfordern",
"submitted": "Eine E-Mail mit weiteren Instruktionen wurde verschickt an <b>{email}</b>"
}
},
"change-password": {
"success": "Änderung des Passworts war erfolgreich!",
"error": "Passwort Änderung fehlgeschlagen. Möglicherweise falscher Sicherheitscode?",
"help": "Falls Probleme auftreten, schreib uns gerne eine Mail an:"
}
},
"enter-nonce": {
"form": {
"nonce": "Code eingeben",
"description": "Öffne dein E-Mail Postfach und gib den Code ein, den wir geschickt haben.",
"next": "Weiter",
"validations": {
"length": "muss genau 6 Buchstaben lang sein"
}
}
},
"registration": {
"signup": {
"title": "Mach mit bei Human Connection!",
"form": {
"description": "Um loszulegen, gib deine E-Mail Adresse ein:",
"invitation-code": "Dein Einladungscode lautet: <b>{code}</b>",
"errors": {
"email-exists": "Es gibt schon ein Benutzerkonto mit dieser E-Mail Adresse!",
"invalid-invitation-token": "Es sieht so aus, als ob der Einladungscode schon eingelöst wurde. Jeder Code kann nur einmalig benutzt werden."
},
"submit": "Konto erstellen",
"success": "Eine Mail mit einem Bestätigungslink für die Registrierung wurde an <b>{email}</b> geschickt"
}
},
"create-user-account": {
"title": "Benutzerkonto anlegen",
"success": "Dein Benutzerkonto wurde erstellt!"
}
}
},
"maintenance": { "maintenance": {
"title": "Human Connection befindet sich in der Wartung", "title": "Human Connection befindet sich in der Wartung",
"explanation": "Zurzeit führen wir einige geplante Wartungsarbeiten durch, bitte versuch es später erneut.", "explanation": "Zurzeit führen wir einige geplante Wartungsarbeiten durch, bitte versuch es später erneut.",
@ -42,7 +87,7 @@
"bank": "Bankverbindung", "bank": "Bankverbindung",
"germany": "Deutschland", "germany": "Deutschland",
"code-of-conduct": "Verhaltenscodex", "code-of-conduct": "Verhaltenscodex",
"login": "Zurück zum Anmeldung" "back-to-login": "Zurück zur Anmeldung"
}, },
"sorting": { "sorting": {
"newest": "Neueste", "newest": "Neueste",
@ -63,45 +108,6 @@
"hello": "Hallo", "hello": "Hallo",
"success": "Du bist eingeloggt!" "success": "Du bist eingeloggt!"
}, },
"password-reset": {
"form": {
"description": "Eine Mail zum Zurücksetzen des Passworts wird an die angegebene E-Mail Adresse geschickt.",
"submit": "Email anfordern",
"submitted": "Eine E-Mail mit weiteren Instruktionen wurde verschickt an <b>{email}</b>"
}
},
"registration": {
"signup": {
"title": "Mach mit bei Human Connection!",
"form": {
"description": "Um loszulegen, gib deine E-Mail Adresse ein:",
"invitation-code": "Dein Einladungscode lautet: <b>{code}</b>",
"errors": {
"email-exists": "Es gibt schon ein Benutzerkonto mit dieser E-Mail Adresse!",
"invalid-invitation-token": "Es sieht so aus, als ob der Einladungscode schon eingelöst wurde. Jeder Code kann nur einmalig benutzt werden."
},
"submit": "Konto erstellen",
"success": "Eine Mail mit einem Bestätigungslink für die Registrierung wurde an <b>{email}</b> geschickt"
},
"back-to-login": "Zurück zur Anmeldung"
},
"create-user-account": {
"title": "Benutzerkonto anlegen",
"success": "Dein Benutzerkonto wurde erstellt!"
}
},
"verify-nonce": {
"form": {
"nonce": "Code eingeben",
"description": "Öffne dein E-Mail Postfach und gib den Code ein, den wir geschickt haben.",
"next": "Weiter",
"change-password": {
"success": "Änderung des Passworts war erfolgreich!",
"error": "Passwort Änderung fehlgeschlagen. Möglicherweise falscher Sicherheitscode?",
"help": "Falls Probleme auftreten, schreib uns gerne eine Mail an:"
}
}
},
"editor": { "editor": {
"placeholder": "Schreib etwas Inspirierendes …", "placeholder": "Schreib etwas Inspirierendes …",
"mention": { "mention": {
@ -400,8 +406,7 @@
"reportContent": "Melden", "reportContent": "Melden",
"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-nonce": "muss genau 6 Buchstaben lang sein"
} }
}, },
"actions": { "actions": {

View File

@ -1,4 +1,50 @@
{ {
"components": {
"password-reset": {
"request": {
"title": "Reset your password",
"form": {
"description": "A password reset email will be sent to the given email address.",
"submit": "Request email",
"submitted": "An email with further instructions has been sent to <b>{email}</b>"
}
},
"change-password": {
"success": "Changing your password was successful!",
"error": "Changing your password failed. Maybe the security code was not correct?",
"help": "In case of problems, feel free to ask for help by sending us a mail to:"
}
},
"enter-nonce": {
"form": {
"nonce": "Enter your code",
"description": "Open your inbox and enter the code that we've sent to you.",
"next": "Continue",
"validations": {
"length": "must be 6 characters long"
}
}
},
"registration": {
"signup": {
"title": "Join Human Connection!",
"form": {
"description": "To get started, enter your email address:",
"invitation-code": "Your invitation code is: <b>{code}</b>",
"errors": {
"email-exists": "There is already a user account with this email address!",
"invalid-invitation-token": "It looks like as if the invitation has been used already. Invitation links can only be used once."
},
"submit": "Create an account",
"success": "A mail with a link to complete your registration has been sent to <b>{email}</b>"
}
},
"create-user-account": {
"title": "Create user account",
"success": "Your account has been created!"
}
}
},
"maintenance": { "maintenance": {
"title": "Human Connection is under maintenance", "title": "Human Connection is under maintenance",
"explanation": "At the moment we are doing some scheduled maintenance, please try again later.", "explanation": "At the moment we are doing some scheduled maintenance, please try again later.",
@ -42,7 +88,7 @@
"bank": "bank account", "bank": "bank account",
"germany": "Germany", "germany": "Germany",
"code-of-conduct": "Code of Conduct", "code-of-conduct": "Code of Conduct",
"login": "Back to login" "back-to-login": "Back to login page"
}, },
"sorting": { "sorting": {
"newest": "Newest", "newest": "Newest",
@ -63,46 +109,6 @@
"hello": "Hello", "hello": "Hello",
"success": "You are logged in!" "success": "You are logged in!"
}, },
"password-reset": {
"title": "Reset your password",
"form": {
"description": "A password reset email will be sent to the given email address.",
"submit": "Request email",
"submitted": "An email with further instructions has been sent to <b>{email}</b>"
}
},
"registration": {
"signup": {
"title": "Join Human Connection!",
"form": {
"description": "To get started, enter your email address:",
"invitation-code": "Your invitation code is: <b>{code}</b>",
"errors": {
"email-exists": "There is already a user account with this email address!",
"invalid-invitation-token": "It looks like as if the invitation has been used already. Invitation links can only be used once."
},
"submit": "Create an account",
"success": "A mail with a link to complete your registration has been sent to <b>{email}</b>"
},
"back-to-login": "Back to login page"
},
"create-user-account": {
"title": "Create user account",
"success": "Your account has been created!"
}
},
"verify-nonce": {
"form": {
"nonce": "Enter your code",
"description": "Open your inbox and enter the code that we've sent to you.",
"next": "Continue",
"change-password": {
"success": "Changing your password was successful!",
"error": "Changing your password failed. Maybe the security code was not correct?",
"help": "In case of problems, feel free to ask for help by sending us a mail to:"
}
}
},
"editor": { "editor": {
"placeholder": "Leave your inspirational thoughts …", "placeholder": "Leave your inspirational thoughts …",
"mention": { "mention": {
@ -401,8 +407,7 @@
"reportContent": "Report", "reportContent": "Report",
"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-nonce": "must be 6 characters long"
} }
}, },
"actions": { "actions": {

View File

@ -1,4 +1,31 @@
{ {
"components": {
"password-reset": {
"request": {
"title": "Zresetuj hasło",
"form": {
"description": "Na podany adres e-mail zostanie wysłany email z resetem hasła.",
"submit": "Poproś o wiadomość e-mail",
"submitted": "Na adres <b>{email}</b> została wysłana wiadomość z dalszymi instrukcjami."
}
},
"change-password": {
"success": "Zmiana hasła zakończyła się sukcesem!",
"error": "Zmiana hasła nie powiodła się. Może kod bezpieczeństwa nie był poprawny?",
"help": "W przypadku problemów, zachęcamy do zwrócenia się o pomoc, wysyłając do nas wiadomość e-mail:"
}
},
"enter-nonce": {
"form": {
"nonce": "Wprowadź swój kod",
"description": "Otwórz swoją skrzynkę odbiorczą i wpisz kod, który do Ciebie wysłaliśmy.",
"next": "Kontynuuj",
"validations": {
"length": "musi mieć długość 6 znaków."
}
}
}
},
"filter-menu": { "filter-menu": {
"title": "Twoja bańka filtrująca" "title": "Twoja bańka filtrująca"
}, },
@ -29,26 +56,6 @@
"moreInfoHint": "idź po więcej szczegółów", "moreInfoHint": "idź po więcej szczegółów",
"hello": "Cześć" "hello": "Cześć"
}, },
"password-reset": {
"title": "Zresetuj hasło",
"form": {
"description": "Na podany adres e-mail zostanie wysłany email z resetem hasła.",
"submit": "Poproś o wiadomość e-mail",
"submitted": "Na adres <b>{email}</b> została wysłana wiadomość z dalszymi instrukcjami."
}
},
"verify-nonce": {
"form": {
"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": {
"success": "Zmiana hasła zakończyła się sukcesem!",
"error": "Zmiana hasła nie powiodła się. Może kod bezpieczeństwa nie był poprawny?",
"help": "W przypadku problemów, zachęcamy do zwrócenia się o pomoc, wysyłając do nas wiadomość e-mail:"
}
}
},
"editor": { "editor": {
"placeholder": "Napisz coś inspirującego..." "placeholder": "Napisz coś inspirującego..."
}, },
@ -236,8 +243,7 @@
"loading": "załadunek", "loading": "załadunek",
"reportContent": "Sprawozdanie", "reportContent": "Sprawozdanie",
"validations": { "validations": {
"email": "musi być ważny adres e-mail.", "email": "musi być ważny adres e-mail."
"verification-nonce": "musi mieć długość 6 znaków."
} }
}, },
"actions": { "actions": {

View File

@ -36,7 +36,7 @@ export default {
'login', 'login',
'logout', 'logout',
'password-reset-request', 'password-reset-request',
'password-reset-verify-nonce', 'password-reset-enter-nonce',
'password-reset-change-password', 'password-reset-change-password',
'registration-signup', 'registration-signup',
'registration-enter-nonce', 'registration-enter-nonce',

View File

@ -1,17 +1,22 @@
<template> <template>
<ds-container width="medium"> <ds-container width="small">
<ds-flex> <ds-card>
<ds-flex-item :width="{ base: '100%' }" centered> <client-only>
<ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered> <locale-switch offset="5" />
<nuxt-child /> </client-only>
</ds-space> <nuxt-child />
</ds-flex-item> <ds-space margin="x-small"></ds-space>
</ds-flex> </ds-card>
</ds-container> </ds-container>
</template> </template>
<script> <script>
import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch'
export default { export default {
components: {
LocaleSwitch,
},
layout: 'no-header', layout: 'no-header',
asyncData({ store, redirect }) { asyncData({ store, redirect }) {
if (store.getters['auth/isLoggedIn']) { if (store.getters['auth/isLoggedIn']) {
@ -20,3 +25,10 @@ export default {
}, },
} }
</script> </script>
<style lang="scss" scoped>
img {
padding-left: 50px;
padding-right: 50px;
max-width: 200px;
}
</style>

View File

@ -3,7 +3,11 @@
:email="email" :email="email"
:nonce="nonce" :nonce="nonce"
@passwordResetResponse="handlePasswordResetResponse" @passwordResetResponse="handlePasswordResetResponse"
/> >
<ds-space centered>
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
</ds-space>
</change-password>
</template> </template>
<script> <script>

View File

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

View File

@ -1,5 +1,9 @@
<template> <template>
<request @handleSubmitted="handlePasswordResetRequested" /> <request @handleSubmitted="handlePasswordResetRequested">
<ds-space margin-bottom="xxx-small" margin-top="large" centered>
<nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
</ds-space>
</request>
</template> </template>
<script> <script>
@ -11,7 +15,7 @@ export default {
}, },
methods: { methods: {
handlePasswordResetRequested({ email }) { handlePasswordResetRequested({ email }) {
this.$router.push({ path: 'verify-nonce', query: { email } }) this.$router.push({ path: 'enter-nonce', query: { email } })
}, },
}, },
} }

View File

@ -12,7 +12,7 @@
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{ base: '100%', sm: '50%' }" centered> <ds-flex-item :width="{ base: '100%', sm: '50%' }" centered>
<signup :invitation="false" /> <signup :invitation="false" />
<nuxt-link to="/login">{{ $t('registration.signup.back-to-login') }}</nuxt-link> <nuxt-link to="/login">{{ $t('site.back-to-login') }}</nuxt-link>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
</ds-card> </ds-card>