black
This commit is contained in:
parent
f79eb90d2a
commit
0cdd0b3b07
|
@ -41,15 +41,17 @@ def enter_sudo():
|
|||
"dashboard/enter_sudo.html", password_check_form=password_check_form
|
||||
)
|
||||
|
||||
|
||||
def sudo_required(f):
|
||||
@wraps(f)
|
||||
def wrap(*args, **kwargs):
|
||||
# Reset sudo mode in every 20s under dev mode
|
||||
SUDO_GAP = 900 if not DEBUG else 20
|
||||
if "sudo_time" not in session or (time() - int(session["sudo_time"])) > SUDO_GAP:
|
||||
return redirect(
|
||||
url_for("dashboard.enter_sudo", next=request.path)
|
||||
)
|
||||
if (
|
||||
"sudo_time" not in session
|
||||
or (time() - int(session["sudo_time"])) > SUDO_GAP
|
||||
):
|
||||
return redirect(url_for("dashboard.enter_sudo", next=request.path))
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return wrap
|
|
@ -16,6 +16,7 @@ from app.log import LOG
|
|||
from app.models import FIDO
|
||||
from app.dashboard.views.enter_sudo import sudo_required
|
||||
|
||||
|
||||
class FidoTokenForm(FlaskForm):
|
||||
sk_assertion = HiddenField("sk_assertion", validators=[validators.DataRequired()])
|
||||
|
||||
|
|
Loading…
Reference in a new issue