Skip to content

Commit f4220cc

Browse files
authored
Report error when email is not valid
1 parent 9913af9 commit f4220cc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Charcoal/Property/EmailProperty.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,14 @@ public function validateEmail()
5050
if ($this['allowNull'] && !$this['required']) {
5151
return true;
5252
}
53+
5354
$val = $this->val();
54-
$emailValid = filter_var($val, FILTER_VALIDATE_EMAIL);
55-
return !!$emailValid;
55+
if (!filter_var($val, FILTER_VALIDATE_EMAIL)) {
56+
$this->validator()->error('Value is not an email address.', 'email');
57+
return false;
58+
}
59+
60+
return true;
5661
}
5762

5863
/**

0 commit comments

Comments
 (0)