Skip to content

Commit

Permalink
Update use of User.is_authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
soline-b committed Aug 23, 2023
1 parent a35e951 commit 5fc22ac
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion clockwork_web/login_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
)
Expand Down
4 changes: 2 additions & 2 deletions clockwork_web/server_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions clockwork_web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h4><span></span></h4>
{% endif %}
</a>
</div>

{% if current_user.is_authenticated() %}
<div class="col">
<nav class="navbar-expand-lg">
<div class="container-fluid">
Expand Down Expand Up @@ -110,6 +110,7 @@ <h4><span></span></h4>
</div>
</nav>
</div>
{% endif %}
<div class="col login">
<!-- TODO : add a conditional here in the template -->
{% if mila_email_username: %}
Expand All @@ -130,7 +131,7 @@ <h4><span></span></h4>
</div>

{% block form %}
{% if request.path != '/jobs/dashboard' and current_user.is_authenticated %}
{% if request.path != '/jobs/dashboard' and current_user.is_authenticated() %}
<!-- Search jobs form -->
<div id="formBlock">
<div class="search_button formCollapse {{ 'collapse' if request.path != '/jobs/search' }} {{ 'show' if request.path == '/jobs/search' }}" id="mainCollapse">
Expand Down
3 changes: 3 additions & 0 deletions clockwork_web/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5fc22ac

Please sign in to comment.