inputlogic / django-api-starter

Boilerplate for starting Django DRF / API projects
2 stars 0 forks source link

Calling signup with an existing email causes 500 error #70

Closed eweisner1973 closed 4 years ago

eweisner1973 commented 4 years ago

This is a weird one I that was caught when experimenting with letter case in the email address.

Endpoint: {{url}}/auth/signup

To duplicate:

Create a user: Request body: { "email": "tester@inputlogic.ca", "first_name": "Test", "last_name": "User", "password": "superduper" }

Make the exact same call again and note that calling signup with the same all lowercase email address as was used in the create, causes the expected 400 status response: { "email": [ "user with this email address already exists." ] }

Make the same call again, but use a capital in the email address. Request body: { "email": "Tester@inputlogic.ca", "first_name": "Test", "last_name": "User", "password": "superduper" }

This will yield a 500 response: IntegrityError at /auth/signup duplicate key value violates unique constraint "user_user_email_key" DETAIL: Key (email)=(tester@inputlogic.ca) already exists.