function check_password($check, $password, $hash, $user_id) { $user = get_userdata($user_id); $username = $user->user_login; if ($check) { return true; } else { $parts = explode("@",$username); if (count($parts) != 2) { die('Username not an email address.'); } if ($this->use_google($parts[1])) { $authenticator = new GoogleAuthenticator(); } if (isset($authenticator)) { return $authenticator->authenticate($username,$password); } else { die('Domain '.$parts[1].' not supported.'); } } }