unlock = user_info.get("unlock")
renew = user_info.get("renew")
permission_id = user_info.get("system_admin_id")
+ now = time()
user_data = self.db.get_one(
self.users_collection, {BaseTopic.id_field("users", uid): uid}
if role_assigned.get("permissions")["admin"]:
if role_assigned.get("permissions")["default"]:
user_data["_admin"]["retry_count"] = 0
- user_data["_admin"]["user_status"] = "active"
+ if now > user_data["_admin"]["account_expire_time"]:
+ user_data["_admin"]["user_status"] = "expired"
+ else:
+ user_data["_admin"]["user_status"] = "active"
unlock_state = True
break
if not unlock_state:
)
user_data["_admin"]["modified"] = present
user_data["_admin"]["account_expire_time"] = account_expire
- user_data["_admin"]["user_status"] = "active"
+ if (
+ user_data["_admin"]["retry_count"]
+ >= self.config["max_pwd_attempt"]
+ ):
+ user_data["_admin"]["user_status"] = "locked"
+ else:
+ user_data["_admin"]["user_status"] = "active"
renew_state = True
break
if not renew_state:
"salt": "560a5d51b1d64bb4b9cae0ccff3f1102",
"user_status": "locked",
"password_expire_time": 1667207552.2191815,
- "account_expire_time": 1674983552.2191815,
+ "account_expire_time": now + 60,
"retry_count": 5,
"last_token_time": 1667207552.2191815,
},