aboutsummaryrefslogtreecommitdiff
path: root/src/web
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-08-30 07:39:31 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-08-30 07:39:31 +0200
commit2efdacb936aa239668122fa8a4edbcbe16f5807e (patch)
tree4f3e6537cdf480a7fe1bfc7eb6ad9b39527b32a6 /src/web
parentUse the supported Python runtime. (diff)
downloadnewspipe-2efdacb936aa239668122fa8a4edbcbe16f5807e.tar.gz
newspipe-2efdacb936aa239668122fa8a4edbcbe16f5807e.tar.bz2
newspipe-2efdacb936aa239668122fa8a4edbcbe16f5807e.zip
update last_seen after each request.
Diffstat (limited to 'src/web')
-rw-r--r--src/web/views/session_mgmt.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/web/views/session_mgmt.py b/src/web/views/session_mgmt.py
index 876efd3d..febb3f13 100644
--- a/src/web/views/session_mgmt.py
+++ b/src/web/views/session_mgmt.py
@@ -1,6 +1,7 @@
import json
import logging
+from datetime import datetime
from werkzeug import generate_password_hash
from werkzeug.exceptions import NotFound
from flask import (render_template, flash, session, request,
@@ -47,6 +48,11 @@ def load_user(user_id):
return UserController(user_id, ignore_context=True).get(
id=user_id, is_active=True)
+@current_app.before_request
+def before_request():
+ if current_user.is_authenticated:
+ UserController(current_user.id).update(
+ {'id': current_user.id}, {'last_seen': datetime.utcnow()})
@current_app.route('/login', methods=['GET', 'POST'])
def login():
bgstack15