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 %}
|
||||
<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 %}
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user