View decorator that redirects anonymous users to the login page.
(view)
| 17 | |
| 18 | |
| 19 | def login_required(view): |
| 20 | """View decorator that redirects anonymous users to the login page.""" |
| 21 | |
| 22 | @functools.wraps(view) |
| 23 | def wrapped_view(**kwargs): |
| 24 | if g.user is None: |
| 25 | return redirect(url_for("auth.login")) |
| 26 | |
| 27 | return view(**kwargs) |
| 28 | |
| 29 | return wrapped_view |
| 30 | |
| 31 | |
| 32 | @bp.before_app_request |
nothing calls this directly
no outgoing calls
no test coverage detected