Files
SMANAGE/_api_backup/TempLateAPI/GERP/API/TwoFactorAuthentication/Status.api
T
2026-06-16 11:55:14 +08:00

27 lines
729 B
Plaintext

from PDAPI import *
__metadata__ = {
"methods": ["GET"],
"blueprint": "GERP",
"permission": 1.0,
"attributes": [],
"limit": "10 per minute",
}
def HandleRequest(_CleanedData):
current_user = UGM.GetELTUser()
if not current_user:
return {"code": 401, "msg": "未登录"}, 401
existing = GERPUser2FA.query.filter(GERPUser2FA.UserUUID == current_user.UserUUID).first()
return {
"code": 0,
"data": {
"enabled": existing.IsEnabled == 1 if existing else False,
"verified": existing.Verified == 1 if existing else False,
"lastUsedAt": existing.LastUsedAt.isoformat() if existing and existing.LastUsedAt else None,
}
}, 200