flarum / issue-archive

0 stars 0 forks source link

When user register, the email adress should be trimmed #446

Closed iPurpl3x closed 1 year ago

iPurpl3x commented 2 years ago

Bug Report

Current Behavior When a user registers, and adds a white-space at the end of the email, it gets saved just like that. Then this generates errors!

Error example:

flarum.ERROR: Swift_RfcComplianceException: Address in mailbox given [Example@exaple.com ] does not comply with RFC 2822, 3.6.2. in /opt/flarum/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:355

Expected Behavior The email address should be trimmed (and maybe also transformed to lower case)

Environment

Possible Solution

Trim the email before saving it. Also when changing it.

iPurpl3x commented 1 year ago

In the meantime, I run this query from time to time:

UPDATE users SET email = TRIM(email) WHERE email LIKE '% ';
iPurpl3x commented 1 year ago

In my case, the issue was related to a custom SSO integration. Issue fixed.