Whitespaces are striped from email address (fixes #2432)

This commit is contained in:
Ozzie Isaacs 2022-06-05 10:06:43 +02:00
parent d90cfce97f
commit 25f2af3f03

View File

@ -1264,13 +1264,13 @@ def update_mailsettings():
return edit_mailsettings() return edit_mailsettings()
else: else:
_config_string(to_save, "mail_server")
_config_int(to_save, "mail_port") _config_int(to_save, "mail_port")
_config_int(to_save, "mail_use_ssl") _config_int(to_save, "mail_use_ssl")
_config_string(to_save, "mail_login")
_config_string(to_save, "mail_password") _config_string(to_save, "mail_password")
_config_string(to_save, "mail_from")
_config_int(to_save, "mail_size", lambda y: int(y)*1024*1024) _config_int(to_save, "mail_size", lambda y: int(y)*1024*1024)
config.mail_server = to_save.get('mail_server', "").strip()
config.mail_from = to_save.get('mail_login', "").strip()
config.email = to_save.get('mail_login', "").strip()
try: try:
config.save() config.save()
except (OperationalError, InvalidRequestError) as e: except (OperationalError, InvalidRequestError) as e:
@ -1278,6 +1278,9 @@ def update_mailsettings():
log.error_or_exception("Settings Database error: {}".format(e)) log.error_or_exception("Settings Database error: {}".format(e))
flash(_(u"Database error: %(error)s.", error=e.orig), category="error") flash(_(u"Database error: %(error)s.", error=e.orig), category="error")
return edit_mailsettings() return edit_mailsettings()
except Exception as e:
flash(_(u"Database error: %(error)s.", error=e.orig), category="error")
return edit_mailsettings()
if to_save.get("test"): if to_save.get("test"):
if current_user.email: if current_user.email: