From 90f5267a36688efecca78ac307e961c1f67190b9 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 12 Nov 2020 21:48:33 +0100 Subject: [PATCH] [Controller] Fixed bug in registration, thanks @crimsen --- flaschengeist/controller/userController.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flaschengeist/controller/userController.py b/flaschengeist/controller/userController.py index de30a3f..c912d9c 100644 --- a/flaschengeist/controller/userController.py +++ b/flaschengeist/controller/userController.py @@ -79,7 +79,10 @@ def register(data): if required not in data: raise BadRequest("Missing required parameters") allowed_keys = User().serialize().keys() - user = User(**{key: value for key, value in data.items() if key in allowed_keys}) + values = {key: value for key, value in data.items() if key in allowed_keys} + roles = values.pop("roles", []) + user = User(**values) + set_roles(user, roles) current_app.config["FG_AUTH_BACKEND"].create_user(user, data["password"])