mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
prevent spaces in emails
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
This commit is contained in:
parent
358efdb51d
commit
0586c55e62
@ -871,6 +871,11 @@ class Member extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function onBeforeWrite()
|
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.
|
// 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),
|
// 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.
|
// but rather a last line of defense against data inconsistencies.
|
||||||
|
Loading…
Reference in New Issue
Block a user