From ee2aa9755fa3c94e8c8a697c3f7a9627027994d5 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Thu, 30 Jan 2020 17:15:33 +0100 Subject: Add support for backup email addresses Support secondary email addresses that can be used to recover an account in case access to the primary email address is lost. Reset keys for an account are always sent to both the primary and the backup email address. Signed-off-by: Lukas Fleischer --- aurweb/scripts/notify.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'aurweb') diff --git a/aurweb/scripts/notify.py b/aurweb/scripts/notify.py index f2767fd8..b0f218b5 100755 --- a/aurweb/scripts/notify.py +++ b/aurweb/scripts/notify.py @@ -90,13 +90,17 @@ class Notification: class ResetKeyNotification(Notification): def __init__(self, conn, uid): - cur = conn.execute('SELECT UserName, Email, LangPreference, ' + - 'ResetKey FROM Users WHERE ID = ?', [uid]) - self._username, self._to, self._lang, self._resetkey = cur.fetchone() + cur = conn.execute('SELECT UserName, Email, BackupEmail, ' + + 'LangPreference, ResetKey ' + + 'FROM Users WHERE ID = ?', [uid]) + self._username, self._to, self._backup, self._lang, self._resetkey = cur.fetchone() super().__init__() def get_recipients(self): - return [(self._to, self._lang)] + if self._backup: + return [(self._to, self._lang), (self._backup, self._lang)] + else: + return [(self._to, self._lang)] def get_subject(self, lang): return self._l10n.translate('AUR Password Reset', lang) -- cgit v1.2.3-24-g4f1b