Hi, in my flask initialization, I instantiate my login manager with py login_manager = LoginManager() login_manager.login_view = "login" login_manager.init_app(app)
with my views blueprint being registered py app.register_blueprint(views, url_prefix="/")
and in my views module, I have py @login_required @views.route("/account") def account(): return render_template("account.html", user=current_user) using the login_required decorator, I expect it to return the user to the login view, which it does not, instead it renders my account.html without the correct data as obviously the user is not authenticated
#๐ Flask login manager
7 messages ยท Page 1 of 1 (latest)
@worldly hazel
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
The docs have got the login_required and .route lines reversed. Not sure if thatโs what your problem might be? As it might not actually be checking the login once itโs doing the route
@app.route('/post')
@login_required
def post():
pass
You're a hero thank you hahah
Thatโs alright ๐
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.