Skip to content

Commit dfa40af

Browse files
Do not update username while update current user to super user
1 parent b00ec0b commit dfa40af

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

backend/app/api/api_v1/extended/extend_auth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from typing import Any
2-
from fastapi import APIRouter, Depends, HTTPException, Query
2+
from fastapi import APIRouter, Depends, HTTPException
33
from sqlalchemy.orm import Session
44
from requests.exceptions import RequestException
55

@@ -81,8 +81,9 @@ def update_user_by_email(
8181
status_code=404,
8282
detail="A user with this email not found.",
8383
)
84-
user.email = user_in.email
85-
user.username = user_in.username
84+
# DO NOT UPDATE USERNAME IF USER EXIST
85+
# user.email = user_in.email
86+
# user.username = user.username or user_in.username
8687
user.is_active = user_in.is_active
8788
user.is_superuser = user_in.is_superuser
8889
db.commit()

0 commit comments

Comments
 (0)