diff --git a/djadmin2/core.py b/djadmin2/core.py index fe6c181..4fef83b 100644 --- a/djadmin2/core.py +++ b/djadmin2/core.py @@ -4,6 +4,7 @@ WARNING: This file about to undergo major refactoring by @pydanny per Issue #99. from django.conf.urls import patterns, include, url from django.conf import settings +from django.contrib.auth.decorators import login_required from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module @@ -135,7 +136,21 @@ class Admin2(object): view=self.api_index_view.as_view(**self.get_api_index_kwargs()), name='api-index' ), + + url(regex=r'^password_change/$', + regex=rlogin_required(views.PasswordChangeView.as_view()), + name='password-change' + ), + url(regex=r'^password_change_done/$', + login_required(views.PasswordChangeDoneView.as_view()), + name='password-change-done' + ), + url(regex=r'^logout/$', + login_required(views.LogoutView.as_view()), + name='logout' + ), ) + for model, model_admin in self.registry.iteritems(): model_options = utils.model_options(model) urlpatterns += patterns('', diff --git a/djadmin2/templates/admin2/bootstrap/auth/login.html b/djadmin2/templates/admin2/bootstrap/auth/login.html new file mode 100644 index 0000000..e69de29 diff --git a/djadmin2/templates/admin2/bootstrap/auth/logout.html b/djadmin2/templates/admin2/bootstrap/auth/logout.html new file mode 100644 index 0000000..e2a30f4 --- /dev/null +++ b/djadmin2/templates/admin2/bootstrap/auth/logout.html @@ -0,0 +1,13 @@ +{% extends "admin2/bootstrap/base.html" %} + +{% load i18n %} +{% load admin2_tags %} + +{% block content %} +
+
+

{% trans "Thanks for spending some quality time with the Web site today." %}

+

{% trans 'Log in again' %}

+
+
+{% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html new file mode 100644 index 0000000..1478ceb --- /dev/null +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_done.html @@ -0,0 +1,15 @@ +{% extends "admin2/bootstrap/base.html" %} + +{% load i18n %} +{% load admin2_tags %} + +{% block title %}{% trans 'Password change successful' %}{% endblock %} +{% block page_title %}{% trans 'Password change successful' %}{% endblock %} + +{% block content %} +
+
+

{% trans 'Your password was changed.' %}

+
+
+{% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html new file mode 100644 index 0000000..d976718 --- /dev/null +++ b/djadmin2/templates/admin2/bootstrap/auth/password_change_form.html @@ -0,0 +1,27 @@ +{% extends "admin2/bootstrap/base.html" %} + +{% load i18n %} +{% load admin2_tags %} + +{% block page_title %}{% trans "Password change" %}{% endblock %} + +{% block content %} +
+
+

Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly.

+ + {% if form.errors %} +

+ {% blocktrans count counter=form.errors.items|length %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} +

+ {% endif %} + +
+ {% csrf_token %} + {{ form.as_p }} + +
+
+
+ +{% endblock content %} diff --git a/djadmin2/templates/admin2/bootstrap/base.html b/djadmin2/templates/admin2/bootstrap/base.html index bbe98b1..ec7684f 100644 --- a/djadmin2/templates/admin2/bootstrap/base.html +++ b/djadmin2/templates/admin2/bootstrap/base.html @@ -13,16 +13,16 @@