Answer the question
In order to leave comments, you need to log in
How to display that the user is not in the database?
Hello, I can't understand why the one else
that tells the user that he is not in the database and sends him to the page does not work test.html
(to be sure)
@app.route('/login', methods = ['GET','POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
user = User.query.filter_by(email=form.email.data).first()
if user.check_password(form.password.data) and user is not None:
login_user(user)
flash('Logged in successfully!')
next = request.args.get('next')
if next == None or not next[0]=='/':
next = url_for('welcome_user')
return redirect(next)
else:
flash('You are not in database')
return render_template('test.html')
return render_template('login.html', form=form)
test.html
does not transfer) None
- he must fly over else
to test.html
Answer the question
In order to leave comments, you need to log in
Well, first you need to check that the user is not None, and not call check_password on None
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question