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

Additional PR in relation to User authentication ~ #83 #89

Merged
merged 2 commits into from
Oct 21, 2020
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
6 changes: 5 additions & 1 deletion accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
from allauth.account.signals import user_signed_up

from .lists import USER_TYPES_CHOICES, LMS_MODULES_CHOICES
import logging

# Initialise instance of a logger to handle error logging
logger = logging.getLogger(__name__)


class Profile(models.Model):
Expand Down Expand Up @@ -52,7 +56,7 @@ def save(self, *args, **kwargs):
self.slack_display_name = self.user.profile.slack_display_name
self.user_type = self.user.profile.user_type
self.current_lms_module = self.user.profile.current_lms_module

logger.exception(str(KeyError))
super(Profile, self).save(*args, **kwargs)

def __str__(self):
Expand Down
12 changes: 7 additions & 5 deletions templates/includes/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@
My Account
</a>
<div class="dropdown-menu" aria-labelledby="navbarAccount">
<a class="dropdown-item" href="#">Register</a>
<a class="dropdown-item" href="#">Login</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'profile' %}">My Profile</a>
<a class="dropdown-item" href="#">Logout</a>
{% if not user.is_authenticated %}
<a class="dropdown-item" href="{% url 'account_signup' %}">Register</a>
<a class="dropdown-item" href="{% url 'account_login' %}">Login</a>
{% else %}
<a class="dropdown-item" href="{% url 'profile' %}">My Profile</a>
<a class="dropdown-item" href="{% url 'account_logout' %}">Logout</a>
{% endif %}
</div>
</li>
</ul>
Expand Down