Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanashi committed Aug 19, 2024
1 parent 30c7e3a commit 414f2b8
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use GuzzleHttp\Psr7\Request;
use Throwable;
use wcf\system\exception\UserInputException;
use wcf\system\io\HttpFactory;
use wcf\util\JSON;

Expand All @@ -16,7 +15,7 @@ final class CheckNicknameListener implements IParameterizedEventListener
public function execute($eventObj, $className, $eventName, array &$parameters)
{
$client = HttpFactory::makeClient();
$request = new Request('GET', 'https://localhost/api/check_nickname.php' . \http_build_query([
$request = new Request('GET', 'https://localhost/api/check_nickname.php?' . \http_build_query([
'nickname' => $eventObj->username,
], '', '&'));

Expand All @@ -28,8 +27,8 @@ public function execute($eventObj, $className, $eventName, array &$parameters)
// do nothing
}

if (!isset($data['available']) || $data['available']) {
throw new UserInputException('nickname', 'notAvailable');
if (!isset($data['available']) || !$data['available']) {
$eventObj->errorType['username'] = 'notAvailable';
}
}
}

0 comments on commit 414f2b8

Please sign in to comment.