MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / require_authentication

Function require_authentication

app/views.py:19–32  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

17
18
19def require_authentication(func):
20
21 @functools.wraps(func)
22 def decorated_function(*args, **kwargs):
23 if not session.is_auth_valid():
24 response = flask.redirect('/login' + _login_redirect_query())
25 # Prevent Flask from converting the redirect location into an
26 # absolute URL. This generates incorrect results, since we are
27 # sitting behind a proxy.
28 response.autocorrect_location_header = False
29 return response
30 return func(*args, **kwargs)
31
32 return decorated_function
33
34
35@views_blueprint.route('/', methods=['GET'])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected