Browse Source

Update and Remove isValidEmail

change function calls, and remove unneeded function.
pull/6102/head
Adam Magness 3 years ago
parent
commit
e4354a0d7b
5 changed files with 4 additions and 16 deletions
  1. +1
    -1
      mod/dirfind.php
  2. +1
    -1
      mod/invite.php
  3. +1
    -1
      mod/settings.php
  4. +1
    -1
      src/Model/User.php
  5. +0
    -12
      src/Util/Strings.php

+ 1
- 1
mod/dirfind.php View File

@ -53,7 +53,7 @@ function dirfind_content(App $a, $prefix = "") {
if (strpos($search,'@') === 0) {
$search = substr($search,1);
$header = L10n::t('People Search - %s', $search);
if ((Strings::isValidEmail($search) && Network::isEmailDomainValid($search)) ||
if ((filter_var($search, FILTER_VALIDATE_EMAIL) && Network::isEmailDomainValid($search)) ||
(substr(Strings::normaliseLink($search), 0, 7) == "http://")) {
$user_data = Probe::uri($search);
$discover_user = (in_array($user_data["network"], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::DIASPORA]));


+ 1
- 1
mod/invite.php View File

@ -56,7 +56,7 @@ function invite_post(App $a)
foreach ($recipients as $recipient) {
$recipient = trim($recipient);
if (! Strings::isValidEmail($recipient)) {
if (!filter_var($recipient, FILTER_VALIDATE_EMAIL)) {
notice(L10n::t('%s : Not a valid email address.', $recipient) . EOL);
continue;
}


+ 1
- 1
mod/settings.php View File

@ -517,7 +517,7 @@ function settings_post(App $a)
$email = $a->user['email'];
}
// check the email is valid
if (!Strings::isValidEmail($email)) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$err .= L10n::t('Invalid email.');
}
// ensure new email is not the admin mail


+ 1
- 1
src/Model/User.php View File

@ -499,7 +499,7 @@ class User
throw new Exception(L10n::t('Your email domain is not among those allowed on this site.'));
}
if (!Strings::isValidEmail($email) || !Network::isEmailDomainValid($email)) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL) || !Network::isEmailDomainValid($email)) {
throw new Exception(L10n::t('Not a valid email address.'));
}
if (self::isNicknameBlocked($nickname)) {


+ 0
- 12
src/Util/Strings.php View File

@ -353,18 +353,6 @@ class Strings
return $ret;
}
/**
* @brief Check for a valid email string
*
* @param string $email_address Email address to be evaluated.
*
* @return boolean Value indicating whether or not the string is a valid email address.
*/
public static function isValidEmail($email_address)
{
return preg_match('/^[_a-zA-Z0-9\-\+]+(\.[_a-zA-Z0-9\-\+]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)+$/', $email_address);
}
/**
* @brief Normalize url
*


Loading…
Cancel
Save