diff --git a/flow_invitation.yaml.tmpl b/flow_invitation.yaml.tmpl index d3f6240..db470cc 100644 --- a/flow_invitation.yaml.tmpl +++ b/flow_invitation.yaml.tmpl @@ -24,6 +24,18 @@ entries: id: invitation-enrollment-flow model: authentik_flows.flow +### POLICIES +- attrs: + expression: | + if not regex_match(request.context.get('prompt_data').get('username'), '\s'): + return True + ak_message("Username must not contain any whitespace!") + return False + id: username-without-spaces-policy + identifiers: + name: username-without-spaces-policy + model: authentik_policies_expression.expressionpolicy + ### STAGES - identifiers: name: invitation-stage @@ -41,6 +53,8 @@ entries: - !Find [authentik_stages_prompt.prompt, [name, default-user-settings-field-email]] - !Find [authentik_stages_prompt.prompt, [name, default-password-change-field-password]] - !Find [authentik_stages_prompt.prompt, [name, default-password-change-field-password-repeat]] + validation_policies: + - !Find [ authentik_policies_expression.expressionpolicy, [name, username-without-spaces-policy]] ### STAGE BINDINGS - identifiers: