added mail subscriber function, confirm missing
This commit is contained in:
parent
a05205289f
commit
9beb864a2f
|
@ -96,6 +96,8 @@ def display_mail_page(city, user):
|
||||||
@post('/city/mail/submit/<city>')
|
@post('/city/mail/submit/<city>')
|
||||||
def subscribe_mail(user, city):
|
def subscribe_mail(user, city):
|
||||||
email = request.forms['mailaddress']
|
email = request.forms['mailaddress']
|
||||||
|
# add confirmation mail workflow
|
||||||
|
user.add_subscriber(email)
|
||||||
redirect('/city/' + city)
|
redirect('/city/' + city)
|
||||||
|
|
||||||
|
|
||||||
|
|
3
user.py
3
user.py
|
@ -156,6 +156,9 @@ schlitz
|
||||||
(self.uid,))
|
(self.uid,))
|
||||||
return db.cur.fetchone()[0]
|
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):
|
def set_badwords(self, words):
|
||||||
db.execute("UPDATE badwords SET words = ? WHERE user_id = ?;",
|
db.execute("UPDATE badwords SET words = ? WHERE user_id = ?;",
|
||||||
(words, self.uid))
|
(words, self.uid))
|
||||||
|
|
Loading…
Reference in a new issue