From 13c0d30a8fb734c544b8de77b36527118ada880d Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 3 Apr 2023 20:00:13 +0200 Subject: [PATCH] Update login Removed not needed parameters for task status --- cps/MyLoginManager.py | 6 +++--- cps/admin.py | 6 ++++-- cps/tasks_status.py | 4 +--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cps/MyLoginManager.py b/cps/MyLoginManager.py index 2587e1a9..39e7e4a5 100644 --- a/cps/MyLoginManager.py +++ b/cps/MyLoginManager.py @@ -28,10 +28,10 @@ from flask_login.signals import user_loaded_from_cookie class MyLoginManager(LoginManager): def _session_protection_failed(self): - _session = session._get_current_object() + sess = session._get_current_object() ident = self._session_identifier_generator() - if(_session and not (len(_session) == 1 - and _session.get('csrf_token', None))) and ident != _session.get('_id', None): + if(sess and not (len(sess) == 1 + and sess.get('csrf_token', None))) and ident != sess.get('_id', None): return super(). _session_protection_failed() return False diff --git a/cps/admin.py b/cps/admin.py index 20c58aac..82fc196e 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -101,10 +101,12 @@ def admin_required(f): @admi.before_app_request def before_request(): - if not ub.check_user_session(current_user.id, flask_session.get('_id')) and 'opds' not in request.path: + if not ub.check_user_session(current_user.id, + flask_session.get('_id')) and 'opds' not in request.path \ + and config.config_session == 1: logout_user() g.constants = constants - g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION','') + g.google_site_verification = os.getenv('GOOGLE_SITE_VERIFICATION', '') g.allow_registration = config.config_public_reg g.allow_anonymous = config.config_anonbrowse g.allow_upload = config.config_uploading diff --git a/cps/tasks_status.py b/cps/tasks_status.py index 7043483c..fc3c9914 100644 --- a/cps/tasks_status.py +++ b/cps/tasks_status.py @@ -43,9 +43,7 @@ def get_email_status_json(): @login_required def get_tasks_status(): # if current user admin, show all email, otherwise only own emails - tasks = WorkerThread.get_instance().tasks - answer = render_task_status(tasks) - return render_title_template('tasks.html', entries=answer, title=_("Tasks"), page="tasks") + return render_title_template('tasks.html', title=_("Tasks"), page="tasks") # helper function to apply localize status information in tasklist entries