Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: changed email login use oauth will create an new account (#23057)

zyssyz123de28bb1075f7
diff --git a/api/controllers/console/workspace/account.py b/api/controllers/console/workspace/account.py
index 45513c368de..3670bac139d 100644
--- a/api/controllers/console/workspace/account.py
+++ b/api/controllers/console/workspace/account.py
@@ -496,7 +496,7 @@ class ChangeEmailResetApi(Resource):
if current_user.email != old_email:
raise AccountNotFound()
- updated_account = AccountService.update_account(current_user, email=args["new_email"])
+ updated_account = AccountService.update_account_email(current_user, email=args["new_email"])
AccountService.send_change_email_completed_notify_email(
email=args["new_email"],
diff --git a/api/services/account_service.py b/api/services/account_service.py
index 34b3ce05439..1cce8e67a4c 100644
--- a/api/services/account_service.py
+++ b/api/services/account_service.py
@@ -355,6 +355,17 @@ class AccountService:
db.session.commit()
return account
+ @staticmethod
+ def update_account_email(account: Account, email: str) -> Account:
+ """Update account email"""
+ account.email = email
+ account_integrate = db.session.query(AccountIntegrate).filter_by(account_id=account.id).first()
+ if account_integrate:
+ db.session.delete(account_integrate)
+ db.session.add(account)
+ db.session.commit()
+ return account
+
@staticmethod
def update_login_info(account: Account, *, ip_address: str) -> None:
"""Update last login time and ip"""