diff --git a/frontend/login.py b/frontend/login.py index 6dffb8b..a2c79f7 100644 --- a/frontend/login.py +++ b/frontend/login.py @@ -2,6 +2,7 @@ import bottle import sqlite3 +import sendmail class Datagetter(object): def __init__(self): @@ -46,14 +47,33 @@ def register(): :return: bot.py Session Cookie """ - uname = bottle.request.forms.get('email') + email = bottle.request.forms.get('email') psw = bottle.request.forms.get('psw') pswrepeat = bottle.request.forms.get('psw-repeat') if pswrepeat != psw: return "ERROR: Passwords don't match. Try again." - # :todo send confirmation Mail with encoded email+passphrase to email - return "We Sent you an E-Mail. Please click on the confirmation link." + # needs to be encoded somehow + confirmlink = "ticketfrei.links-tech.org/confirm?email=" + email + "&passphrase=" + psw + config = "" + m = sendmail.Mailer(config) + m.send("Complete your registration here: " + confirmlink, email, "[Ticketfrei] Confirm your account") + return "We sent you an E-Mail. Please click on the confirmation link." + + +# How can I parse the arguments from the URI? +# https://ticketfrei.links-tech.org/confirm?user=asdf&pass=sup3rs3cur3 +@app.route('/confirm') +def confirmaccount(): + """ + Confirm the account creation and create a database entry. + :return: Redirection to bot.html + """ + uname = "user" # :todo get user from URI + passphrase = "pass" # :todo get passphrase from URI + active = "1" + db.conn.execute("CREATE ?, ?, ? IN user;", (uname, passphrase, active)) + @app.route('/static/<filename:path>') def static(filename): diff --git a/static/bot.html b/static/bot.html index 0141658..c08345d 100644 --- a/static/bot.html +++ b/static/bot.html @@ -5,7 +5,9 @@ <body> <!--<div class="background" style="background-image: url(static/img/bg_left.jpg)"></div>--> <div class="area"> - <img src="static/img/ticketfrei_logo.png" alt="Ticketfrei Logo" width="180px" align="left"> + <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> + + # Is the user logged in? else, complain & show nothing. <div class=footer> Contribute on <a href="https://github.com/b3yond/ticketfrei">GitHub!</a> diff --git a/static/index.html b/static/index.html index 6e2a37c..d4a491e 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><img src="/static/img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></h1> + <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> <form action="../login" method="POST"> <div class="container"> diff --git a/static/register.html b/static/register.html index 6ee8c7b..502743e 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><img src="img/ticketfrei_logo.png" alt="Ticketfrei" height="150px" align="center" style="float: none;"></h1> + <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> <form action="../register" method="post"> <div class="container"> <label><b>Email</b></label>