Skip to content

Commit

Permalink
prevent spaces in emails
Browse files Browse the repository at this point in the history
so this is not the first time a customer of mine is just copy pasting stuff in emails fields and somehow, a space at the end skips validation. this update ensure there is no space before or after the email, it would probably save a lot of time for everyone to have this build in.
it's probably better to fix it here rather than at form level because this also happens for csv imports etc
  • Loading branch information
lekoala committed Mar 19, 2021
1 parent 358efdb commit 0586c55
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Security/Member.php
Expand Up @@ -871,6 +871,11 @@ public static function create_new_password()
*/
public function onBeforeWrite()
{
// Prevent spaces in emails
if($this->Email) {
$this->Email = trim($this->Email);
}

// If a member with the same "unique identifier" already exists with a different ID, don't allow merging.
// Note: This does not a full replacement for safeguards in the controller layer (e.g. in a registration form),
// but rather a last line of defense against data inconsistencies.
Expand Down

0 comments on commit 0586c55

Please sign in to comment.