mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Add IP address and User-Agent to session if missing
This commit is contained in:
parent
49084d6561
commit
0924671330
1 changed files with 5 additions and 0 deletions
|
|
@ -352,6 +352,11 @@ def before_request():
|
|||
if current_user.is_authenticated:
|
||||
passed = True
|
||||
|
||||
if "ip" not in session:
|
||||
session["ip"] = request.remote_addr
|
||||
if "user_agent" not in session:
|
||||
session["user_agent"] = request.headers.get("User-Agent")
|
||||
|
||||
# Case not login page, keep on 2FA before any other access
|
||||
if not session.get("totp_validated", False) and bool(current_user.totp_secret) and "/totp" not in request.path:
|
||||
if not request.path.endswith("/login"):
|
||||
|
|
|
|||
Loading…
Reference in a new issue