UMBC-CMSC447-Spring2017-Team5 / college-JUMP

https://lassa.xen.prgmr.com/collegejump/
GNU General Public License v3.0
0 stars 0 forks source link

Database import breaks login #62

Closed alexander-bauer closed 7 years ago

alexander-bauer commented 7 years ago

After importing a database, no users can log in, and they are presented with this error.

127.0.0.1 - - [23/Apr/2017 14:21:29] "POST /login HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1540, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/views.py", line 49, in login_page
    if user.check_password(password):
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/collegejump/models.py", line 80, in check_password
    return app.bcrypt.check_password_hash(self.password, plaintext)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/flask_bcrypt.py", line 193, in check_password_hash
    return safe_str_cmp(bcrypt.hashpw(password, pw_hash), pw_hash)
  File "/home/sasha/umbc/2017spring/cmsc447/college-JUMP/env/lib/python3.6/site-packages/bcrypt/__init__.py", line 87, in hashpw
    raise ValueError("Invalid salt")
ValueError: Invalid salt
alexander-bauer commented 7 years ago

I think this is a result of type conversion on the _password field for the users table. It might be possible to fix this by explicitly converting that field when importing back.