diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-08-30 07:39:31 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-08-30 07:39:31 +0200 |
commit | 2efdacb936aa239668122fa8a4edbcbe16f5807e (patch) | |
tree | 4f3e6537cdf480a7fe1bfc7eb6ad9b39527b32a6 /src/web | |
parent | Use the supported Python runtime. (diff) | |
download | newspipe-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.py | 6 |
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(): |