Add signup and login pages
This commit is contained in:
12
templates/base.html
Normal file
12
templates/base.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}Django Auth Tutorial{% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
16
templates/home.html
Normal file
16
templates/home.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Home{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
<h2>Hi {{ user.username }}!</h2>
|
||||
<form action="{% url 'logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Log Out</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a> | <a href="{% url 'signup' %}">Sign Up</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
12
templates/registration/login.html
Normal file
12
templates/registration/login.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Log In{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Log In</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Log In</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
12
templates/registration/signup.html
Normal file
12
templates/registration/signup.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Sign Up{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Sign Up</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Sign Up</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user