From a1f9f03fc1e88ba18a78ac77ae2128b919f5ce62 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Wed, 21 Aug 2024 18:49:20 +0200 Subject: [PATCH] Fix for #3130 (only last e-mail address is saved when specifying multiple e-reader mail addresses in user settings) --- cps/helper.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index c2fc9c23..529ed561 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -670,6 +670,7 @@ def check_username(username): def valid_email(emails): + valid_emails = [] for email in emails.split(','): email = strip_whitespaces(email) # if email is not deleted @@ -677,9 +678,10 @@ def valid_email(emails): # Regex according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#validation if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$", email): - log.error("Invalid Email address format") + log.error("Invalid Email address format for {}".format(email)) raise Exception(_("Invalid Email address format")) - return email + valid_emails.append(email) + return ",".join(valid_emails) def valid_password(check_password):