1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-09-21 03:39:46 +00:00

Fix for #3130 (only last e-mail address is saved when specifying multiple e-reader mail addresses in user settings)

This commit is contained in:
Ozzie Isaacs 2024-08-21 18:49:20 +02:00
parent 6a504673e5
commit a1f9f03fc1

View File

@ -670,6 +670,7 @@ def check_username(username):
def valid_email(emails): def valid_email(emails):
valid_emails = []
for email in emails.split(','): for email in emails.split(','):
email = strip_whitespaces(email) email = strip_whitespaces(email)
# if email is not deleted # 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 # 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])?)*$", if not re.search(r"^[\w.!#$%&'*+\\/=?^_`{|}~-]+@[\w](?:[\w-]{0,61}[\w])?(?:\.[\w](?:[\w-]{0,61}[\w])?)*$",
email): email):
log.error("Invalid Email address format") log.error("Invalid Email address format for {}".format(email))
raise Exception(_("Invalid Email address format")) raise Exception(_("Invalid Email address format"))
return email valid_emails.append(email)
return ",".join(valid_emails)
def valid_password(check_password): def valid_password(check_password):