27 lines
729 B
Plaintext
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
|