diff --git a/openslides/participant/templates/participant/password_change.html b/openslides/participant/templates/participant/password_change.html new file mode 100644 index 000000000..2c291c050 --- /dev/null +++ b/openslides/participant/templates/participant/password_change.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block title %}{{ block.super }} - {%trans "Change your Password" %}{% endblock %} + +{% block submenu %} +{% endblock %} + +{% block content %} +

{% trans "Change your password" %}

+ +
{% csrf_token %} + {{ form.as_p }} + + + + + +
+

+{% endblock %} diff --git a/openslides/participant/templates/participant/settings.html b/openslides/participant/templates/participant/settings.html index 003078779..e1f32ed73 100644 --- a/openslides/participant/templates/participant/settings.html +++ b/openslides/participant/templates/participant/settings.html @@ -12,7 +12,6 @@
{% csrf_token %} {{ form_user.as_p }} - {{ form_password.as_p }}
+ {% trans 'Change your password' %}

{% endblock %} diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 1bb656eca..59f4d6568 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -26,7 +26,6 @@ from django.shortcuts import redirect from django.template import RequestContext from django.contrib.auth.models import User, Group from django.contrib.auth.decorators import login_required -from django.contrib.auth.forms import SetPasswordForm from django.contrib import messages from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _, ungettext @@ -299,21 +298,17 @@ def group_delete(request, group_id): @template('participant/settings.html') def user_settings(request): if request.method == 'POST': - form_user = UsersettingsForm(request.POST,instance=request.user, prefix='user') - form_password = SetPasswordForm(request.user,request.POST,prefix='password') - if form_user.is_valid() and form_password.is_valid(): + form_user = UsersettingsForm(request.POST,instance=request.user) + if form_user.is_valid(): form_user.save() - form_password.save() messages.success(request, _('User settings successfully saved.')) else: messages.error(request, _('Please check the form for errors.')) else: - form_user = UsersettingsForm(instance=request.user, prefix='user') - form_password = SetPasswordForm(request.user,prefix='password') + form_user = UsersettingsForm(instance=request.user) return { 'form_user': form_user, - 'form_password': form_password, 'edituser': request.user, } diff --git a/openslides/urls.py b/openslides/urls.py index adf959772..c47cc5deb 100644 --- a/openslides/urls.py +++ b/openslides/urls.py @@ -11,14 +11,11 @@ """ from django.conf.urls.defaults import patterns, url, include - -#todo: use this in evry file from django.conf import settings - from django.utils.importlib import import_module -import settings +from django.shortcuts import redirect -from utils.views import FrontPage +from openslides.utils.views import FrontPage handler500 = 'openslides.utils.views.server_error' @@ -66,9 +63,15 @@ urlpatterns += patterns('', name='user_logout', ), - url(r'^usersettings$', + url(r'^usersettings/$', 'participant.views.user_settings', name='user_settings', ), + url(r'^usersettings/changepassword/$', + 'django.contrib.auth.views.password_change', + {'template_name': 'participant/password_change.html', + 'post_change_redirect': '/usersettings/'}, + name='password_change', + ), )