From 834c30321b55c5286a11ae3697a85ad72c497343 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Thu, 19 Jul 2012 11:43:48 +0200 Subject: [PATCH] #310 Redirect to the password-change-page if the admin has not changed his password yet --- .../templates/participant/login.html | 2 +- openslides/participant/views.py | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/openslides/participant/templates/participant/login.html b/openslides/participant/templates/participant/login.html index 908ed02d8..1f182ade2 100644 --- a/openslides/participant/templates/participant/login.html +++ b/openslides/participant/templates/participant/login.html @@ -41,7 +41,7 @@ $(this).hide("fast"); }); -
+ {% csrf_token %} diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 0024116c4..fd6be11b2 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -565,21 +565,22 @@ def reset_password(request, user_id): def login(request): + extra_content = {} try: admin = User.objects.get(pk=1) if admin.check_password(config['admin_password']): - first_time_message = _("Installation was successfully! Use %(user)s " - "(password: %(password)s) for first login.
" - "Important: Please change the password after " - "first login! Otherwise this message still appears for everyone " - "and could be a security risk.") % { + extra_content['first_time_essage'] = _( + "Installation was successfully! Use %(user)s " + "(password: %(password)s) for first login.
" + "Important: Please change the password after " + "first login! Otherwise this message still appears for everyone " + "and could be a security risk.") % { 'user': html_strong(admin.username), 'password': html_strong(config['admin_password'])} - else: - first_time_message = None + extra_content['next'] = reverse('password_change') except User.DoesNotExist: - first_time_message = None - return django_login(request, template_name='participant/login.html', extra_context={'first_time_message': first_time_message}) + pass + return django_login(request, template_name='participant/login.html', extra_context=extra_content) def register_tab(request):