Code refactor
This commit is contained in:
parent
15da1c8b51
commit
d7e3f0132f
3 changed files with 28 additions and 27 deletions
|
@ -2,7 +2,7 @@
|
||||||
{% load crispy_forms_filters %}
|
{% load crispy_forms_filters %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% block title %}Change password{% endblock %}</h1>
|
<h1>{% block title %}{{ title }}{% endblock %}</h1>
|
||||||
|
|
||||||
<div id="login">
|
<div id="login">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form|crispy }}
|
{{ form|crispy }}
|
||||||
<button type="submit" class="btn btn-primary">Change password</button>
|
<button type="submit" class="btn btn-primary">{{ action }}</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -1,18 +0,0 @@
|
||||||
{% extends 'base.html' %}
|
|
||||||
{% load staticfiles %}
|
|
||||||
{% load crispy_forms_filters %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<h1>{% block title %}Login{% endblock %}</h1>
|
|
||||||
|
|
||||||
<div id="login">
|
|
||||||
<form name="LoginForm" action="{% url 'auth_login' %}" method="post">
|
|
||||||
{% if next %}
|
|
||||||
<input type="hidden" name="next" value="{{ next }}"/>
|
|
||||||
{% endif %}
|
|
||||||
{% csrf_token %}
|
|
||||||
{{ form|crispy }}
|
|
||||||
<button type="submit" class="btn btn-primary">Login</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
|
@ -1,18 +1,37 @@
|
||||||
|
from authentication.views import password_change_done
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth.views import login, logout, password_change
|
from django.contrib.auth.views import login, logout, password_change
|
||||||
from authentication.views import password_change_done
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^login/$',
|
url(
|
||||||
|
r'^login/$',
|
||||||
login,
|
login,
|
||||||
{'template_name': 'authentication/login.html'},
|
{
|
||||||
|
'template_name': 'authentication/auth_form.html',
|
||||||
|
'extra_context': {
|
||||||
|
'title': 'Login',
|
||||||
|
'action': 'Login'
|
||||||
|
}
|
||||||
|
},
|
||||||
name='auth_login'
|
name='auth_login'
|
||||||
),
|
),
|
||||||
url(r'^logout/$',
|
url(
|
||||||
|
r'^logout/$',
|
||||||
logout,
|
logout,
|
||||||
{'next_page': 'home'},
|
{'next_page': 'home'},
|
||||||
name='auth_logout'
|
name='auth_logout'
|
||||||
),
|
),
|
||||||
url(r'^password/change/$', password_change, {'template_name': 'authentication/change_password.html'}, name='password_change'),
|
url(
|
||||||
|
r'^password/change/$',
|
||||||
|
password_change,
|
||||||
|
{
|
||||||
|
'template_name': 'authentication/auth_form.html',
|
||||||
|
'extra_context': {
|
||||||
|
'title': 'Change password',
|
||||||
|
'action': 'Change password'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name='password_change'
|
||||||
|
),
|
||||||
url(r'^password/change/done/$', password_change_done, name='password_change_done'),
|
url(r'^password/change/done/$', password_change_done, name='password_change_done'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue