Пример #1
0
    public function login_with_email($event)
    {
        if (!defined('ADMIN_START') && $this->config['allow_email_login']) {
            $user_email = $event['username_clean'];
            if (!phpbb_validate_email($user_email)) {
                $sql = $event['sql'];
                $sql = 'SELECT *
					FROM ' . USERS_TABLE . "\n\t\t\t\t\tWHERE user_email_hash = '" . phpbb_email_hash($user_email) . "'";
                $event['sql'] = $sql;
            }
        }
    }
 private function validate_email($email)
 {
     $error = array();
     if (!function_exists('phpbb_validate_email')) {
         include $this->root_path . 'includes/functions_user.' . $this->php_ext;
     }
     $error = phpbb_validate_email($email);
     return $error;
 }
Пример #3
0
/**
* Check to see if email address is banned or already present in the DB
*
* @param string $email The email to check
* @param string $allowed_email An allowed email, default being $user->data['user_email']
*
* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended)
*/
function validate_user_email($email, $allowed_email = false)
{
    global $config, $db, $user;
    $email = strtolower($email);
    $allowed_email = $allowed_email === false ? strtolower($user->data['user_email']) : strtolower($allowed_email);
    if ($allowed_email == $email) {
        return false;
    }
    $validate_email = phpbb_validate_email($email, $config);
    if ($validate_email) {
        return $validate_email;
    }
    if (($ban_reason = $user->check_ban(false, false, $email, true)) !== false) {
        return $ban_reason === true ? 'EMAIL_BANNED' : $ban_reason;
    }
    if (!$config['allow_emailreuse']) {
        $sql = 'SELECT user_email_hash
			FROM ' . USERS_TABLE . "\n\t\t\tWHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email));
        $result = $db->sql_query($sql);
        $row = $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if ($row) {
            return 'EMAIL_TAKEN';
        }
    }
    return false;
}
Пример #4
0
 /**
  * Check email
  *
  * @return object
  */
 public function email()
 {
     $email = utf8_normalize_nfc(request_var('email', '', true));
     if ($return = phpbb_validate_email($email)) {
         $return = $this->user->lang($return . '_EMAIL');
     } else {
         $return = 0;
     }
     return new Response($return);
 }