login check with cookies works now. fixed some layout stuff
This commit is contained in:
parent
1b75e03fc5
commit
a7bae0aed9
|
@ -49,8 +49,8 @@ def login():
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return "Wrong Credentials." # no user with this email
|
return "Wrong Credentials." # no user with this email
|
||||||
if pylibscrypt.scrypt_mcf_check(pass_hashed, psw):
|
if pylibscrypt.scrypt_mcf_check(pass_hashed, psw):
|
||||||
# :todo Generate Session Cookie and give to user
|
bottle.response.set_cookie("account", uname, secret)
|
||||||
return bottle.static_file("../static/bot.html", root="../static")
|
return bottle.redirect("/settings")
|
||||||
else:
|
else:
|
||||||
return "Wrong Credentials." # passphrase is wrong
|
return "Wrong Credentials." # passphrase is wrong
|
||||||
|
|
||||||
|
@ -106,7 +106,21 @@ def confirmaccount(encoded_jwt):
|
||||||
# create db entry
|
# create db entry
|
||||||
db.cur.execute("INSERT INTO user(email, pass_hashed, enabled) VALUES(?, ?, ?);", (uname, pass_hashed, True))
|
db.cur.execute("INSERT INTO user(email, pass_hashed, enabled) VALUES(?, ?, ?);", (uname, pass_hashed, True))
|
||||||
db.conn.commit()
|
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>')
|
@app.route('/static/<filename:path>')
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body style="background-image: url(/static/img/wallpaper.png)">
|
<body style="background-image: url(/static/img/wallpaper.png)">
|
||||||
<div class="area">
|
<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.
|
# Is the user logged in? else, complain & show nothing.
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ body {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
min-height: 100%;
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
|
@ -61,4 +63,8 @@ input[type=text], input[type=password] {
|
||||||
|
|
||||||
.footer {
|
.footer {
|
||||||
padding: 2em;
|
padding: 2em;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
text-align: center;
|
||||||
|
width: 540px;
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@
|
||||||
<body style="background-image: url(static/img/wallpaper.png)">
|
<body style="background-image: url(static/img/wallpaper.png)">
|
||||||
<div class="area">
|
<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">
|
<form action="../login" method="POST">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -68,6 +68,7 @@
|
||||||
popular during the Renaissance. The first line of Lorem
|
popular during the Renaissance. The first line of Lorem
|
||||||
Ipsum, "Lorem ipsum dolor sit amet..", comes from a line
|
Ipsum, "Lorem ipsum dolor sit amet..", comes from a line
|
||||||
in section 1.10.32.</p>
|
in section 1.10.32.</p>
|
||||||
|
<br>
|
||||||
</div>
|
</div>
|
||||||
<div class=footer>
|
<div class=footer>
|
||||||
Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a>
|
Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<body style="background-image: url(img/wallpaper.png)">
|
<body style="background-image: url(img/wallpaper.png)">
|
||||||
<div class="area">
|
<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">
|
<form action="../register" method="post">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<label><b>Email</b></label>
|
<label><b>Email</b></label>
|
||||||
|
|
Loading…
Reference in a new issue