feat: Redirect claim to signup page
All checks were successful
Build Docker / Build Main Image (push) Successful in 18s
Build Docker / Build SLDs Image (push) Successful in 19s

This commit is contained in:
Nathan Woodburn 2023-11-09 13:06:58 +11:00
parent 15b62ad29e
commit 5af1161579
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1
2 changed files with 14 additions and 4 deletions

16
main.py
View File

@ -81,7 +81,6 @@ def login():
@app.route('/edit')
def edit():
if 'token' not in request.cookies:
return redirect('/')
@ -152,11 +151,22 @@ def logout():
resp.set_cookie('token', '', expires=0)
return resp
@app.route('/claim')
def claim():
# Find domain
domain = request.args.get('domain')
return redirect('/signup?domain=' + domain)
@app.route('/<path:path>')
def catch_all(path):
account = "Login"
account_link = "login"
site = "Null"
domain = ""
if 'domain' in request.args:
domain = request.args.get('domain')
if 'token' in request.cookies:
token = request.cookies['token']
# Verify token
@ -174,11 +184,11 @@ def catch_all(path):
# If file exists, load it
if os.path.isfile('templates/' + path):
return render_template(path,account=account,account_link=account_link,site=site,CITY_DOMAIN=CITY_DOMAIN)
return render_template(path,account=account,account_link=account_link,site=site,CITY_DOMAIN=CITY_DOMAIN,domain=domain)
# Try with .html
if os.path.isfile('templates/' + path + '.html'):
return render_template(path + '.html',account=account,account_link=account_link,site=site,CITY_DOMAIN=CITY_DOMAIN)
return render_template(path + '.html',account=account,account_link=account_link,site=site,CITY_DOMAIN=CITY_DOMAIN,domain=domain)
return redirect('/') # 404 catch all
# 404 catch all

View File

@ -31,7 +31,7 @@
<h4 class="card-title" style="color: rgb(255,255,255);">Sign up for your free page</h4>
</div>
<form style="width: 80%;margin: auto;text-align: right;margin-top: 20px;" method="post">
<p class="tld" style="position: relative;display: inline;color: rgb(0,0,0);margin-right: 10px;">.{{CITY_DOMAIN}}</p><input class="form-control" type="text" id="domain" style="margin: auto;width: 100%;margin-top: -30px;" placeholder="yourname" name="domain" required=""><input class="form-control" type="email" style="margin: auto;width: 100%;margin-top: 10px;" placeholder="email" name="email" required=""><input class="form-control" type="password" style="margin: auto;width: 100%;margin-top: 10px;" name="password" placeholder="Password" required="" minlength="6"><input class="btn btn-primary" type="submit" style="margin-top: 10px;">
<p class="tld" style="position: relative;display: inline;color: rgb(0,0,0);margin-right: 10px;">.{{CITY_DOMAIN}}</p><input class="form-control" type="text" id="domain" style="margin: auto;width: 100%;margin-top: -30px;" placeholder="yourname" name="domain" required="" value="{{domain}}"><input class="form-control" type="email" style="margin: auto;width: 100%;margin-top: 10px;" placeholder="email" name="email" required=""><input class="form-control" type="password" style="margin: auto;width: 100%;margin-top: 10px;" name="password" placeholder="Password" required="" minlength="6"><input class="btn btn-primary" type="submit" style="margin-top: 10px;">
</form>
</div>
</section>