I have this flask code in an auth blueprint:
@auth.route('/login/',methods=['POST','GET'])
def login():
email = request.form.get('email',type=str)
password = request.form.get('password',type=str)
error = None
if email != None and password != None:
if verify_user(email,password):
user = next((item for item in app.config['AUTHORIZED'] if item["email"] == email), None)
session['name'] = user['name']
flash("welcome " + session['name'] + '!')
return redirect(url_for('admin.show'))
error = "invalid credentials"
return render_template('auth/index.html',error=error)
and the following in an admin blueprint, which I am redirecting to from the login:
@admin.route('/admin/',methods=['GET'])
def show():
if not 'name' in session:
return abort(403)
return render_template('admin/index.html')
However, when I successfully login, flask merely prints the html from admin/index.html to the javascript console in both Chrome and Firefox.