This commit is contained in:
devStorm 2020-05-18 02:15:52 -07:00
parent f79eb90d2a
commit 0cdd0b3b07
No known key found for this signature in database
GPG key ID: D52E1B66F336AC57
2 changed files with 9 additions and 6 deletions

View file

@ -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
return wrap

View file

@ -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()])