-
Notifications
You must be signed in to change notification settings - Fork 11
Description
Corresponds to the the GET request component of LoginView.
Reference as {% url 'login' %} in the main index template.
The POST request redirects to the LOGIN_REDIRECT_URL settings variable, which defaults to '/accounts/profile/'. This url is not defined, so we should also change that setting variable to be where we want it to redirect to. I suggest adding the following to rse_competencies_toolkit/settings/settings.py
LOGIN_REDIRECT_URL = "/"The Django docs provide a sample template, which I have included here:
{% extends "base.html" %}
{% block content %}
{% 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 method="post" action="{% url 'login' %}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login">
<input type="hidden" name="next" value="{{ next }}">
</form>
{# Assumes you set up the password_reset view in your URLconf #}
<p><a href="{% url 'password_reset' %}">Lost password?</a></p>
{% endblock content %}Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
✅ Done