feat: Add error message for txt auth fail
All checks were successful
Build Docker / Build Docker (push) Successful in 32s

This commit is contained in:
Nathan Woodburn 2024-06-15 13:40:46 +10:00
parent e66ae58494
commit 1c8b538261
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 14 additions and 5 deletions

View File

@ -217,7 +217,9 @@ def txtLogin():
if next_page and next_page != "None": if next_page and next_page != "None":
return redirect(next_page) return redirect(next_page)
return redirect("/") return render_template("error.html",error="The domain wasn't able to be authenticated.",
message="<br>Double check the TXT record and try again",
custom="<button onclick='window.location.reload();'>Try again</button>"), 200
@bp.route("/txt/<domain>") @bp.route("/txt/<domain>")
def txtLoginDomain(domain): def txtLoginDomain(domain):
@ -277,7 +279,9 @@ def txtLoginDomain(domain):
if next_page and next_page != "None": if next_page and next_page != "None":
return redirect(next_page) return redirect(next_page)
return redirect("/") return render_template("error.html",error="The domain wasn't able to be authenticated.",
message="<br>Double check the TXT record and try again",
custom="<button onclick='window.location.reload();'>Try again</button>"), 200
@bp.route("/logout") @bp.route("/logout")
def logout(): def logout():
@ -500,5 +504,4 @@ def favicon():
@bp.errorhandler(404) @bp.errorhandler(404)
@bp.app_errorhandler(404) @bp.app_errorhandler(404)
def page_not_found(e): def page_not_found(e):
print(f'404 error: {e}') return render_template("error.html",error="404 - Page Not Found"), 404
return render_template("404.html"), 404

View File

@ -110,7 +110,13 @@
<body> <body>
<h1>HNS Login</h1> <h1>HNS Login</h1>
<h2>404 - Page Not Found</h2> <h2>{{error | safe}}</h2>
<p>{{message|safe}}</p>
<div style="text-align: center;">
{{custom|safe}}
</div>
<a href="/" class="button">Return to Home</a> <a href="/" class="button">Return to Home</a>