Merge pull request #405 from ollama-webui/fix

fix: update user email issue
This commit is contained in:
Timothy Jaeryang Baek 2024-01-06 05:52:14 -05:00 committed by GitHub
commit c55c872867
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,8 +73,8 @@ async def update_user_by_id(
user = Users.get_user_by_id(user_id) user = Users.get_user_by_id(user_id)
if user: if user:
if form_data.email != user.email: if form_data.email.lower() != user.email:
email_user = Users.get_user_by_email(form_data.email) email_user = Users.get_user_by_email(form_data.email.lower())
if email_user: if email_user:
raise HTTPException( raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST, status_code=status.HTTP_400_BAD_REQUEST,
@ -86,12 +86,12 @@ async def update_user_by_id(
print(hashed) print(hashed)
Auths.update_user_password_by_id(user_id, hashed) Auths.update_user_password_by_id(user_id, hashed)
Auths.update_email_by_id(user_id, form_data.email) Auths.update_email_by_id(user_id, form_data.email.lower())
updated_user = Users.update_user_by_id( updated_user = Users.update_user_by_id(
user_id, user_id,
{ {
"name": form_data.name, "name": form_data.name,
"email": form_data.email, "email": form_data.email.lower(),
"profile_image_url": form_data.profile_image_url, "profile_image_url": form_data.profile_image_url,
}, },
) )