[Controller] Fixed bug in registration, thanks @crimsen
This commit is contained in:
parent
0f64c718f5
commit
90f5267a36
|
@ -79,7 +79,10 @@ def register(data):
|
||||||
if required not in data:
|
if required not in data:
|
||||||
raise BadRequest("Missing required parameters")
|
raise BadRequest("Missing required parameters")
|
||||||
allowed_keys = User().serialize().keys()
|
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"])
|
current_app.config["FG_AUTH_BACKEND"].create_user(user, data["password"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue