Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update use of User.is_authenticated #164

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading