MycroftAI / personal-backend

WORK IN PROGRESS: A Flask personal backend alternative for running your own version of https://home.mycroft.ai
Apache License 2.0
114 stars 32 forks source link

Login failures #19

Closed el-tocino closed 5 years ago

el-tocino commented 5 years ago

When using the login form at the upper right and submitting valid credentials, I get the following in the log for the frontend:

[2019-01-24 22:03:22,098] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/olympus/.local/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/olympus/personal-backend/personal_mycroft_backend/backend/decorators.py", line 14, in decorated_function
    resp = make_response(f(*args, **kwargs))
  File "/home/olympus/personal-backend/personal_mycroft_backend/backend/decorators.py", line 14, in decorated_function
    resp = make_response(f(*args, **kwargs))
  File "/home/olympus/personal-backend/personal_mycroft_backend/frontend/main.py", line 29, in login
    if utils.credentials_valid(username, password):
  File "/home/olympus/personal-backend/personal_mycroft_backend/frontend/utils.py", line 88, in credentials_valid
    return bcrypt.checkpw(password.encode('utf8'), user.password.encode('utf8'))
AttributeError: 'bytes' object has no attribute 'encode'
192.168.1.1 - - [24/Jan/2019 22:03:15] "POST / HTTP/1.1" 500 -

When submitting bogus credentials, it returns a 200 in the logs and no error on the browser side.

Anyone else seeing this?

JarbasAl commented 5 years ago

original code was for python2, might be some incompatibility left over...

el-tocino commented 5 years ago

python3.