in login_user if not force and not user.is_active: AttributeError: 'NoneType' object has no attribute 'is_active'
Here is the complete error, i have played around with some of the other tabs on this Github around this issue and have not found success being able to sign up a new user. I have tried to add login_user(user, remember=True) login_user(new_user, remember=True) with no success and tried to delete the database and create a new one, any help is very appreciated.
"ERROR in app: Exception on /sign-up [POST]
Traceback (most recent call last):
File "C:\Users\Swag\AppData\Roaming\Python\Python38\site-packages\flask\app.py", line 2525, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\Swag\AppData\Roaming\Python\Python38\site-packages\flask\app.py", line 1822, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\Swag\AppData\Roaming\Python\Python38\site-packages\flask\app.py", line 1820, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\Swag\AppData\Roaming\Python\Python38\site-packages\flask\app.py", line 1796, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
File "c:\Users\Swag\OneDrive - Bentley University\Personal\Flask Web App Tutorial\website\auth.py", line 59, in sign_up
login_user(user, remember=True)
File "C:\Users\Swag\AppData\Roaming\Python\Python38\site-packages\flask_login\utils.py", line 180, in login_user
if not force and not user.is_active:
AttributeError: 'NoneType' object has no attribute 'is_active'
141.133.213.232 - - [31/Oct/2022 15:12:33] "POST /sign-up HTTP/1.1" 500 -
Let me know if you need to see any of my code.
I fixed it, should have just delted the first login user and keep the one with login user (new user)
Hey, I have gotten the same error, and by your comment I didn't really understand what I should do to solve this issue, if you are able to, could you briefly just explain how you fixed the issue?
In sign up, change:
login_user(user, remember=True)
to:
login_user(new_user, remember=True)
and that should solve it