PW-Reset page switches password reset and verify

This commit is contained in:
Robert Schäfer 2019-06-17 15:17:58 +02:00
parent aa6855434d
commit edd6a3f0c3
3 changed files with 40 additions and 27 deletions

View File

@ -68,8 +68,8 @@ describe('PasswordReset', () => {
describe('after animation', () => { describe('after animation', () => {
beforeEach(jest.runAllTimers) beforeEach(jest.runAllTimers)
it('emits `submitted`', () => { it('emits `handleSubmitted`', () => {
expect(wrapper.emitted('submitted')).toBeTruthy() expect(wrapper.emitted('handleSubmitted')).toBeTruthy()
}) })
}) })
}) })

View File

@ -8,7 +8,7 @@
v-model="formData" v-model="formData"
:schema="formSchema" :schema="formSchema"
@submit="handleSubmit" @submit="handleSubmit"
> >
<ds-input <ds-input
:placeholder="$t('login.email')" :placeholder="$t('login.email')"
type="email" type="email"
@ -16,29 +16,29 @@
model="email" model="email"
name="email" name="email"
icon="envelope" icon="envelope"
/> />
<ds-space margin-botton="large"> <ds-space margin-botton="large">
<ds-text> <ds-text>
{{ $t('password-reset.form.description') }} {{ $t('password-reset.form.description') }}
</ds-text> </ds-text>
</ds-space> </ds-space>
<ds-button <ds-button
:disabled="disabled" :disabled="disabled"
:loading="$apollo.loading" :loading="$apollo.loading"
primary primary
fullwidth fullwidth
name="submit" name="submit"
type="submit" type="submit"
icon="envelope" icon="envelope"
> >
{{ $t('password-reset.form.submit') }} {{ $t('password-reset.form.submit') }}
</ds-button> </ds-button>
</ds-form> </ds-form>
<div v-else> <div v-else>
<transition name="ds-transition-fade"> <transition name="ds-transition-fade">
<ds-flex centered> <ds-flex centered>
<sweetalert-icon icon="success" /> <sweetalert-icon icon="success" />
</ds-flex> </ds-flex>
</transition> </transition>
<ds-text v-html="submitMessage" /> <ds-text v-html="submitMessage" />
</div> </div>
@ -96,8 +96,8 @@ export default {
this.submitted = true this.submitted = true
setTimeout(() => { setTimeout(() => {
this.$emit('submitted') this.$emit('handleSubmitted')
}, 1000) }, 3000)
} catch (err) { } catch (err) {
this.$toast.error(err.message) this.$toast.error(err.message)
} }

View File

@ -3,7 +3,8 @@
<ds-flex> <ds-flex>
<ds-flex-item :width="{ base: '100%' }" centered> <ds-flex-item :width="{ base: '100%' }" centered>
<ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered> <ds-space style="text-align: center;" margin-top="small" margin-bottom="xxx-small" centered>
<password-reset /> <password-reset @handleSubmitted="handleSubmitted" v-if="!submitted" />
<verify-code v-else />
</ds-space> </ds-space>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
@ -12,11 +13,23 @@
<script> <script>
import PasswordReset from '~/components/PasswordReset/PasswordReset' import PasswordReset from '~/components/PasswordReset/PasswordReset'
import VerifyCode from '~/components/PasswordReset/VerifyCode'
export default { export default {
layout: 'default', layout: 'default',
data() {
return {
submitted: false,
}
},
components: { components: {
PasswordReset, PasswordReset,
} VerifyCode,
},
methods: {
handleSubmitted() {
this.submitted = true
},
},
} }
</script> </script>