mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch '1197-admin-interface-created-transactions-list' of https://github.com/gradido/gradido into 1197-admin-interface-created-transactions-list
This commit is contained in:
commit
f7af70625e
@ -323,5 +323,5 @@ async function hasActivatedEmail(email: string): Promise<boolean> {
|
|||||||
const user = await repository.findByEmail(email)
|
const user = await repository.findByEmail(email)
|
||||||
let emailActivate = false
|
let emailActivate = false
|
||||||
if (user) emailActivate = user.emailChecked
|
if (user) emailActivate = user.emailChecked
|
||||||
return emailActivate
|
return user ? user.emailChecked : false
|
||||||
}
|
}
|
||||||
|
|||||||
@ -251,6 +251,44 @@ describe('Login', () => {
|
|||||||
it('toasts an error message', () => {
|
it('toasts an error message', () => {
|
||||||
expect(toastErrorMock).toBeCalledWith('error.no-account')
|
expect(toastErrorMock).toBeCalledWith('error.no-account')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('login fails with "User email not validated"', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
apolloQueryMock.mockRejectedValue({
|
||||||
|
message: 'User email not validated',
|
||||||
|
})
|
||||||
|
wrapper = Wrapper()
|
||||||
|
jest.clearAllMocks()
|
||||||
|
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
|
||||||
|
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.find('form').trigger('submit')
|
||||||
|
await flushPromises()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('redirects to /thx/login', () => {
|
||||||
|
expect(mockRouterPush).toBeCalledWith('/thx/login')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('login fails with "User has no password set yet"', () => {
|
||||||
|
beforeEach(async () => {
|
||||||
|
apolloQueryMock.mockRejectedValue({
|
||||||
|
message: 'User has no password set yet',
|
||||||
|
})
|
||||||
|
wrapper = Wrapper()
|
||||||
|
jest.clearAllMocks()
|
||||||
|
await wrapper.find('input[placeholder="Email"]').setValue('user@example.org')
|
||||||
|
await wrapper.find('input[placeholder="form.password"]').setValue('1234')
|
||||||
|
await flushPromises()
|
||||||
|
await wrapper.find('form').trigger('submit')
|
||||||
|
await flushPromises()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('redirects to /reset/login', () => {
|
||||||
|
expect(mockRouterPush).toBeCalledWith('/reset/login')
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -105,10 +105,10 @@ export default {
|
|||||||
loader.hide()
|
loader.hide()
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
if (error.message.includes('No user with this credentials')) {
|
|
||||||
this.$toasted.global.error(this.$t('error.no-account'))
|
this.$toasted.global.error(this.$t('error.no-account'))
|
||||||
} else {
|
if (error.message.includes('User email not validated')) {
|
||||||
// : this.$t('error.no-email-verify')
|
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/login')
|
||||||
}
|
}
|
||||||
loader.hide()
|
loader.hide()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user