fedora-infra / fas

Fedora Account System
https://admin.fedoraproject.org/accounts
GNU General Public License v2.0
40 stars 50 forks source link

Typing in the wrong password to activate lockout crashes #247

Closed ryanlerch closed 7 years ago

ryanlerch commented 7 years ago

If you try to log into a user account multiple times to activate the lockout, the following error is returned:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/waitress/channel.py", line 338, in service
    task.service()
  File "/usr/lib/python2.7/site-packages/waitress/task.py", line 169, in service
    self.execute()
  File "/usr/lib/python2.7/site-packages/waitress/task.py", line 399, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/usr/lib/python2.7/site-packages/pyramid/router.py", line 233, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/usr/lib/python2.7/site-packages/pyramid/router.py", line 208, in invoke_subrequest
    response = handle_request(request)
  File "/usr/lib/python2.7/site-packages/pyramid_debugtoolbar/toolbar.py", line 187, in toolbar_tween
    return handler(request)
  File "/usr/lib/python2.7/site-packages/pyramid/tweens.py", line 62, in excview_tween
    reraise(*attrs['exc_info'])
  File "/usr/lib/python2.7/site-packages/pyramid/tweens.py", line 22, in excview_tween
    response = handler(request)
  File "/usr/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 119, in tm_tween
    reraise(*exc_info)
  File "/usr/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 98, in tm_tween
    response = handler(request)
  File "/usr/lib/python2.7/site-packages/pyramid/router.py", line 155, in handle_request
    view_name
  File "/usr/lib/python2.7/site-packages/pyramid/view.py", line 612, in _call_view
    response = view_callable(context, request)
  File "/usr/lib/python2.7/site-packages/pyramid/viewderivers.py", line 438, in rendered_view
    result = view(context, request)
  File "/usr/lib/python2.7/site-packages/pyramid/viewderivers.py", line 123, in _class_requestonly_view
    response = getattr(inst, attr)()
  File "/vagrant/fas/views/home.py", line 76, in login
    result = process_login(self.request, person, password)
  File "/vagrant/fas/security.py", line 279, in process_login
    notify(LoginRequested(request, person))
  File "/usr/lib/python2.7/site-packages/pyramid/registry.py", line 110, in notify
    [ _ for _ in self.subscribers(events, None) ]
  File "/usr/lib64/python2.7/site-packages/zope/interface/registry.py", line 442, in subscribers
    return self.adapters.subscribers(objects, provided)
  File "/usr/lib64/python2.7/site-packages/zope/interface/adapter.py", line 598, in subscribers
    subscription(*objects)
  File "/usr/lib/python2.7/site-packages/pyramid/config/adapters.py", line 103, in derived_subscriber
    return subscriber(arg[0])
  File "/vagrant/fas/subscribers/login.py", line 71, in onLoginRequested
    if datetime.datetime.now(pytz.utc) > unlock_time:
TypeError: can't compare offset-naive and offset-aware datetimes
laxathom commented 7 years ago

You might need to rebuild your fake data with this update.