This morning I tried to login in my account from my website(deployed on pythonanywhere
After that, I tried to login from my main device. It worked perfectly. I checked if I entered the same credentials and I did.
The view function:
@application.route('/logmein', methods=['POST'])
def logmein():
password = request.form['password']
email = request.form['email']
user = User.query.filter_by(email=email).first()
spass = check_password_hash(user.password, password)
if not user:
return '<h1>We could not find the account!<a href="/login">try again</a></h1>'
else:
if spass == True:
login_user(user, remember=True)
return redirect('/')
else:
return '<body style="background: yellow"><h1>The password is incorrect! <a href="/login"> go back</a></h1></body>'
Thanks for help!!!
You should see whats being sent over when you post by printing the form data.
@application.route('/logmein', methods=['POST'])
def logmein():
print(request.form)
# print each method so you can look around
print(dir(request.form))
return 'test'
AttributeError: 'NoneType' object has no attribute 'password'
< Leads me to beleive the issue is that password doesnt exist as you reference it.