- Setup templates for login - login page reached at accounts/loginmain
parent
429f44afe2
commit
77575c8ff4
@ -1 +1,2 @@
|
||||
.idea/
|
||||
db.sqlite3
|
@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% block title %}
|
||||
<title>Keep pollin', pollin', pollin', pollin'</title>
|
||||
{% endblock %}
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<!-- Add additional CSS in static file -->
|
||||
{% load static %}
|
||||
<link rel="stylesheet" href="{% static 'css/style.css' %}"/>
|
||||
|
||||
<script
|
||||
src="https://unpkg.com/htmx.org@1.9.8"
|
||||
integrity="sha384-rgjA7mptc2ETQqXoYC3/zJvkU7K/aP44Y+z7xQuJiVnB/422P/Ak+F/AqFR7E4Wr"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script src="https://unpkg.com/hyperscript.org@0.9.12"></script>
|
||||
|
||||
{% block extra-head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
document.body.addEventListener('htmx:configRequest', (event) => {
|
||||
event.detail.headers['X-CSRFToken'] = '{{ csrf_token }}';
|
||||
})
|
||||
</script>
|
||||
<div class="content">
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,43 @@
|
||||
{% extends "base_template.html" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div>Login</div>
|
||||
|
||||
{% if form.errors %}
|
||||
<p>Your username and password didn't match. Please try again.</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.</p>
|
||||
{% else %}
|
||||
<p>Please login to see this page.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<form class="login-form"
|
||||
id="login-form"
|
||||
method="post"
|
||||
action="{% url 'login' %}"
|
||||
>
|
||||
{% csrf_token %}
|
||||
<div>
|
||||
<div>{{ form.username.label_tag }}</div>
|
||||
<div>{{ form.username }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div>{{ form.password.label_tag }}</div>
|
||||
<div>{{ form.password }}</div>
|
||||
</div>
|
||||
<div class="login-button"
|
||||
onclick="document.forms['login-form'].submit();"
|
||||
>
|
||||
Login
|
||||
</div>
|
||||
<input type="submit" value="login" hidden="hidden">
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in new issue