From 163c0d7199ee9e6e58b58d6b11b352fc43a70704 Mon Sep 17 00:00:00 2001 From: girst Date: Mon, 15 Jun 2020 18:44:20 +0200 Subject: [PATCH] make token login persistent when a user logs in using the ?token= method, we save their session in a cookie, same as with regular login. --- app/common/user.py | 4 +++- app/reddit/templates/reddit.html.j2 | 2 +- app/youtube/templates/index.html.j2 | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/common/user.py b/app/common/user.py index 17366d1..fe363d2 100644 --- a/app/common/user.py +++ b/app/common/user.py @@ -59,7 +59,9 @@ def init_login(app): @login.request_loader def querytoken_auth(request): if request.args.get('token'): - return User.from_token(request.args.get('token')) + user = User.from_token(request.args.get('token')) + login_user(user) + return user return None usermgmt = Blueprint('usermgmt', __name__, diff --git a/app/reddit/templates/reddit.html.j2 b/app/reddit/templates/reddit.html.j2 index d9cc457..7f8fc67 100644 --- a/app/reddit/templates/reddit.html.j2 +++ b/app/reddit/templates/reddit.html.j2 @@ -35,7 +35,7 @@ {% endif %}
-Manage Subreddits +Manage Subreddits {% for subreddit in subreddits %} {{ "||" if loop.first else "|"}} /r/{{ subreddit }} diff --git a/app/youtube/templates/index.html.j2 b/app/youtube/templates/index.html.j2 index afe61c6..81611b7 100644 --- a/app/youtube/templates/index.html.j2 +++ b/app/youtube/templates/index.html.j2 @@ -24,11 +24,11 @@ {% if not rows|length %}no more results{% endif %} {% if page > 0 %} -newer | +newer | {% endif %} {% if rows|length %} -older +older {% endif %} -
Manage Subscriptions - | Reddit Feed +
Manage Subscriptions + | Reddit Feed -- 2.39.3