lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 292 forks source link

Python3.7.1: AttributeError: 'NoneType' object has no attribute 'password' #237

Closed ghost closed 6 years ago

ghost commented 6 years ago

I am getting an error with Python v3.7.1, which I did not get with v3.5.2: AttributeError: 'NoneType' object has no attribute 'password'

Here is the complete traceback:

File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_user/user_manager.py", line 416, in login_stub
return self.login_view()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_user/user_manager__views.py", line 367, in login_view
if self.call_or_get(current_user.is_authenticated) and self.USER_AUTO_LOGIN_AT_LOGIN:
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/werkzeug/local.py", line 306, in _get_current_object
return self.__local()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_login/utils.py", line 26, in <lambda>
current_user = LocalProxy(lambda: _get_user())
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_login/utils.py", line 335, in _get_user
current_app.login_manager._load_user()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_login/login_manager.py", line 359, in _load_user
return self.reload_user()
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_login/login_manager.py", line 321, in reload_user
user = self.user_callback(user_id)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_user/user_manager.py", line 130, in load_user_by_user_token
user = self.db_manager.UserClass.get_user_by_token(user_token)
File "/home/user/projectname/venv3.7/lib/python3.7/site-packages/flask_user/user_mixin.py", line 52, in get_user_by_token
user_password = '' if user_manager.USER_ENABLE_AUTH0 else user.password[-8:]
AttributeError: 'NoneType' object has no attribute 'password'
jackmerrill commented 6 years ago

Did you get an answer...? I have the same issue and it would be helpful if you could share your answer.

ghost commented 6 years ago

Hey, for me it was some issue with the variables that were passed to render_template

var1 = ...
var2 = ...
return render_template('your_page.html', var1=var1, var2=var2)

check your variables or try to skip them and see if it works then

jackmerrill commented 6 years ago

No variables, I'm trying to access index.html.

jackmerrill commented 6 years ago

I'll open a new issue.

olbliss commented 4 years ago

I have the same issue. Was trying to set up sqlite database with functions to insert data. Fiddling around with it, even dropping the database entirely. Now I can’t even access index.html. Seems to be some sort of issue with the password. No variables at all.