I'm running a self-hosted pagure instance, (release 2.13.2), using Nginx and uwsgi. I'm using local authentication:
PAGURE_AUTH = 'local'
I can register new users without problems when I choose a password that contains only ASCII characters. When non-ASCII characters are used, pagure crashes.
Exception on /user/new [POST] Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/lib64/python2.7/site-packages/pagure-2.13.2-py2.7.egg/pagure/ui/login.py", line 45, in new_user form.password.data = generate_hashed_value(form.password.data) File "/usr/lib64/python2.7/site-packages/pagure-2.13.2-py2.7.egg/pagure/lib/login.py", line 75, in generate_hashed_value return '$2$' + bcrypt.hashpw(to_unicode(password), bcrypt.gensalt()) UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 0: ordinal not in range(128) [pid: 20893|app: 0|req: 3/3] XX.XX.XX.XX () {50 vars in 1058 bytes} [Sun Feb 26 16:14:38 2017] POST /user/new => generated 2667 bytes in 172 msecs (HTTP/1.1 500) 2 headers in 100 bytes (1 switches on core 0)
This was after I tried to register user test with password ö. I have flask version 0.10.1 installed.
test
ö
EDIT: I installed flask 0.12 now and it still happens.
Metadata Update from @pingou: - Issue tagged with: bug
There are two bcrypt libraries, which one did you install?
Metadata Update from @pingou: - Issue untagged with: bug
I'm running Gentoo, the dev-python/bcrypt package is built from these sources: https://github.com/pyca/bcrypt/
Sorry I was confused. I didn't have that package installed. Now I installed it, but still the same error occurs. So maybe the other bcrypt library is used. But where does it come from?
We're currently using an old one that was hosted at: http://code.google.com/p/py-bcrypt/
@pingou i am using that one and i get the error too :/
I am taking it up
https://pagure.io/pagure/pull-request/2014 fixing it
I believe this has been fixed and even more so if using pagure with python3 :)
Thanks for your report and for the fixes @farhaan and @abompard
Metadata Update from @pingou: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)