请问老师,login的路由函数中无法获取到next的值是为什么,直接将next的值返回到浏览器中显示的是None
来源:9-16 重定向攻击
檀彬
2018-07-11
@web.route('/login', methods=['GET', 'POST'])
def login():
form = LoginForms(request.form)
if request.method == 'POST' and form.validate():
user = User.query.filter_by(nickname=form.nickname.data).first()
if user and user.check_password(form.password.data):
login_user(user)
next = request.args.get('next')
# if not next or not next.startswith('/'):
# next = url_for('web.login')
return "%s" %next
else:
flash('账号不存在或密码错误', category='login_error')
return render_template('auth/login.html', form=form)写回答
1回答
-
这个next就是request中所携带的一个参数,是不是本身url里就没有next参数呢?
012018-07-15
相似问题