mirror of
https://github.com/simple-login/app.git
synced 2024-11-18 14:43:32 +08:00
black
This commit is contained in:
parent
f79eb90d2a
commit
0cdd0b3b07
2 changed files with 9 additions and 6 deletions
|
@ -41,15 +41,17 @@ def enter_sudo():
|
||||||
"dashboard/enter_sudo.html", password_check_form=password_check_form
|
"dashboard/enter_sudo.html", password_check_form=password_check_form
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def sudo_required(f):
|
def sudo_required(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrap(*args, **kwargs):
|
def wrap(*args, **kwargs):
|
||||||
# Reset sudo mode in every 20s under dev mode
|
# Reset sudo mode in every 20s under dev mode
|
||||||
SUDO_GAP = 900 if not DEBUG else 20
|
SUDO_GAP = 900 if not DEBUG else 20
|
||||||
if "sudo_time" not in session or (time() - int(session["sudo_time"])) > SUDO_GAP:
|
if (
|
||||||
return redirect(
|
"sudo_time" not in session
|
||||||
url_for("dashboard.enter_sudo", next=request.path)
|
or (time() - int(session["sudo_time"])) > SUDO_GAP
|
||||||
)
|
):
|
||||||
|
return redirect(url_for("dashboard.enter_sudo", next=request.path))
|
||||||
return f(*args, **kwargs)
|
return f(*args, **kwargs)
|
||||||
|
|
||||||
return wrap
|
return wrap
|
|
@ -16,6 +16,7 @@ from app.log import LOG
|
||||||
from app.models import FIDO
|
from app.models import FIDO
|
||||||
from app.dashboard.views.enter_sudo import sudo_required
|
from app.dashboard.views.enter_sudo import sudo_required
|
||||||
|
|
||||||
|
|
||||||
class FidoTokenForm(FlaskForm):
|
class FidoTokenForm(FlaskForm):
|
||||||
sk_assertion = HiddenField("sk_assertion", validators=[validators.DataRequired()])
|
sk_assertion = HiddenField("sk_assertion", validators=[validators.DataRequired()])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue