I am using flask for my web app, in the process of redirecting the user to a specific next url using request.args.get it did not work although i can see in the url that the next has a value so why does it return None
@app.route("/login", methods=['GET','POST'])
def login():
form = LoginForm()
if form.validate_on_submit():
user = Users.query.filter_by(username= (form.username.data)).first()
if user and bcrypt.check_password_hash(user.password,form.password.data):
login_user(user, remember= form.remember.data)
next_page = request.args.get('next')
return redirect(next_page) if next_page else redirect(url_for('home'))
else:
flash("Incorrect Username/Password","danger")
return render_template("login.html", title= "Login", form= form )
- I already made a the template for the url i will redirect the user to and here is the url
this is the url
http://4bfb82fe-3038-4e34-8fbe-bb4afd5f4c25-ide.cs50.xyz/login?next=%2Fsetting
Aucun commentaire:
Enregistrer un commentaire