Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'encode' #30

Closed
RockaDev opened this issue Dec 2, 2021 · 0 comments
Closed

AttributeError: 'NoneType' object has no attribute 'encode' #30

RockaDev opened this issue Dec 2, 2021 · 0 comments

Comments

@RockaDev
Copy link

RockaDev commented Dec 2, 2021

Traceback (most recent call last):
File "D:\python\Lib\site-packages\flask\app.py", line 2091, in call
return self.wsgi_app(environ, start_response)
File "D:\python\Lib\site-packages\flask\app.py", line 2076, in wsgi_app
response = self.handle_exception(e)
File "D:\python\Lib\site-packages\flask\app.py", line 2073, in wsgi_app
response = self.full_dispatch_request()
File "D:\python\Lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
rv = self.handle_user_exception(e)
File "D:\python\Lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
rv = self.dispatch_request()
File "D:\python\Lib\site-packages\flask\app.py", line 1502, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
File "C:\Users\mineo\Desktop\flask\website\auth.py", line 19, in login
if check_password_hash(user.password, password):
File "D:\python\Lib\site-packages\werkzeug\security.py", line 219, in check_password_hash
return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval)
File "D:\python\Lib\site-packages\werkzeug\security.py", line 148, in _hash_internal
password = password.encode("utf-8")
AttributeError: 'NoneType' object has no attribute 'encode'

Error should be in this line:

    user = User.query.filter_by(email=email).first()
    if user:
        if check_password_hash(user.password, password):

EDIT: Fixed by changing from

    password = request.form.get('password')
    #To:
    password = request.form.get('password1')
@RockaDev RockaDev closed this as completed Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant