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 bottle
import sqlite3 import sqlite3
import sendmail
class Datagetter(object): class Datagetter(object):
def __init__(self): def __init__(self):
@ -46,14 +47,33 @@ def register():
:return: bot.py Session Cookie :return: bot.py Session Cookie
""" """
uname = bottle.request.forms.get('email') email = bottle.request.forms.get('email')
psw = bottle.request.forms.get('psw') psw = bottle.request.forms.get('psw')
pswrepeat = bottle.request.forms.get('psw-repeat') pswrepeat = bottle.request.forms.get('psw-repeat')
if pswrepeat != psw: if pswrepeat != psw:
return "ERROR: Passwords don't match. Try again." return "ERROR: Passwords don't match. Try again."
# :todo send confirmation Mail with encoded email+passphrase to email # needs to be encoded somehow
return "We Sent you an E-Mail. Please click on the confirmation link." 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>') @app.route('/static/<filename:path>')
def static(filename): def static(filename):

View file

@ -5,7 +5,9 @@
<body> <body>
<!--<div class="background" style="background-image: url(static/img/bg_left.jpg)"></div>--> <!--<div class="background" style="background-image: url(static/img/bg_left.jpg)"></div>-->
<div class="area"> <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> <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>

View file

@ -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><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"> <form action="../login" method="POST">
<div class="container"> <div class="container">

View file

@ -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><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"> <form action="../register" method="post">
<div class="container"> <div class="container">
<label><b>Email</b></label> <label><b>Email</b></label>