fedora-infra / fas

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

[FAS3] CAPTCHA image broken #146

Closed ryanlerch closed 7 years ago

ryanlerch commented 8 years ago

I an unable to create an account on my FAS3 test instance, because when i get to the final screen of the create account process, the CAPTCHA image is not displaying.

laxathom commented 8 years ago

This might be an dependency issue. Could I have the log when going to registration's page?

ryanlerch commented 8 years ago

This is what is returned when going to the reg page: https://gist.github.com/ryanlerch/2ae7746c926fa661696d

laxathom commented 8 years ago

Could you give me the OS version you're trying to test this on and PIL package version as well?

ryanlerch commented 7 years ago

No longer getting the deprecated exception, but it is still not working. Now i get the following error:

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 236, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/usr/lib/python2.7/site-packages/pyramid/router.py", line 211, 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 158, in handle_request
    view_name
  File "/usr/lib/python2.7/site-packages/pyramid/view.py", line 547, in _call_view
    response = view_callable(context, request)
  File "/usr/lib/python2.7/site-packages/pyramid/viewderivers.py", line 465, in rendered_view
    request, result, view_inst, context)
  File "/usr/lib/python2.7/site-packages/pyramid/renderers.py", line 432, in render_view
    return self.render_to_response(response, system, request=request)
  File "/usr/lib/python2.7/site-packages/pyramid/renderers.py", line 455, in render_to_response
    result = self.render(value, system_values, request=request)
  File "/usr/lib/python2.7/site-packages/pyramid/renderers.py", line 451, in render
    result = renderer(value, system_values)
  File "/vagrant/fas/renderers.py", line 31, in render
    return data.tobytes('jpeg', 'RGB')
AttributeError: 'NoneType' object has no attribute 'tobytes'

This is running on Fedora 25, with the following version of Pillow (as per pip freeze): Pillow==3.4.2

skrzepto commented 7 years ago

hmm odd it seems to work on F24 and Pillow==3.4.2 for me if you are referring to the captcha for adding numbers?

Is this replicated in the vagrant file you created I can try to reproduce the error on my machine

ryanlerch commented 7 years ago

I get the error when trying to view "/register". And on the thrid page of that form, the CAPTCHA is not displaying.

Yes, the Vagrant setup is where i am hitting this issue.

ryanlerch commented 7 years ago

Okies! I have figured it out!

I missed the following error:

2016-12-15 05:56:05,912 ERROR [waitress:2784][root:captcha][__jpeg_generator__:108] Unable to read from Image Font: cannot open resource

And it turns out that development.ini defines liberation-mono as the font to use for the CAPTCHA, and i didnt have it installed on my development machine.

So, after a sudo dnf install liberation-mono-fonts, my CAPTCHAs are now appearing.