first attempt at confirmation mails

This commit is contained in:
b3yond 2018-01-08 01:16:34 +01:00
parent 2e80d10222
commit 89ce129b38
4 changed files with 28 additions and 6 deletions

View file

@ -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):

View file

@ -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>

View file

@ -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">

View file

@ -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>