mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Refactor PasswordForgotten site
This commit is contained in:
parent
29745204b2
commit
b65cd0fd03
@ -1,19 +1,27 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<div class="header py-7 py-lg-8 pt-lg-9">
|
<div class="header py-lg-6">
|
||||||
<b-container>
|
<b-container>
|
||||||
<div class="header-body text-center mb-7">
|
<div class="header-body text-center mb-7">
|
||||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||||
<p class="h1">{{ $t(displaySetup.headline) }}</p>
|
<p class="h1 test-message-headline">{{ $t(displaySetup.headline) }}</p>
|
||||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||||
<p class="h4">{{ $t(displaySetup.subtitle) }}</p>
|
<p class="h4 test-message-subtitle">{{ $t(displaySetup.subtitle) }}</p>
|
||||||
<hr />
|
<hr />
|
||||||
<b-button v-if="$route.params.code" :to="`/login/${$route.params.code}`">
|
<b-button
|
||||||
|
v-if="$route.params.code"
|
||||||
|
class="test-message-button"
|
||||||
|
:to="`/login/${$route.params.code}`"
|
||||||
|
>
|
||||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||||
{{ $t(displaySetup.button) }}
|
{{ $t(displaySetup.button) }}
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button v-else-if="displaySetup.linkTo" :to="displaySetup.linkTo">
|
<b-button
|
||||||
|
v-else-if="displaySetup.linkTo"
|
||||||
|
class="test-message-button"
|
||||||
|
:to="displaySetup.linkTo"
|
||||||
|
>
|
||||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||||
{{ $t(displaySetup.button) }}
|
{{ $t(displaySetup.button) }}
|
||||||
</b-button>
|
</b-button>
|
||||||
@ -26,13 +34,19 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const textFields = {
|
const textFields = {
|
||||||
forgotPassword: {
|
'forgot-password-success': {
|
||||||
headline: 'site.thx.title',
|
headline: 'site.thx.title',
|
||||||
subtitle: 'site.thx.email',
|
subtitle: 'site.thx.email',
|
||||||
button: 'login',
|
button: 'login',
|
||||||
linkTo: '/login',
|
linkTo: '/login',
|
||||||
},
|
},
|
||||||
resetPassword: {
|
'forgot-password-error': {
|
||||||
|
headline: 'site.thx.errorTitle',
|
||||||
|
subtitle: 'error.email-already-sent',
|
||||||
|
button: 'login',
|
||||||
|
linkTo: '/login',
|
||||||
|
},
|
||||||
|
'reset-password': {
|
||||||
headline: 'site.thx.title',
|
headline: 'site.thx.title',
|
||||||
subtitle: 'site.thx.reset',
|
subtitle: 'site.thx.reset',
|
||||||
button: 'login',
|
button: 'login',
|
||||||
@ -44,7 +58,7 @@ const textFields = {
|
|||||||
button: 'site.login.signin',
|
button: 'site.login.signin',
|
||||||
// linkTo: '/login',
|
// linkTo: '/login',
|
||||||
},
|
},
|
||||||
checkEmail: {
|
'check-email': {
|
||||||
headline: 'site.thx.title',
|
headline: 'site.thx.title',
|
||||||
subtitle: 'site.thx.checkEmail',
|
subtitle: 'site.thx.checkEmail',
|
||||||
button: 'login',
|
button: 'login',
|
||||||
@ -65,7 +79,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
displaySetup: textFields[this.kind]
|
displaySetup: textFields[this.kind],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -118,20 +118,25 @@ describe('ForgotPassword', () => {
|
|||||||
await flushPromises()
|
await flushPromises()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('toasts a standard error message', () => {
|
// Wolle it('toasts a standard error message', () => {
|
||||||
expect(toastErrorSpy).toBeCalledWith('error.email-already-sent')
|
// expect(toastErrorSpy).toBeCalledWith('error.email-already-sent')
|
||||||
|
// })
|
||||||
|
it('shows error message', () => {
|
||||||
|
expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.errorTitle')
|
||||||
|
expect(wrapper.find('.test-message-subtitle').text()).toBe('error.email-already-sent')
|
||||||
|
expect(wrapper.find('.test-message-button').text()).toBe('login')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('pushes to "/thx/forgotPassword"', () => {
|
// Wolle it('pushes to "/thx/forgotPassword"', () => {
|
||||||
expect(mockAPIcall).toBeCalledWith(
|
// expect(mockAPIcall).toBeCalledWith(
|
||||||
expect.objectContaining({
|
// expect.objectContaining({
|
||||||
variables: {
|
// variables: {
|
||||||
email: 'user@example.org',
|
// email: 'user@example.org',
|
||||||
},
|
// },
|
||||||
}),
|
// }),
|
||||||
)
|
// )
|
||||||
expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
|
// expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
|
||||||
})
|
// })
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('success', () => {
|
describe('success', () => {
|
||||||
@ -147,15 +152,20 @@ describe('ForgotPassword', () => {
|
|||||||
await flushPromises()
|
await flushPromises()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('pushes to "/thx/forgotPassword"', () => {
|
// it('pushes to "/thx/forgotPassword"', () => {
|
||||||
expect(mockAPIcall).toBeCalledWith(
|
// expect(mockAPIcall).toBeCalledWith(
|
||||||
expect.objectContaining({
|
// expect.objectContaining({
|
||||||
variables: {
|
// variables: {
|
||||||
email: 'user@example.org',
|
// email: 'user@example.org',
|
||||||
},
|
// },
|
||||||
}),
|
// }),
|
||||||
)
|
// )
|
||||||
expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
|
// expect(mockRouterPush).toHaveBeenCalledWith('/thx/forgotPassword')
|
||||||
|
// })
|
||||||
|
it('shows thx', () => {
|
||||||
|
expect(wrapper.find('.test-message-headline').text()).toBe('site.thx.title')
|
||||||
|
expect(wrapper.find('.test-message-subtitle').text()).toBe('site.thx.email')
|
||||||
|
expect(wrapper.find('.test-message-button').text()).toBe('login')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</b-container>
|
</b-container>
|
||||||
</div>
|
</div>
|
||||||
<b-container class="mt--8 p-1">
|
<b-container v-if="!showPageMessage" class="mt--8 p-1">
|
||||||
<b-row class="justify-content-center">
|
<b-row class="justify-content-center">
|
||||||
<b-col lg="6" md="8">
|
<b-col lg="6" md="8">
|
||||||
<b-card no-body class="border-0 gradido-custom-background">
|
<b-card no-body class="border-0 gradido-custom-background">
|
||||||
@ -36,8 +36,8 @@
|
|||||||
<router-link to="/login" class="mt-3">{{ $t('back') }}</router-link>
|
<router-link to="/login" class="mt-3">{{ $t('back') }}</router-link>
|
||||||
</div>
|
</div>
|
||||||
</b-container>
|
</b-container>
|
||||||
<b-container class="mt--8 p-1">
|
<b-container v-else class="mt--8 p-1">
|
||||||
<message kind="forgotPassword" />
|
<message :kind="success ? 'forgot-password-success' : 'forgot-password-error'" />
|
||||||
</b-container>
|
</b-container>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -54,11 +54,13 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
disable: 'disabled',
|
// Wolle disable: 'disabled',
|
||||||
form: {
|
form: {
|
||||||
email: '',
|
email: '',
|
||||||
},
|
},
|
||||||
subtitle: 'settings.password.subtitle',
|
subtitle: 'settings.password.subtitle',
|
||||||
|
showPageMessage: false,
|
||||||
|
success: null,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -71,15 +73,17 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.$router.push('/thx/forgotPassword')
|
this.showPageMessage = true
|
||||||
|
this.success = true
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
this.toastError(this.$t('error.email-already-sent'))
|
this.showPageMessage = true
|
||||||
this.$router.push('/thx/forgotPassword')
|
this.success = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
// Wolle: what shall happen here? change needed?
|
||||||
if (this.$route.params.comingFrom) {
|
if (this.$route.params.comingFrom) {
|
||||||
this.subtitle = 'settings.password.resend_subtitle'
|
this.subtitle = 'settings.password.resend_subtitle'
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user