From fb631f92e9f391f1bb4997d337b337e33a9c9fa1 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..3085c97 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", default=[]) + user = User(**values) + set_roles(user, roles) current_app.config["FG_AUTH_BACKEND"].create_user(user, data["password"])