fix: 注销和删除会停掉学习,并去掉全员状态接口

This commit is contained in:
2026-11-16 02:40:05 +08:00
parent 08e5a1b849
commit 42f2b457a0
6 changed files with 29 additions and 11 deletions
+7 -3
View File
@@ -345,11 +345,11 @@ def _live(db: Session, employee_id: str, client_factory, read):
from euniv.proxy_pool import MAX_SWITCHES
account = db.get(Account, employee_id)
if account is None:
if account is None or not account.credential_cipher:
raise RuntimeError("请先登录")
credential = json.loads(decrypt_secret(account.credential_cipher)) if account.credential_cipher else {}
credential = json.loads(decrypt_secret(account.credential_cipher))
attempts = _auto_attempts(db)
password = decrypt_secret(account.password_cipher)
password = decrypt_secret(account.password_cipher) if account.password_cipher else ""
last_exc: BaseException | None = None
for _ in range(MAX_SWITCHES + 1):
client = _client(client_factory, employee_id, password, account)
@@ -401,8 +401,12 @@ def revoke_credential(db: Session, employee_id: str) -> None:
if account is None:
return
account.credential_cipher = ""
account.password_cipher = ""
account.sessions_valid_after = datetime.now(timezone.utc)
db.commit()
from euniv.autostudy import stop_account
stop_account(employee_id)
def refresh_stored_credentials(client_factory=EunivClient) -> None: