Bug #10310
Unable to access admin with my LDAP account after reauthentication when already logged with a standard user.
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Catégorie:
-
Version cible:
-
Début:
16 mars 2016
Echéance:
% réalisé:
100%
Temps estimé:
Patch proposed:
Non
Planning:
Description
If I'm not logged in, I go to /admin, I authenticate with my ldap account, I have access, no problem.
If I'm logged in with a "standard" user, I go to /admin, I authenticate with my ldap account, the problem occurs.
Tested on the 3M dev.
Environment: Request Method: GET Request URL: https://idp-montpellier.dev.entrouvert.org/admin/ Django Version: 1.7.7 Python Version: 2.7.3 Installed Applications: '' Installed Middleware: '' Template error: In template /usr/lib/python2.7/dist-packages/admin_tools/theming/templates/admin/base.html, error at line 39 block 29 : <div id="user-tools"> 30 : {% block welcome-msg %} 31 : {% trans 'Welcome,' %} 32 : <strong>{% firstof user.get_short_name user.get_username %}</strong>. 33 : {% endblock %} 34 : {% block userlinks %} 35 : {% url 'django-admindocs-docroot' as docsroot %} 36 : {% if docsroot %} 37 : <a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / 38 : {% endif %} 39 : {% if user.has_usable_password %} 40 : <a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> / 41 : {% endif %} 42 : <a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a> 43 : {% endblock %} 44 : </div> 45 : {% endif %} 46 : {% block nav-global %}{% endblock %} 47 : </div> 48 : <!-- END Header --> 49 : {% block breadcrumbs %} Traceback: File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 137. response = response.render() File "/usr/lib/python2.7/dist-packages/django/template/response.py" in render 103. self.content = self.rendered_content File "/usr/lib/python2.7/dist-packages/django/template/response.py" in rendered_content 80. content = template.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 148. return self._render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in _render 142. return self.nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py" in render 126. return compiled_parent._render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in _render 142. return self.nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py" in render 126. return compiled_parent._render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in _render 142. return self.nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/defaulttags.py" in render 312. return nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/defaulttags.py" in render 312. return nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py" in render 65. result = block.nodelist.render(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in render 844. bit = self.render_node(node, context) File "/usr/lib/python2.7/dist-packages/django/template/debug.py" in render_node 80. return node.render(context) File "/usr/lib/python2.7/dist-packages/django/template/defaulttags.py" in render 305. match = condition.eval(context) File "/usr/lib/python2.7/dist-packages/django/template/defaulttags.py" in eval 898. return self.value.resolve(context, ignore_failures=True) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in resolve 596. obj = self.var.resolve(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in resolve 734. value = self._resolve_lookup(context) File "/usr/lib/python2.7/dist-packages/django/template/base.py" in _resolve_lookup 788. current = current() File "/usr/lib/python2.7/dist-packages/authentic2/backends/ldap_backend.py" in has_usable_password 163. return self.block['user_can_change_password'] File "/usr/lib/python2.7/dist-packages/authentic2/backends/ldap_backend.py" in block 63. return self.ldap_data['block'] Exception Type: KeyError at /admin/ Exception Value: 'block'
Révisions associées
Historique
Mis à jour par Benjamin Dauvergne il y a environ 8 ans
- Statut changé de Nouveau à Résolu (à déployer)
- % réalisé changé de 0 à 100
Appliqué par commit authentic2|687c7f7a7be819b4dfdbb32578958736f80bf513.
Mis à jour par Benjamin Dauvergne il y a plus de 7 ans
- Statut changé de Résolu (à déployer) à Fermé
fix login with LDAP account when user is already logged (fixes #10310)
django.contrib.auth.login() flush the current session if an user is currently
logged, as the LDAP backend was storing some informations in the session before
the effective login, it went badly.