Strip whitespace from email address before validating

This commit is contained in:
2015-04-21 11:06:40 +10:00
parent 515c2e67d7
commit eae1bf0f31

View File

@@ -5,6 +5,10 @@
* Helper function to perform some validity checking of email addresses * Helper function to perform some validity checking of email addresses
*/ */
function _valid_email_address($email) { function _valid_email_address($email) {
//strip any leading or trailing whitespace
$email = trim($email);
//firstly use the built-in function to validate the format //firstly use the built-in function to validate the format
if (! valid_email_address($email)) { if (! valid_email_address($email)) {
watchdog('booking', "Drupal validation of email address '!email' returns false.", array('!email' => $email)); watchdog('booking', "Drupal validation of email address '!email' returns false.", array('!email' => $email));