confirmation: Use error status codes for confirmation link error pages.

This commit is contained in:
Mateusz Mandera
2021-11-30 12:51:22 +01:00
committed by Alex Vandiver
parent f338ff64c3
commit 720d16e809
4 changed files with 22 additions and 18 deletions

View File

@@ -34,10 +34,10 @@ def render_confirmation_key_error(
request: HttpRequest, exception: ConfirmationKeyException
) -> HttpResponse:
if exception.error_type == ConfirmationKeyException.WRONG_LENGTH:
return render(request, "confirmation/link_malformed.html")
return render(request, "confirmation/link_malformed.html", status=404)
if exception.error_type == ConfirmationKeyException.EXPIRED:
return render(request, "confirmation/link_expired.html")
return render(request, "confirmation/link_does_not_exist.html")
return render(request, "confirmation/link_expired.html", status=404)
return render(request, "confirmation/link_does_not_exist.html", status=404)
def generate_key() -> str: