flask-extensions / Flask-SimpleLogin

Simple Login - Login Extension for Flask - maintainer @cuducos

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple_log soesn't work for blueprints

topper-123 opened this issue · comments

Hey, great extension!

I tried using simple_login, and it works great except, it does't work for paths added by blueprints.

import flask
import flask_simplelogin

app = flask.Flask(__name__)

my_blueprint = flask.Blueprint('BP', __name__)  # + some url_routes etc...
app.register_blueprint(my_blueprint, url_prefix='/my_path')

flask_simplelogin.SimpleLogin(app) # doesn't work for /my_path

EDIT: sorry I probably misunderstood something here. I'll close this
Thx again.

Makes me thing about having a app.config['PROTECT_ALL_VIEWS'] to protect everything with login by default.

Yeah, that would be a great addition. Maybe also flask_simplelogin.SimpleLogin(app, protect_all_views=True)?

I'm not very experienced with blueprints. Is it correct that I can just import simplelogin in each blueprint and be good with it? It seems to be working so far.