Skip to content

Commit

Permalink
Additional PR in relation to User authentication ~ #83 (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
auxfuse committed Oct 21, 2020
1 parent c3d01ca commit 810f7e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
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

0 comments on commit 810f7e4

Please sign in to comment.