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:
Jackson Harper
2024-04-24 16:06:46 -07:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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'
)
})
})