full-stack-fastapi-template icon indicating copy to clipboard operation
full-stack-fastapi-template copied to clipboard

update_user_me with another user's email not checked at backend

Open nocticron opened this issue 5 years ago • 0 comments

update_user_me endpoint function doesn't have a check if a user tries to update self email to another user's email. Database handles this correctly (by unique email constraint), but the service overall returns Error 500.

Trace:

sqlalchemy.exc.IntegrityError: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "ix_user_email"
DETAIL:  Key (email)=([email protected]) already exists.

Fix: check if another user with same as updating email exists in the system.

nocticron avatar Nov 16 '20 17:11 nocticron