wip add username whitespace check to invitation flow blueprint

This commit is contained in:
Simon 2024-02-15 15:02:38 +01:00
parent 7a4daaf475
commit 00608c1143
2 changed files with 32 additions and 0 deletions

View File

@ -24,6 +24,24 @@ entries:
id: invitation-enrollment-flow
model: authentik_flows.flow
### POLICIES
- attrs:
expression: "if not regex_match(request.context.get('prompt_data').get('username'),\
\ '\\s'):\n return True\n\nak_message(\"Username must not contain\
\ whitespace!\")\nreturn False"
name: username-without-spaces-policy
id: username-without-spaces-policy
identifiers:
name: username-without-spaces-policy
model: authentik_policies_expression.expressionpolicy
### POLICY BINDINGS
- identifiers:
policy: !KeyOf username-without-spaces-policy
target: !KeyOf prompt-stage-binding
order: 10
model: authentik_policies.policybinding
### STAGES
- identifiers:
name: invitation-stage
@ -53,6 +71,7 @@ entries:
stage: !KeyOf enrollment-prompt-userdata
target: !KeyOf invitation-enrollment-flow
model: authentik_flows.flowstagebinding
id: prompt-stage-binding
- identifiers:
order: 20
stage: !Find [authentik_stages_user_write.userwritestage, [name, default-source-enrollment-write]]

View File

@ -69,3 +69,16 @@ entries:
attrs:
label: !Context transl_username
placeholder: !Context transl_username
### POLICIES
- model: authentik_policies_expression.expressionpolicy
identifiers:
name: username-without-spaces-policy
attrs:
expression: "if not regex_match(request.context.get('prompt_data').get('username'),\
\ '\\s'):\n return True\n\nak_message(\"Benutzername darf kein Leerzeichen\
\ enthalten\")\nreturn False"
name: username-without-spaces-policy
id: username-without-spaces-policy
Benutzername darf kein Leerzeichen enthalten\")\n