Commit 940eb642 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Add option to make sessions permanent

/close #116
parent 80d530d6
......@@ -1351,6 +1351,7 @@ def login():
user = user_manager.login(form.username.data, form.password.data)
if user is not None:
session["auth"] = security_manager.hash_user(user)
session.permanent = form.permanent.data
flash("Login successful, {}!".format(user.username), "alert-success")
return redirect(request.args.get("next") or url_for("index"))
else:
......
......@@ -102,6 +102,7 @@ class IPNetworkField(Field):
class LoginForm(FlaskForm):
username = StringField("Benutzer", validators=[InputRequired("Bitte gib deinen Benutzernamen ein.")])
password = PasswordField("Passwort", validators=[InputRequired("Bitte gib dein Passwort ein.")])
permanent = BooleanField("Eingeloggt bleiben?")
class ProtocolTypeForm(FlaskForm):
name = StringField("Name", validators=[InputRequired("Du musst einen Namen angeben.")])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment