Correctly handle first time passwords (#194)

- Save User object after setting the password

- Only generate first time password if none was explicitly specified
This commit is contained in:
Andy Kittner 2012-05-19 10:33:59 +02:00
parent 3f4119f182
commit d3cf5c9311

View File

@ -156,8 +156,10 @@ def edit(request, user_id=None):
profile = profileform.save(commit=False)
profile.user = user
if user_id is None:
if not profile.firstpassword:
profile.firstpassword = gen_password()
profile.user.set_password(profile.firstpassword)
profile.user.save()
profile.save()
if user_id is None:
messages.success(request, _('New participant was successfully created.'))