error by password reset function

This commit is contained in:
Oskar Hahn 2011-09-03 19:42:43 +02:00
parent 3c38a02896
commit 67f650aee8
2 changed files with 5 additions and 3 deletions

View File

@ -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:

View File

@ -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 <b>%s</b> was successfully resettet') % user)
else:
gen_confirm_form(request, _('Do you really want to reset the password for <b>%s</b>') % user,
reverse('user_overview'))
return redirect(reverse('user_edit', args=[user_id]))
reverse('user_reset_passwords', args=[user_id]))
return redirect(reverse('user_overview'))