logged in users can't see the /login and /signup pages
This commit is contained in:
parent
7fb52374f9
commit
03ba297122
|
@ -3,8 +3,11 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Quests 'n Shiet</h1>
|
<h1>Quests 'n Shiet</h1>
|
||||||
<a href="./quest/1">Unga Bunga Quest</a><br />
|
<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('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('signup:index') }}">Sign up</a><br />
|
||||||
<a href="{{ url('login:index') }}">Login</a><br />
|
<a href="{{ url('login:index') }}">Login</a><br />
|
||||||
<a href="{{ url('logout:index') }}">Logout</a><br />
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -12,6 +12,8 @@ def index(request):
|
||||||
"""
|
"""
|
||||||
The login page.
|
The login page.
|
||||||
"""
|
"""
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
return redirect('homepage:index')
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
form = LoginForm()
|
form = LoginForm()
|
||||||
return render(request, 'login/index.html', {'form': form})
|
return render(request, 'login/index.html', {'form': form})
|
||||||
|
|
|
@ -2,12 +2,17 @@
|
||||||
"""
|
"""
|
||||||
/signup app views.
|
/signup app views.
|
||||||
"""
|
"""
|
||||||
from django.shortcuts import render
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
|
from users.models import User
|
||||||
|
|
||||||
def index(request):
|
def index(request):
|
||||||
"""
|
"""
|
||||||
The signup page.
|
The signup page.
|
||||||
"""
|
"""
|
||||||
|
if request.user.is_authenticated:
|
||||||
|
return redirect('homepage:index')
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
context = {}
|
context = {}
|
||||||
return render(request, 'signup/index.html', context)
|
return render(request, 'signup/index.html', context)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user