mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Remove thx page
This commit is contained in:
parent
eb34a9f6df
commit
4091413847
@ -45,7 +45,6 @@ module.exports = {
|
||||
extensions: ['.js', '.vue'],
|
||||
// TODO: remove ignores
|
||||
ignores: [
|
||||
'/site.thx./',
|
||||
'/form./',
|
||||
'/time./',
|
||||
'/decay.types./',
|
||||
|
||||
@ -245,11 +245,9 @@
|
||||
"activateEmail": "Dein Konto wurde noch nicht aktiviert. Bitte überprüfe deine E-Mail und klicke den Aktivierungslink oder fordere einen neuen Aktivierungslink über die Password Reset Seite.",
|
||||
"checkEmail": "Deine E-Mail wurde erfolgreich verifiziert. Du kannst dich jetzt anmelden.",
|
||||
"email": "Wir haben dir eine E-Mail gesendet.",
|
||||
"emailActivated": "Danke dass Du deine E-Mail bestätigt hast.",
|
||||
"errorTitle": "Achtung!",
|
||||
"register": "Du bist jetzt registriert, bitte überprüfe deine Emails und klicke auf den Aktivierungslink.",
|
||||
"reset": "Dein Passwort wurde geändert.",
|
||||
"resetPassword": "Den Code den Du genutzt hast ist zu alt bitte fordere ein neuen über die Passwort Reset Seite an.",
|
||||
"title": "Danke!",
|
||||
"unsetPassword": "Dein Passwort wurde noch nicht gesetzt. Bitte setze es neu."
|
||||
}
|
||||
|
||||
@ -245,11 +245,9 @@
|
||||
"activateEmail": "Your account has not been activated yet. Please check your emails and click the activation link or order a new activation link over the password reset page.",
|
||||
"checkEmail": "Your email has been successfully verified. You can sign in now.",
|
||||
"email": "We have sent you an email.",
|
||||
"emailActivated": "Thank you your email has been activated.",
|
||||
"errorTitle": "Attention!",
|
||||
"register": "You are registered now, please check your emails and click the activation link.",
|
||||
"reset": "Your password has been changed.",
|
||||
"resetPassword": "The code you used was to old please order a new on over the password reset page.",
|
||||
"title": "Thank you!",
|
||||
"unsetPassword": "Your password has not been set yet. Please set it again."
|
||||
}
|
||||
|
||||
@ -1,101 +0,0 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import Thx from './thx'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const createMockObject = (comingFrom) => {
|
||||
return {
|
||||
$t: jest.fn((t) => t),
|
||||
$route: {
|
||||
params: {
|
||||
comingFrom,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
describe('Thx', () => {
|
||||
let wrapper
|
||||
|
||||
const Wrapper = (mocks) => {
|
||||
return mount(Thx, { localVue, mocks })
|
||||
}
|
||||
|
||||
describe('mount', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper(createMockObject('forgotPassword'))
|
||||
})
|
||||
|
||||
it('renders the thx page', () => {
|
||||
expect(wrapper.find('div.header').exists()).toBeTruthy()
|
||||
})
|
||||
|
||||
it('renders the title', () => {
|
||||
expect(wrapper.find('p.h1').text()).toBe('site.thx.title')
|
||||
})
|
||||
})
|
||||
|
||||
describe('coming from /forgot-password', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper(createMockObject('forgotPassword'))
|
||||
})
|
||||
|
||||
it('renders the thanks text', () => {
|
||||
expect(wrapper.find('p.h4').text()).toBe('site.thx.email')
|
||||
})
|
||||
|
||||
it('renders the thanks redirect button', () => {
|
||||
expect(wrapper.find('a.btn').text()).toBe('login')
|
||||
})
|
||||
|
||||
it('links the redirect button to /login', () => {
|
||||
expect(wrapper.find('a.btn').attributes('href')).toBe('/login')
|
||||
})
|
||||
})
|
||||
|
||||
describe('coming from /reset-password', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper(createMockObject('resetPassword'))
|
||||
})
|
||||
|
||||
it('renders the thanks text', () => {
|
||||
expect(wrapper.find('p.h4').text()).toBe('site.thx.reset')
|
||||
})
|
||||
|
||||
it('renders the thanks redirect button', () => {
|
||||
expect(wrapper.find('a.btn').text()).toBe('login')
|
||||
})
|
||||
|
||||
it('links the redirect button to /login', () => {
|
||||
expect(wrapper.find('a.btn').attributes('href')).toBe('/login')
|
||||
})
|
||||
})
|
||||
|
||||
describe('coming from /register', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper(createMockObject('register'))
|
||||
})
|
||||
|
||||
it('renders the thanks text', () => {
|
||||
expect(wrapper.find('p.h4').text()).toBe('site.thx.register')
|
||||
})
|
||||
})
|
||||
|
||||
describe('coming from /login', () => {
|
||||
beforeEach(() => {
|
||||
wrapper = Wrapper(createMockObject('login'))
|
||||
})
|
||||
|
||||
it('renders the thanks text', () => {
|
||||
expect(wrapper.find('p.h4').text()).toBe('site.thx.activateEmail')
|
||||
})
|
||||
|
||||
it('renders the thanks redirect button', () => {
|
||||
expect(wrapper.find('a.btn').text()).toBe('settings.password.reset')
|
||||
})
|
||||
|
||||
it('links the redirect button to /forgot-password', () => {
|
||||
expect(wrapper.find('a.btn').attributes('href')).toBe('/forgot-password')
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -1,76 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Header -->
|
||||
<div class="header py-7 py-lg-8 pt-lg-9">
|
||||
<b-container>
|
||||
<div class="header-body text-center mb-7">
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
<p class="h1">{{ $t(displaySetup.headline) }}</p>
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
<p class="h4">{{ $t(displaySetup.subtitle) }}</p>
|
||||
<hr />
|
||||
<b-button v-if="$route.params.code" :to="`/login/${$route.params.code}`">
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
{{ $t(displaySetup.button) }}
|
||||
</b-button>
|
||||
<b-button v-else-if="displaySetup.linkTo" :to="displaySetup.linkTo">
|
||||
<!-- eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys-->
|
||||
{{ $t(displaySetup.button) }}
|
||||
</b-button>
|
||||
</div>
|
||||
</b-container>
|
||||
</div>
|
||||
<!-- Page content -->
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
const textFields = {
|
||||
forgotPassword: {
|
||||
headline: 'site.thx.title',
|
||||
subtitle: 'site.thx.email',
|
||||
button: 'login',
|
||||
linkTo: '/login',
|
||||
},
|
||||
resetPassword: {
|
||||
headline: 'site.thx.title',
|
||||
subtitle: 'site.thx.reset',
|
||||
button: 'login',
|
||||
linkTo: '/login',
|
||||
},
|
||||
register: {
|
||||
headline: 'site.thx.title',
|
||||
subtitle: 'site.thx.register',
|
||||
button: 'signin',
|
||||
// linkTo: '/login',
|
||||
},
|
||||
checkEmail: {
|
||||
headline: 'site.thx.title',
|
||||
subtitle: 'site.thx.checkEmail',
|
||||
button: 'login',
|
||||
linkTo: '/login',
|
||||
},
|
||||
login: {
|
||||
headline: 'site.thx.errorTitle',
|
||||
subtitle: 'site.thx.activateEmail',
|
||||
button: 'settings.password.reset',
|
||||
linkTo: '/forgot-password',
|
||||
},
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'Thx',
|
||||
data() {
|
||||
return {
|
||||
displaySetup: {},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setDisplaySetup(from) {
|
||||
this.displaySetup = textFields[this.$route.params.comingFrom]
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.setDisplaySetup()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@ -49,8 +49,8 @@ describe('router', () => {
|
||||
expect(routes.find((r) => r.path === '/').redirect()).toEqual({ path: '/login' })
|
||||
})
|
||||
|
||||
it('has seventeen routes defined', () => {
|
||||
expect(routes).toHaveLength(17)
|
||||
it('has sixteen routes defined', () => {
|
||||
expect(routes).toHaveLength(16)
|
||||
})
|
||||
|
||||
describe('overview', () => {
|
||||
@ -111,31 +111,6 @@ describe('router', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('thx', () => {
|
||||
const thx = routes.find((r) => r.path === '/thx/:comingFrom/:code?')
|
||||
|
||||
it('loads the "Thx" page', async () => {
|
||||
const component = await thx.component()
|
||||
expect(component.default.name).toBe('Thx')
|
||||
})
|
||||
|
||||
describe('beforeEnter', () => {
|
||||
const beforeEnter = thx.beforeEnter
|
||||
const next = jest.fn()
|
||||
|
||||
it('redirects to login when not coming from a valid page', () => {
|
||||
beforeEnter({}, { path: '' }, next)
|
||||
expect(next).toBeCalledWith({ path: '/login' })
|
||||
})
|
||||
|
||||
it('enters the page when coming from a valid page', () => {
|
||||
jest.resetAllMocks()
|
||||
beforeEnter({}, { path: '/forgot-password' }, next)
|
||||
expect(next).toBeCalledWith()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('forgot password', () => {
|
||||
it('loads the "ForgotPassword" page', async () => {
|
||||
const component = await routes.find((r) => r.path === '/forgot-password').component()
|
||||
|
||||
@ -46,18 +46,6 @@ const routes = [
|
||||
path: '/register/:code?',
|
||||
component: () => import('@/pages/Register.vue'),
|
||||
},
|
||||
{
|
||||
path: '/thx/:comingFrom/:code?',
|
||||
component: () => import('@/pages/thx.vue'),
|
||||
beforeEnter: (to, from, next) => {
|
||||
const validFrom = ['forgot-password', 'reset-password', 'register', 'login', 'checkEmail']
|
||||
if (!validFrom.includes(from.path.split('/')[1])) {
|
||||
next({ path: '/login' })
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/forgot-password',
|
||||
component: () => import('@/pages/ForgotPassword.vue'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user