mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Fix incorrect response in case when user's profile for provided UUID can't be found
This commit is contained in:
@@ -110,11 +110,10 @@ class SessionController extends Controller {
|
||||
/**
|
||||
* @param string $uuid
|
||||
*
|
||||
* @return array
|
||||
* @throws ForbiddenOperationException
|
||||
* @return array|null
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public function actionProfile(string $uuid): array {
|
||||
public function actionProfile(string $uuid): ?array {
|
||||
try {
|
||||
$uuid = Uuid::fromString($uuid)->toString();
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
@@ -124,7 +123,8 @@ class SessionController extends Controller {
|
||||
/** @var Account|null $account */
|
||||
$account = Account::find()->excludeDeleted()->andWhere(['uuid' => $uuid])->one();
|
||||
if ($account === null) {
|
||||
throw new ForbiddenOperationException('Invalid uuid.');
|
||||
Yii::$app->response->setStatusCode(204);
|
||||
return null;
|
||||
}
|
||||
|
||||
return (new Textures($account))->getMinecraftResponse();
|
||||
|
Reference in New Issue
Block a user