rename route for reset-password

This commit is contained in:
Moriz Wahl 2022-03-07 19:23:08 +01:00
parent 33fc918429
commit 574c1cf203
10 changed files with 23 additions and 21 deletions

View File

@ -158,7 +158,7 @@ describe('ForgotPassword', () => {
describe('comingFrom login', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('reset'))
wrapper = Wrapper(createMockObject('resetPassword'))
})
it('has another subtitle', () => {

View File

@ -42,7 +42,7 @@ import { sendResetPasswordEmail } from '@/graphql/queries'
import InputEmail from '@/components/Inputs/InputEmail'
const textFields = {
reset: {
resetPassword: {
headline: 'settings.password.reset',
subtitle: 'settings.password.resend_subtitle',
button: 'settings.password.send_now',

View File

@ -281,8 +281,8 @@ describe('Login', () => {
await flushPromises()
})
it('redirects to /reset/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset/login')
it('redirects to /reset-password/login', () => {
expect(mockRouterPush).toBeCalledWith('/reset-password/login')
})
})
})

View File

@ -109,7 +109,7 @@ export default {
if (error.message.includes('User email not validated')) {
this.$router.push('/thx/login')
} else if (error.message.includes('User has no password set yet')) {
this.$router.push('/reset/login')
this.$router.push('/reset-password/login')
}
loader.hide()
})

View File

@ -78,7 +78,7 @@ describe('ResetPassword', () => {
describe('Register header', () => {
describe('from reset', () => {
beforeEach(() => {
mocks.$route.path.mock = 'reset'
mocks.$route.path.mock = 'reset-password'
wrapper = Wrapper()
})
@ -156,8 +156,8 @@ describe('ResetPassword', () => {
expect(toastErrorSpy).toHaveBeenCalledWith('...Code is older than 10 minutes')
})
it('router pushes to /forgot-password/reset', () => {
expect(routerPushMock).toHaveBeenCalledWith('/forgot-password/reset')
it('router pushes to /forgot-password/resetPassword', () => {
expect(routerPushMock).toHaveBeenCalledWith('/forgot-password/resetPassword')
})
})
@ -204,9 +204,9 @@ describe('ResetPassword', () => {
})
})
describe('server response with success on /reset', () => {
describe('server response with success on /reset-password', () => {
beforeEach(async () => {
mocks.$route.path.mock = 'reset'
mocks.$route.path.mock = 'reset-password'
wrapper = Wrapper()
apolloMutationMock.mockResolvedValue({
data: {
@ -219,8 +219,8 @@ describe('ResetPassword', () => {
await flushPromises()
})
it('redirects to "/thx/reset"', () => {
expect(routerPushMock).toHaveBeenCalledWith('/thx/reset')
it('redirects to "/thx/resetPassword"', () => {
expect(routerPushMock).toHaveBeenCalledWith('/thx/resetPassword')
})
})
})

View File

@ -95,20 +95,20 @@ export default {
if (this.$route.path.includes('checkEmail')) {
this.$router.push('/thx/checkEmail')
} else {
this.$router.push('/thx/reset')
this.$router.push('/thx/resetPassword')
}
})
.catch((error) => {
this.toastError(error.message)
if (error.message.includes('Code is older than 10 minutes'))
this.$router.push('/forgot-password/reset')
this.$router.push('/forgot-password/resetPassword')
})
},
setDisplaySetup() {
if (this.$route.path.includes('checkEmail')) {
this.displaySetup = textFields.checkEmail
}
if (this.$route.path.includes('reset')) {
if (this.$route.path.includes('reset-password')) {
this.displaySetup = textFields.reset
}
},

View File

@ -53,9 +53,9 @@ describe('Thx', () => {
})
})
describe('coming from /reset', () => {
describe('coming from /reset-password', () => {
beforeEach(() => {
wrapper = Wrapper(createMockObject('reset'))
wrapper = Wrapper(createMockObject('resetPassword'))
})
it('renders the thanks text', () => {

View File

@ -24,7 +24,7 @@ const textFields = {
button: 'login',
linkTo: '/login',
},
reset: {
resetPassword: {
headline: 'site.thx.title',
subtitle: 'site.thx.reset',
button: 'login',

View File

@ -166,9 +166,11 @@ describe('router', () => {
})
})
describe('reset', () => {
describe('reset password', () => {
it('loads the "ResetPassword" component', async () => {
const component = await routes.find((r) => r.path === '/reset/:optin').component()
const component = await routes
.find((r) => r.path === '/reset-password/:optin')
.component()
expect(component.default.name).toBe('ResetPassword')
})
})

View File

@ -75,7 +75,7 @@ const routes = [
component: () => import('@/pages/SelectCommunity.vue'),
},
{
path: '/reset/:optin',
path: '/reset-password/:optin',
component: () => import('@/pages/ResetPassword.vue'),
},
{