Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add password change view
Marek Brzóskabbd52baa53fb
diff --git a/registration/templates/registration/change_password.html b/registration/templates/registration/change_password.htmlnew file mode 100644index 0000000000..52057e87d6--- /dev/null+++ b/registration/templates/registration/change_password.html@@ -0,0 +1,15 @@+{% extends "base.html" %}+{% load i18n %}+{% load bootstrap %}++{% block title %}{% trans "Change password" %}{% endblock %}++{% block content %}+<div>+ <form method="POST">+ {% csrf_token %}+ {{ form|as_bootstrap }}+ <input type="submit" value="{% trans "Update password" %}">+ </form>+</div>+{% endblock %}diff --git a/registration/templates/registration/set_password.html b/registration/templates/registration/set_password.htmlindex f7a1c8994e..9c14d003df 100644--- a/registration/templates/registration/set_password.html+++ b/registration/templates/registration/set_password.html@@ -1,18 +1,19 @@{% extends "base.html" %}+{% load i18n %}{% load bootstrap %}-{% block title %}Set password{% endblock %}+{% block title %}{% trans "Set password" %}{% endblock %}{% block content %}<div><form method="POST">{% csrf_token %}{{ form|as_bootstrap }}- <input type="submit" value="Set password">+ <input type="submit" value="{% trans "Set password" %}"></form><form method="POST">{% csrf_token %}- <input type="submit" value="I don't want a password">+ <input type="submit" value="{% trans "I don't want a password" %}"></form></div>{% endblock %}diff --git a/registration/urls.py b/registration/urls.pyindex 6e85e63230..2f6be6d6a7 100644--- a/registration/urls.py+++ b/registration/urls.py@@ -8,6 +8,9 @@ urlpatterns = patterns(url(r'^oauth_callback/(?P<service>\w+)/$','registration.views.oauth_callback',name='oauth_callback'),+ url(r'^change_password/$',+ 'registration.views.change_password',+ name='change_password'),url(r'^request_email_confirmation/$','registration.views.request_email_confirmation',name='request_email_confirmation'),diff --git a/registration/views.py b/registration/views.pyindex 3abc6c68a0..24182045ce 100644--- a/registration/views.py+++ b/registration/views.py@@ -7,7 +7,8 @@ from django.contrib.auth import (logout as auth_logout,get_user_model)from django.contrib.auth.decorators import login_required-from django.contrib.auth.views import login as django_login_view+from django.contrib.auth.views import login as django_login_view, password_change+from django.core.urlresolvers import reversefrom django.shortcuts import redirectfrom django.template.response import TemplateResponsefrom django.utils import timezone@@ -154,3 +155,10 @@ def _login_user(request, user):msg = _('You have been successfully logged in.')messages.success(request, msg)return redirect(settings.LOGIN_REDIRECT_URL)+++def change_password(request):+ return password_change(+ request, template_name='registration/change_password.html',+ post_change_redirect=reverse('profile:details')+ )diff --git a/userprofile/templates/userprofile/details.html b/userprofile/templates/userprofile/details.htmlindex cc20a2ddbe..0ef10393a7 100644--- a/userprofile/templates/userprofile/details.html+++ b/userprofile/templates/userprofile/details.html@@ -46,6 +46,9 @@<div><a href="{% url 'registration:request_email_change' %}">{% trans 'Change your email address' %}</a></div>+ <div>+ <a href="{% url 'registration:change_password' %}">{% trans 'Change password' %}</a>+ </div>{% endblock content %}