From 7ad6c32acb0a62a8f78e82832da2527a8096bbdb Mon Sep 17 00:00:00 2001 From: Joe <1264204425@qq.com> Date: Fri, 27 Sep 2024 15:15:10 +0800 Subject: [PATCH] feat: auto update user status --- api/services/account_service.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/api/services/account_service.py b/api/services/account_service.py index 9762b896c2..8983e047ef 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -248,6 +248,9 @@ class AccountService: if ip_address: AccountService.update_last_login(account, ip_address=ip_address) exp = timedelta(days=30) + if account.status == AccountStatus.PENDING.value: + account.status = AccountStatus.ACTIVE.value + db.session.commit() token = AccountService.get_account_jwt_token(account, exp=exp) redis_client.set(_get_login_cache_key(account_id=account.id, token=token), "1", ex=int(exp.total_seconds())) return token