diff --git a/frontend/website.py b/frontend/website.py index 1f8a67a..0879afc 100644 --- a/frontend/website.py +++ b/frontend/website.py @@ -49,8 +49,8 @@ def login(): except TypeError: return "Wrong Credentials." # no user with this email if pylibscrypt.scrypt_mcf_check(pass_hashed, psw): - # :todo Generate Session Cookie and give to user - return bottle.static_file("../static/bot.html", root="../static") + bottle.response.set_cookie("account", uname, secret) + return bottle.redirect("/settings") else: return "Wrong Credentials." # passphrase is wrong @@ -106,7 +106,21 @@ def confirmaccount(encoded_jwt): # create db entry db.cur.execute("INSERT INTO user(email, pass_hashed, enabled) VALUES(?, ?, ?);", (uname, pass_hashed, True)) db.conn.commit() - return bottle.static_file("../static/bot.html", root='../static') + bottle.response.set_cookie("account", uname, secret) + return bottle.redirect("/settings") + + +@app.route('/settings') +def manage_bot(): + """ + Restricted area. Deliver the bot settings page. + :return: + """ + uname = bottle.request.get_cookie("account", secret=secret) + if uname is not None: + return bottle.static_file("../static/bot.html", root='../static') + else: + bottle.abort(401, "Sorry, access denied.") @app.route('/static/<filename:path>') diff --git a/static/bot.html b/static/bot.html index e4a8a83..e8c363d 100644 --- a/static/bot.html +++ b/static/bot.html @@ -4,7 +4,7 @@ </head> <body style="background-image: url(/static/img/wallpaper.png)"> <div class="area"> - <h1><a href="https://ticketfrei.links-tech.org"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> + <h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> # Is the user logged in? else, complain & show nothing. diff --git a/static/css/style.css b/static/css/style.css index 90a7178..f3ea143 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -12,6 +12,8 @@ body { margin-left: auto; margin-right: auto; text-align: center; + min-height: 100%; + position: relative; } .text { @@ -61,4 +63,8 @@ input[type=text], input[type=password] { .footer { padding: 2em; + position: absolute; + bottom: 0; + text-align: center; + width: 540px; } \ No newline at end of file diff --git a/static/index.html b/static/index.html index d4a491e..9c9a15d 100644 --- a/static/index.html +++ b/static/index.html @@ -5,7 +5,7 @@ <body style="background-image: url(static/img/wallpaper.png)"> <div class="area"> - <h1><a href="https://ticketfrei.links-tech.org"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> + <h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> <form action="../login" method="POST"> <div class="container"> @@ -68,6 +68,7 @@ popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.</p> + <br> </div> <div class=footer> Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a> diff --git a/static/register.html b/static/register.html index 502743e..efa9142 100644 --- a/static/register.html +++ b/static/register.html @@ -5,7 +5,7 @@ <body style="background-image: url(img/wallpaper.png)"> <div class="area"> - <h1><a href="https://ticketfrei.links-tech.org"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> + <h1><a href="/"><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></a></h1> <form action="../register" method="post"> <div class="container"> <label><b>Email</b></label>