fix: 注销和删除与凭证刷新共用同一把锁

This commit is contained in:
2026-11-16 17:15:55 +08:00
parent 95e9355dc0
commit 8fe0e729ea
2 changed files with 15 additions and 12 deletions
+9 -7
View File
@@ -539,13 +539,15 @@ def _live(db: Session, employee_id: str, client_factory, read):
def revoke_credential(db: Session, employee_id: str) -> None:
account = db.get(Account, employee_id)
if account is None:
return
account.credential_cipher = ""
account.password_cipher = ""
account.sessions_valid_after = datetime.now(timezone.utc)
db.commit()
with _credential_lock(employee_id):
account = db.get(Account, employee_id)
if account is None:
return
db.refresh(account)
account.credential_cipher = ""
account.password_cipher = ""
account.sessions_valid_after = datetime.now(timezone.utc)
db.commit()
from euniv.autostudy import stop_account
from euniv.study_push import close_account