added mail subscriber function, confirm missing

This commit is contained in:
b3yond 2018-07-22 13:56:15 +02:00
parent a05205289f
commit 9beb864a2f
2 changed files with 5 additions and 0 deletions

View file

@ -96,6 +96,8 @@ def display_mail_page(city, user):
@post('/city/mail/submit/<city>')
def subscribe_mail(user, city):
email = request.forms['mailaddress']
# add confirmation mail workflow
user.add_subscriber(email)
redirect('/city/' + city)

View file

@ -156,6 +156,9 @@ schlitz
(self.uid,))
return db.cur.fetchone()[0]
def add_subscriber(self, email):
db.execute("INSERT INTO mailinglist(user_id, email, active VALUES(?, ?, ?);", (self.uid, email, 1))
def set_badwords(self, words):
db.execute("UPDATE badwords SET words = ? WHERE user_id = ?;",
(words, self.uid))