flows: fix OOB flow incorrectly setting pending user

closes #3224

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-07-06 09:51:20 +02:00
parent 24f95fdeaa
commit d497db3010
4 changed files with 9 additions and 5 deletions

View File

@ -13,11 +13,11 @@ By default, the email is sent to the currently pending user. To override this, y
For example, create this expression policy and bind it to the email stage:
```python
request.context["email"] = "foo@bar.baz"
request.context["flow_plan"].context["email"] = "foo@bar.baz"
# Or get it from a prompt
# request.context["email"] = request.context["prompt_data"]["email"]
# request.context["flow_plan"].context["email"] = request.context["prompt_data"]["email"]
# Or another user attribute
# request.context["email"] = request.context["pending_user"].attributes.get("otherEmail")
# request.context["flow_plan"].context["email"] = request.context["pending_user"].attributes.get("otherEmail")
return True
```

View File

@ -14,6 +14,6 @@ Starting with authentik 2022.5, users can be added to dynamic groups. To do so,
from authentik.core.models import Group
group, _ = Group.objects.get_or_create(name="some-group")
# ["groups"] *must* be set to an array of Group objects, names alone are not enough.
request.context["groups"] = [group]
request.context["flow_plan"].context["groups"] = [group]
return True
```