Browse Source

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

tags/1.7.1
zyssyz123 3 months ago
parent
commit
de28bb1075
No account linked to committer's email address
2 changed files with 12 additions and 1 deletions
  1. 1
    1
      api/controllers/console/workspace/account.py
  2. 11
    0
      api/services/account_service.py

+ 1
- 1
api/controllers/console/workspace/account.py View File

if current_user.email != old_email: if current_user.email != old_email:
raise AccountNotFound() 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( AccountService.send_change_email_completed_notify_email(
email=args["new_email"], email=args["new_email"],

+ 11
- 0
api/services/account_service.py View File

db.session.commit() db.session.commit()
return account 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 @staticmethod
def update_login_info(account: Account, *, ip_address: str) -> None: def update_login_info(account: Account, *, ip_address: str) -> None:
"""Update last login time and ip""" """Update last login time and ip"""

Loading…
Cancel
Save