From 0cdd0b3b07bceaa332a10595c4d86068196c73c3 Mon Sep 17 00:00:00 2001 From: devStorm <59678453+developStorm@users.noreply.github.com> Date: Mon, 18 May 2020 02:15:52 -0700 Subject: [PATCH] black --- app/dashboard/views/enter_sudo.py | 14 ++++++++------ app/dashboard/views/fido_setup.py | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/dashboard/views/enter_sudo.py b/app/dashboard/views/enter_sudo.py index 0e08dd42..4cbfe25e 100644 --- a/app/dashboard/views/enter_sudo.py +++ b/app/dashboard/views/enter_sudo.py @@ -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 \ No newline at end of file + + return wrap diff --git a/app/dashboard/views/fido_setup.py b/app/dashboard/views/fido_setup.py index 9107c146..53e8b175 100644 --- a/app/dashboard/views/fido_setup.py +++ b/app/dashboard/views/fido_setup.py @@ -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()])