Skip to content

Commit

Permalink
add fallback password error message to password policy, fix validatio…
Browse files Browse the repository at this point in the history
…n policy

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Oct 25, 2024
1 parent 2942225 commit 9065277
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 4 additions & 0 deletions authentik/policies/password/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ def passes(self, request: PolicyRequest) -> PolicyResult:

def passes_static(self, password: str, request: PolicyRequest) -> PolicyResult:
"""Check static rules"""
error_message = self.error_message
if error_message == "":
error_message = _("Invalid password.")

Check warning on line 94 in authentik/policies/password/models.py

View check run for this annotation

Codecov / codecov/patch

authentik/policies/password/models.py#L92-L94

Added lines #L92 - L94 were not covered by tests

if len(password) < self.length_min:
LOGGER.debug("password failed", check="static", reason="length")
return PolicyResult(False, self.error_message)
Expand Down
8 changes: 2 additions & 6 deletions blueprints/default/flow-password-change.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ entries:
fields:
- !KeyOf prompt-field-password
- !KeyOf prompt-field-password-repeat
validation_policies:
- !KeyOf default-password-change-password-policy
identifiers:
name: default-password-change-prompt
id: default-password-change-prompt
Expand All @@ -68,10 +70,4 @@ entries:
order: 1
stage: !KeyOf default-password-change-write
target: !KeyOf flow
id: binding-password-change-write
model: authentik_flows.flowstagebinding
- identifiers:
order: 0
policy: !KeyOf default-password-change-password-policy
target: !KeyOf binding-password-change-write
model: authentik_policies.policybinding

0 comments on commit 9065277

Please sign in to comment.