diff options
| author | Dennis Fink | 2026-11-17 22:10:40 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-17 22:10:40 +0100 |
| commit | 63af533d98aac82b6d4f069b217d3e837285508d (patch) | |
| tree | 4ac11960f9676d3bb5a6f62204ef139862734209 /webmentions_ssg/forms | |
| parent | acd1f42847786963fc4aaeed884c3091700c9e35 (diff) | |
| download | webmentions-ssg-63af533d98aac82b6d4f069b217d3e837285508d.tar.gz webmentions-ssg-63af533d98aac82b6d4f069b217d3e837285508d.zip | |
feat(receiver): explain received Webmention failures
Map known verification failures to human-readable explanations and show
suggested next steps only for receiver-controlled problems while
retaining raw reasons.
Return a specific validation error when targets are outside
`ALLOWED_TARGET_HOSTNAMES` and reuse the guidance for status history.
Diffstat (limited to 'webmentions_ssg/forms')
| -rw-r--r-- | webmentions_ssg/forms/validators.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/webmentions_ssg/forms/validators.py b/webmentions_ssg/forms/validators.py index e65e9cb..a22c942 100644 --- a/webmentions_ssg/forms/validators.py +++ b/webmentions_ssg/forms/validators.py @@ -102,7 +102,14 @@ class AllowedTargetHostname: if hostname in current_app.config["ALLOWED_TARGET_HOSTNAMES"]: return - raise ValidationError(self.message or field.gettext("Invalid input.")) + raise ValidationError( + self.message + or field.gettext( + "Target hostname is not in ALLOWED_TARGET_HOSTNAMES." + if hostname is not None + else "Invalid input." + ) + ) class RejectNonPublicIPLiteral: |
