fix(rbac): 账户锁定场景补 login_fail 审计(result=locked)
up_login.dspy 锁定分支(fail_count>=3 且 5分钟内)之前直接 return,未写审计。 补 _audit_login(..., 'login_fail', 'locked'),补全失败登录审计三路径: 用户不存在/密码错误/账户锁定。
This commit is contained in:
parent
15e27968da
commit
2966993088
@ -46,11 +46,12 @@ async with db.sqlorContext(dbname) as sor:
|
||||
stored = datetime.datetime.strptime(str(last_fail), '%Y-%m-%d %H:%M:%S')
|
||||
elapsed = (datetime.datetime.now() - stored).total_seconds()
|
||||
if elapsed < 300:
|
||||
await _audit_login(sor, user.id, ns['username'], 'login_fail', 'locked')
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "Account locked due to too many failed login attempts. Please try again in 5 minutes."
|
||||
},
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "Account locked due to too many failed login attempts. Please try again in 5 minutes."
|
||||
},
|
||||
"widgettype":"Error",
|
||||
"options":{
|
||||
"timeout":5,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user