diff --git a/colab/accounts/urls.py b/colab/accounts/urls.py index 8e13120..cdb0a30 100644 --- a/colab/accounts/urls.py +++ b/colab/accounts/urls.py @@ -4,10 +4,20 @@ from django.conf.urls import patterns, url from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView, ManageUserSubscriptionsView, ChangeXMPPPasswordView) +from accounts import views +from django.contrib.auth import views as auth_views urlpatterns = patterns('', url(r'^register/$', 'colab.accounts.views.signup', name='signup'), + url(r'^change-password/?$', + auth_views.password_change, + {'template_name': 'registration/password_change.html'}, + name='password_change'), + + url(r'^change-password-done/?$', + 'accounts.views.password_changed', name='password_change_done'), + url(r'^change-password/$', ChangeXMPPPasswordView.as_view(), name='change_password'), diff --git a/colab/accounts/views.py b/colab/accounts/views.py index a5d4307..d677aac 100644 --- a/colab/accounts/views.py +++ b/colab/accounts/views.py @@ -275,3 +275,10 @@ class ChangeXMPPPasswordView(UpdateView): _("You've changed your password successfully!") ) return response + +def password_changed(request): + messages.success(request, _('Your password has been updated!')) + + user = request.user + + return redirect('user_profile_update', username=user.username) diff --git a/src/accounts/templates/registration/password_change.html b/src/accounts/templates/registration/password_change.html new file mode 100644 index 0000000..3b662bf --- /dev/null +++ b/src/accounts/templates/registration/password_change.html @@ -0,0 +1,56 @@ +{% extends "base.html" %} +{% load i18n %} +{% block main-content %} + +
+ {% if form.errors %} +
+ + {% if form.errors.items|length == 1 %}{% trans "Please correct the error below and try again." %}{% else %}{% trans "Please correct the errors below and try again." %}{% endif %} + +
+ {% endif %} +
+ +
+
+ {% csrf_token %} + +
+
+
+

{% trans 'Change Password' %}

+ +
+
+ {{ form.old_password.label_tag }} + + {{ form.old_password.errors }} +
+ +
+ {{ form.new_password1.label_tag }} + + {{ form.new_password1.errors }} +
+ +
+ {{ form.new_password2.label_tag }} + + {{ form.new_password2.errors }} +
+ +
+
+
+
+ +
+
+ +
+ +
+
+ +{% endblock %} -- libgit2 0.21.2