Merge pull request #3835 from omnivore-app/fix/guess-user-email
return UNKNOWN as error code if email exists when user signs up
This commit is contained in:
@ -37,7 +37,7 @@ export const createUser = async (input: {
|
||||
const existingUser = await userRepository.findByEmail(trimmedEmail)
|
||||
if (existingUser) {
|
||||
if (existingUser.profile) {
|
||||
return Promise.reject({ errorCode: SignupErrorCode.UserExists })
|
||||
return Promise.reject({ errorCode: SignupErrorCode.Unknown })
|
||||
}
|
||||
|
||||
// create profile if user exists but profile does not exist
|
||||
|
||||
@ -90,12 +90,12 @@ describe('auth router', () => {
|
||||
await deleteUser(user.id)
|
||||
})
|
||||
|
||||
it('redirects to sign up page with error code USER_EXISTS', async () => {
|
||||
it('redirects to sign up page with error code UNKNOWN', async () => {
|
||||
const res = await signupRequest(email, password, name, username).expect(
|
||||
302
|
||||
)
|
||||
expect(res.header.location).to.endWith(
|
||||
'/email-signup?errorCodes=USER_EXISTS'
|
||||
'/email-signup?errorCodes=UNKNOWN'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user