From 9beb864a2fb05d4ca52600bb2fd69ba651469bbf Mon Sep 17 00:00:00 2001 From: b3yond Date: Sun, 22 Jul 2018 13:56:15 +0200 Subject: [PATCH] added mail subscriber function, confirm missing --- frontend.py | 2 ++ user.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/frontend.py b/frontend.py index d53bd28..943a62a 100755 --- a/frontend.py +++ b/frontend.py @@ -96,6 +96,8 @@ def display_mail_page(city, user): @post('/city/mail/submit/') def subscribe_mail(user, city): email = request.forms['mailaddress'] + # add confirmation mail workflow + user.add_subscriber(email) redirect('/city/' + city) diff --git a/user.py b/user.py index 13a8105..ae4a82c 100644 --- a/user.py +++ b/user.py @@ -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))