logged in users can't see the /login and /signup pages

This commit is contained in:
iou1name 2018-08-12 01:59:22 -04:00
parent 7fb52374f9
commit 03ba297122
3 changed files with 12 additions and 2 deletions

View File

@ -3,8 +3,11 @@
{% block content %}
<h1>Quests 'n Shiet</h1>
<a href="./quest/1">Unga Bunga Quest</a><br />
{% if request.user.is_authenticated %}
<a href="{{ url('create_quest:index') }}">Create New Quest</a><br />
<a href="{{ url('logout:index') }}">Logout</a><br />
{% else %}
<a href="{{ url('signup:index') }}">Sign up</a><br />
<a href="{{ url('login:index') }}">Login</a><br />
<a href="{{ url('logout:index') }}">Logout</a><br />
{% endif %}
{% endblock %}

View File

@ -12,6 +12,8 @@ def index(request):
"""
The login page.
"""
if request.user.is_authenticated:
return redirect('homepage:index')
if request.method == "GET":
form = LoginForm()
return render(request, 'login/index.html', {'form': form})

View File

@ -2,12 +2,17 @@
"""
/signup app views.
"""
from django.shortcuts import render
from django.shortcuts import redirect, render
from users.models import User
def index(request):
"""
The signup page.
"""
if request.user.is_authenticated:
return redirect('homepage:index')
if request.method == "GET":
context = {}
return render(request, 'signup/index.html', context)