Updated buttons to refresh and made token expire page

This commit is contained in:
Tracker-Friendly 2023-11-19 11:59:26 +00:00
parent 01d7cb5ab0
commit 96651720fd
6 changed files with 24 additions and 5 deletions

2
app.py
View File

@ -120,7 +120,7 @@ def register():
# Check if the submitted token matches the one in the session # Check if the submitted token matches the one in the session
if submitted_token != session.get('unique_token'): if submitted_token != session.get('unique_token'):
# Token mismatch, handle accordingly # Token mismatch, handle accordingly
return "Token Expired", 400 return render_template('expired.html'), 400
# Generate a new unique token for the next request # Generate a new unique token for the next request
session['unique_token'] = str(uuid.uuid4()) session['unique_token'] = str(uuid.uuid4())

View File

@ -13,7 +13,7 @@
<h1>Error!</h1> <h1>Error!</h1>
<p1>Incorrect CAPTCHA!</p1> <p1>Incorrect CAPTCHA!</p1>
<div class=spacer2> <div class=spacer2>
<button onclick="history.back()">Go Back</button> <button onclick="location.href = '/register';">Go Back</button>
</div> </div>
</div> </div>
</body><style type="text/css"></style></html> </body><style type="text/css"></style></html>

View File

@ -13,7 +13,7 @@
<h1>Error!</h1> <h1>Error!</h1>
<p1>Something went wrong on our end - the mail server could be down. Please try again later.</p1> <p1>Something went wrong on our end - the mail server could be down. Please try again later.</p1>
<div class=spacer2> <div class=spacer2>
<button onclick="history.back()">Go Back</button> <button onclick="location.href = '/register';">Go Back</button>
</div> </div>
</div> </div>
</body><style type="text/css"></style></html> </body><style type="text/css"></style></html>

19
templates/expired.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Error!</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
</head>
<body>
<div class="headerbar">
<a href="/">HectaMail</a>
<a class="main" href="/register">Sign up</a>
</div>
<div class="content">
<h1>Error!</h1>
<p1>Your CAPTCHA has expired. Please use the "Go Back" button rather than pressing the arrow in your browser.</p1>
<div class=spacer2>
<button onclick="location.href = '/register';">Go Back</button>
</div>
</div>
</body><style type="text/css"></style></html>

View File

@ -13,7 +13,7 @@
<h1>Error!</h1> <h1>Error!</h1>
<p1>You can only have Alphanumerical characters and periods in your username!</p1> <p1>You can only have Alphanumerical characters and periods in your username!</p1>
<div class=spacer2> <div class=spacer2>
<button onclick="history.back()">Go Back</button> <button onclick="location.href = '/register';">Go Back</button>
</div> </div>
</div> </div>
</body><style type="text/css"></style></html> </body><style type="text/css"></style></html>

View File

@ -13,7 +13,7 @@
<h1>Done!</h1> <h1>Done!</h1>
<p1>Success! Add this to your favourite email program with the infomation noted on the main page!</p1> <p1>Success! Add this to your favourite email program with the infomation noted on the main page!</p1>
<div class=spacer2> <div class=spacer2>
<button onclick="window.location.replace('/')">Go to home</button> <button onclick="location.href = '/';">Go to home</button>
</div> </div>
</div> </div>
</body><style type="text/css"></style></html> </body><style type="text/css"></style></html>