Removed generate passwords function/link. Now passwords will be generated after creating participants.

This commit is contained in:
Emanuel Schuetze 2011-11-14 21:25:20 +01:00
parent e7d8b8a5ee
commit d54afd7ad6
6 changed files with 4 additions and 26 deletions

View File

@ -53,13 +53,3 @@ class Profile(models.Model):
('can_see_participant', "Can see participant"),
('can_manage_participant', "Can manage participant"),
)
def set_first_user_passwords():
count = 0
for user in Profile.objects.filter(Q(firstpassword='') | Q(firstpassword__isnull=True)):
count = count + 1
user.firstpassword = gen_password()
user.user.set_password(user.firstpassword)
user.user.save()
user.save()
return count

View File

@ -21,7 +21,6 @@
<li><a href="{% url user_print %}"><img src="/static/images/icons/application-pdf.png"> {%trans 'Print participant list' %}</a></li>
{% endif %}
{% if perms.participant.can_manage_participant %}
<li><a href="{% url user_gen_passwords %}"><img src="/static/images/icons/quickopen.png"> {% trans 'Generate first time passwords' %}</a></li>
<li><a href="{% url print_passwords %}"><img src="/static/images/icons/application-pdf.png"> {% trans 'Print first time passwords' %}</a></li>
{% endif %}
</ul>

View File

@ -12,7 +12,7 @@
{{ userform.as_p }}
{{ profileform.as_p }}
{% if edituser %}
<a href="{% url user_reset_passwords edituser.id %}">{% trans 'Reset Password' %}</a>
<p><a href="{% url user_reset_password edituser.id %}">{% trans 'Reset to First Password' %}</a></p>
{% endif %}
<button class="button" type="submit">
<span class="icon ok">{%trans 'Save' %}</span>

View File

@ -27,8 +27,7 @@ urlpatterns = patterns('participant.views',
url(r'^participant/group/(?P<group_id>\d+)/edit$', 'group_edit', name='user_group_edit'),
url(r'^participant/group/(?P<group_id>\d+)/del$', 'group_delete', name='user_group_delete'),
url(r'^user/settings$', 'user_settings', name='user_settings'),
url(r'^participant/genpasswords$', 'gen_passwords', name='user_gen_passwords'),
url(r'^participant/resetpassword/(?P<user_id>\d+)$', 'reset_password', name='user_reset_passwords'),
url(r'^participant/resetpassword/(?P<user_id>\d+)$', 'reset_password', name='user_reset_password'),
url(r'^participant/passwords/print$', 'print_passwords', name='print_passwords'),
)

View File

@ -27,7 +27,7 @@ from django.contrib import messages
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _, ungettext
from participant.models import Profile, set_first_user_passwords
from participant.models import Profile
from participant.api import gen_username, gen_password
from participant.forms import UserNewForm, UserEditForm, ProfileForm, UsersettingsForm, UserImportForm, GroupForm, AdminPasswordChangeForm
from utils.utils import template, permission_required, gen_confirm_form
@ -351,16 +351,6 @@ def user_import(request):
}
@permission_required('participant.can_manage_participant')
def gen_passwords(request):
count = set_first_user_passwords()
if count:
messages.success(request, ungettext('%s Password was successfully generated.', '%s Passwords were successfully generated.', count ) % count)
else:
messages.info(request, _('There are no participants which need a first time password. No passwords generated.') )
return redirect(reverse('user_overview'))
@permission_required('participant.can_manage_participant')
def reset_password(request, user_id):
user = User.objects.get(pk=user_id)
@ -369,5 +359,5 @@ def reset_password(request, user_id):
messages.success(request, _('The Password for <b>%s</b> was successfully reset.') % user)
else:
gen_confirm_form(request, _('Do you really want to reset the password for <b>%s</b>?') % user,
reverse('user_reset_passwords', args=[user_id]))
reverse('user_reset_password', args=[user_id]))
return redirect(reverse('user_edit', args=[user_id]))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 556 B