From b12f5b8c12d0e6e83bc633a5811f8577b5ebf9ce Mon Sep 17 00:00:00 2001 From: "lengjs@wsidomidata.com" Date: Tue, 10 Jun 2025 14:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ACM=E3=80=91=20=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E5=8D=95=E7=82=B9=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/services/account_service.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/api/services/account_service.py b/api/services/account_service.py index 5c7c30e8f4..2a616da03c 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -176,6 +176,21 @@ class AccountService: return cast(Account, account) + @staticmethod + def authenticate_email(email: str, tenantId: str) -> None | Account: + account = db.session.query(Account).filter_by(email=email, target_tenant_id=tenantId).first() + if not account: + raise AccountNotFoundError() + + if account.status == AccountStatus.BANNED.value: + raise AccountLoginError("Account is banned.") + + if account.status == AccountStatus.PENDING.value: + account.status = AccountStatus.ACTIVE.value + account.initialized_at = datetime.now(UTC).replace(tzinfo=None) + + db.session.commit() + return cast(Account, account) @staticmethod def update_account_password(account, password, new_password):