This is most probably a stupid question, but still I can't find an answer.
Documentation for Flask-Security says:
If there are only certain times you need to require that your user is logged in, you can do so with:
if not current_user.is_authenticated:
return current_app.login_manager.unauthorized()
But it gives no clue where this "current_user" variable shall come from. Not surprisingly I get a "NameError: global name 'current_user' is not defined" when I try to use it in my application source code.
Weird thing is that, when I use the variable in my HTML template, render_template function somehow completes without an error.
So, the question is, how can I use "current_user" variable in my application and how does the template engine "know" about it if my app doesn't?