From 5fc22acf0f288368a734d610ca509775641583cb Mon Sep 17 00:00:00 2001 From: Soline Date: Wed, 23 Aug 2023 13:42:57 -0400 Subject: [PATCH] Update use of User.is_authenticated --- clockwork_web/login_routes.py | 2 +- clockwork_web/server_app.py | 4 ++-- clockwork_web/templates/base.html | 5 +++-- clockwork_web/user.py | 3 +++ 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/clockwork_web/login_routes.py b/clockwork_web/login_routes.py index 61ab559c..2244d4c7 100644 --- a/clockwork_web/login_routes.py +++ b/clockwork_web/login_routes.py @@ -206,7 +206,7 @@ def route_callback(): from flask import current_app current_app.logger.debug( - "called login_user(user) for user with email %s, user.is_authenticated is %s", + "called login_user(user) for user with email %s, user.is_authenticated() is %s", user.mila_email_username, user.is_authenticated(), ) diff --git a/clockwork_web/server_app.py b/clockwork_web/server_app.py index b6deabd5..9604c811 100644 --- a/clockwork_web/server_app.py +++ b/clockwork_web/server_app.py @@ -151,7 +151,7 @@ def have_same_users(user1: str, user2: str): @babel.localeselector def get_locale(): # If the user is authenticated - if current_user.is_authenticated: + if current_user.is_authenticated(): return current_user.get_language() # If the user is not authenticated @@ -250,7 +250,7 @@ def index(): where people can click on the "login" button on the web interface. """ - if current_user.is_authenticated: + if current_user.is_authenticated(): app.logger.debug("in route for '/'; redirecting to jobs/") return redirect("jobs/") else: diff --git a/clockwork_web/templates/base.html b/clockwork_web/templates/base.html index bb3fd963..9bb8d975 100644 --- a/clockwork_web/templates/base.html +++ b/clockwork_web/templates/base.html @@ -75,7 +75,7 @@

{% endif %} - + {% if current_user.is_authenticated() %}
+ {% endif %}
{% if mila_email_username: %} @@ -130,7 +131,7 @@

{% block form %} - {% if request.path != '/jobs/dashboard' and current_user.is_authenticated %} + {% if request.path != '/jobs/dashboard' and current_user.is_authenticated() %}
diff --git a/clockwork_web/user.py b/clockwork_web/user.py index 80c5ce97..8261a0ab 100644 --- a/clockwork_web/user.py +++ b/clockwork_web/user.py @@ -350,3 +350,6 @@ def get_web_settings(self): A dictionary presenting the default web settings. """ return self.web_settings + + def is_authenticated(self): + return False