From 1c8b5382616bb8b1868676f63e939349c9b3f3e9 Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Sat, 15 Jun 2024 13:40:46 +1000 Subject: [PATCH] feat: Add error message for txt auth fail --- website/routes.py | 11 +++++++---- website/templates/{404.html => error.html} | 8 +++++++- 2 files changed, 14 insertions(+), 5 deletions(-) rename website/templates/{404.html => error.html} (95%) diff --git a/website/routes.py b/website/routes.py index 23e8652..be38a48 100644 --- a/website/routes.py +++ b/website/routes.py @@ -217,7 +217,9 @@ def txtLogin(): if next_page and next_page != "None": return redirect(next_page) - return redirect("/") + return render_template("error.html",error="The domain wasn't able to be authenticated.", + message="
Double check the TXT record and try again", + custom=""), 200 @bp.route("/txt/") def txtLoginDomain(domain): @@ -277,7 +279,9 @@ def txtLoginDomain(domain): if next_page and next_page != "None": return redirect(next_page) - return redirect("/") + return render_template("error.html",error="The domain wasn't able to be authenticated.", + message="
Double check the TXT record and try again", + custom=""), 200 @bp.route("/logout") def logout(): @@ -500,5 +504,4 @@ def favicon(): @bp.errorhandler(404) @bp.app_errorhandler(404) def page_not_found(e): - print(f'404 error: {e}') - return render_template("404.html"), 404 + return render_template("error.html",error="404 - Page Not Found"), 404 diff --git a/website/templates/404.html b/website/templates/error.html similarity index 95% rename from website/templates/404.html rename to website/templates/error.html index b26dd72..b0d12e5 100644 --- a/website/templates/404.html +++ b/website/templates/error.html @@ -110,7 +110,13 @@

HNS Login

-

404 - Page Not Found

+

{{error | safe}}

+

{{message|safe}}

+ +
+ {{custom|safe}} +
+ Return to Home