summaryrefslogtreecommitdiff
path: root/sw/auth.py
diff options
context:
space:
mode:
Diffstat (limited to 'sw/auth.py')
-rw-r--r--sw/auth.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/sw/auth.py b/sw/auth.py
index 2f03a04..85212ec 100644
--- a/sw/auth.py
+++ b/sw/auth.py
@@ -35,10 +35,25 @@ def load_logged_in_user():
)
+def json_input(view):
+ @functools.wraps(view)
+ def wrapped_view(**kwargs):
+ if not request.is_json:
+ return "Request body is not JSON", 422
+
+ return view(**kwargs)
+
+ return wrapped_view
+
+
+def from_trusted_server(view):
+ # TODO
+ return view
+
+
@bp.route("/register", methods=["POST"])
+@json_input
def register():
- if not request.is_json:
- return "Request body is not JSON", 422
data = request.json