'NoneType' object is unsubscriptable on login.html

Bug #1080760 reported by Paul Everitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KARL3
Fix Released
Medium
Chris Rossi

Bug Description

From the error monitor:

TypeError: 'NoneType' object is unsubscriptable
Exception when processing https://karl.soros.org/login.html
Referer: https://karl.soros.org/login.html?reason=Bad+username+or+password&came_from=https%3A%2F%2Fkarl.soros.org%2F

Traceback (most recent call last):
  File "/srv/osfkarl/production/10/eggs/pyramid-1.2.1-py2.6.egg/pyramid/tweens.py", line 17, in excview_tween
    response = handler(request)
  File "/srv/osfkarl/production/10/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 107, in tm_tween
    return response
  File "/srv/osfkarl/production/10/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 75, in __exit__
    return self._retry_or_raise(t, v, tb)
  File "/srv/osfkarl/production/10/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 60, in _retry_or_raise
    reraise(t, v, tb) # otherwise reraise the exception
  File "/srv/osfkarl/production/10/eggs/pyramid_tm-0.5-py2.6.egg/pyramid_tm/__init__.py", line 100, in tm_tween
    response = handler(request)
  File "/srv/osfkarl/production/10/eggs/pyramid-1.2.1-py2.6.egg/pyramid/router.py", line 153, in handle_request
    response = view_callable(context, request)
  File "/srv/osfkarl/production/10/eggs/pyramid-1.2.1-py2.6.egg/pyramid/config/views.py", line 319, in viewresult_to_response
    result = view(context, request)
  File "/srv/osfkarl/production/10/eggs/karl-3.100-py2.6.egg/karl/views/login.py", line 77, in login_view
    userid = authenticate(users, login, password)
  File "/srv/osfkarl/production/10/eggs/karl-3.100-py2.6.egg/karl/views/login.py", line 188, in impersonate_authenticator
    if user and 'group.KarlAdmin' in admin['groups']:
TypeError: 'NoneType' object is unsubscriptable

Revision history for this message
Chris Rossi (chris-archimedeanco) wrote :

The issue is that a user might have a ':' in their password, which was confusing the impersonate plugin which looks for a ':' in the password field and assumes the password is in the form of 'admin_user:admin_password'. In this case, the value to the left of the colon wasn't an actual user in the system, which caused the exception above. I've fixed the code to fall through to normal login rather than raising an exception if impersonation fails in this way.

Fixed on 'crossi-1080760-fix-impersonate'

To test, enter an arbitrary password with a colon in it at the login page. Notice that you don't get a general error.

Changed in karl3:
status: New → Fix Committed
Changed in karl3:
importance: Undecided → Medium
tags: added: tested
tags: added: r3.101
Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Works on staging

Changed in karl3:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.