Browse Source

🐛 Fix allowing a user to update the email to the same email they already have (#696)

pull/13907/head
Alejandra 1 year ago
committed by GitHub
parent
commit
03eb49aa4d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      backend/app/api/routes/users.py

4
backend/app/api/routes/users.py

@ -82,7 +82,7 @@ def update_user_me(
if user_in.email:
existing_user = crud.get_user_by_email(session=session, email=user_in.email)
if existing_user:
if existing_user and existing_user.id != current_user.id:
raise HTTPException(
status_code=409, detail="User with this email already exists"
)
@ -184,7 +184,7 @@ def update_user(
)
if user_in.email:
existing_user = crud.get_user_by_email(session=session, email=user_in.email)
if existing_user:
if existing_user and existing_user.id != user_id:
raise HTTPException(
status_code=409, detail="User with this email already exists"
)

Loading…
Cancel
Save