From 67f650aee8755e0c272b0e6a73d9e5d02e7d7449 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 3 Sep 2011 19:42:43 +0200 Subject: [PATCH] error by password reset function --- openslides/participant/models.py | 1 + openslides/participant/views.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openslides/participant/models.py b/openslides/participant/models.py index b867ff06a..cbce6d025 100644 --- a/openslides/participant/models.py +++ b/openslides/participant/models.py @@ -39,6 +39,7 @@ class Profile(models.Model): def reset_password(self): self.user.set_password(self.firstpassword) + self.user.save() def __unicode__(self): if self.group: diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 9835ae363..c2b7b6529 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -20,6 +20,7 @@ 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 _ + from participant.models import Profile, set_first_user_passwords from participant.api import gen_username from participant.forms import UserForm, UsernameForm, ProfileForm, UsersettingsForm, UserImportForm, GroupForm, AdminPasswordChangeForm @@ -279,9 +280,9 @@ def reset_password(request, user_id): user = User.objects.get(pk=user_id) if request.method == 'POST': user.profile.reset_password() - user.profile.save() messages.success(request, _('The Password for %s was successfully resettet') % user) + else: gen_confirm_form(request, _('Do you really want to reset the password for %s') % user, - reverse('user_overview')) - return redirect(reverse('user_edit', args=[user_id])) + reverse('user_reset_passwords', args=[user_id])) + return redirect(reverse('user_overview'))