diff --git a/community/community/settings.py b/community/community/settings.py
index 696782c..aaa9610 100644
--- a/community/community/settings.py
+++ b/community/community/settings.py
@@ -124,3 +124,4 @@ STATIC_URL = '/static/'
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
+LOGOUT_REDIRECT_URL = '/'
diff --git a/community/forum/templates/navbar.html b/community/forum/templates/navbar.html
index 28321dc..dca3af5 100644
--- a/community/forum/templates/navbar.html
+++ b/community/forum/templates/navbar.html
@@ -23,7 +23,7 @@
@@ -27,9 +26,10 @@
{{ form.password }}
- {{ form.username.errors }}
+ {{ form.non_field_errors }}
+
diff --git a/community/user_profile/urls.py b/community/user_profile/urls.py
index fdca392..e16783d 100644
--- a/community/user_profile/urls.py
+++ b/community/user_profile/urls.py
@@ -9,5 +9,6 @@ urlpatterns = [
auth_view.LoginView.as_view(template_name='user_profile/login.html',
authentication_form=ExtendedAuthenticationForm),
name='login'),
+ path('logout', auth_view.LogoutView.as_view(), name='logout'),
path('profile', views.profile, name='profile')
]
diff --git a/community/user_profile/views.py b/community/user_profile/views.py
index eb634ae..26c0bb7 100644
--- a/community/user_profile/views.py
+++ b/community/user_profile/views.py
@@ -1,5 +1,6 @@
from django.shortcuts import render, redirect
from django.contrib.auth import authenticate, login
+from django.contrib.auth.decorators import login_required
from .forms import ExtendedUserCreationForm
@@ -19,5 +20,6 @@ def register(request):
return render(request, 'user_profile/register.html', {'form': form})
+@login_required
def profile(request):
return render(request, 'user_profile/profile.html')