bugfix
This commit is contained in:
parent
f6027788b2
commit
12663a37e0
@ -12,6 +12,10 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
r = await sor.sqlExe('select * from users where username=${username}$', ns.copy())
|
r = await sor.sqlExe('select * from users where username=${username}$', ns.copy())
|
||||||
if len(r) == 0:
|
if len(r) == 0:
|
||||||
return {
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"data": {
|
||||||
|
"message": "user name or password error"
|
||||||
|
},
|
||||||
"widgettype":"Error",
|
"widgettype":"Error",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
@ -30,6 +34,10 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
elapsed = (datetime.datetime.now() - stored).total_seconds()
|
elapsed = (datetime.datetime.now() - stored).total_seconds()
|
||||||
if elapsed < 300:
|
if elapsed < 300:
|
||||||
return {
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"data": {
|
||||||
|
"message": "Account locked due to too many failed login attempts. Please try again in 5 minutes."
|
||||||
|
},
|
||||||
"widgettype":"Error",
|
"widgettype":"Error",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":5,
|
"timeout":5,
|
||||||
@ -64,6 +72,10 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
else:
|
else:
|
||||||
msg = f"user name or password error ({3 - new_fail_count} attempts remaining)"
|
msg = f"user name or password error ({3 - new_fail_count} attempts remaining)"
|
||||||
return {
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"data": {
|
||||||
|
"message": msg
|
||||||
|
},
|
||||||
"widgettype":"Error",
|
"widgettype":"Error",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
@ -81,6 +93,8 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
""", {'id': user.id, 'now': now_str})
|
""", {'id': user.id, 'now': now_str})
|
||||||
await remember_user(r[0].id, username=r[0].username, userorgid=r[0].orgid)
|
await remember_user(r[0].id, username=r[0].username, userorgid=r[0].orgid)
|
||||||
return {
|
return {
|
||||||
|
"status": "ok",
|
||||||
|
"data": r[0],
|
||||||
"widgettype":"Message",
|
"widgettype":"Message",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
@ -109,6 +123,11 @@ async with db.sqlorContext(dbname) as sor:
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
"status": "error",
|
||||||
|
"data": {
|
||||||
|
"message": "system error"
|
||||||
|
},
|
||||||
|
|
||||||
"widgettype":"Error",
|
"widgettype":"Error",
|
||||||
"options":{
|
"options":{
|
||||||
"timeout":3,
|
"timeout":3,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user