This commit is contained in:
2026-10-03 14:33:08 +04:00
parent 6a73d760c4
commit 93a9442e1c
67 changed files with 941 additions and 698 deletions
@@ -5,29 +5,29 @@ namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Requests\LoginRequest;
use App\Models\GameAccount;
use App\Services\AzerothCoreAccountService;
use App\Services\VMangosAccountService;
use Illuminate\Http\JsonResponse;
use OpenApi\Attributes as OA;
class LauncherAuthController extends Controller
{
public function __construct(
private readonly AzerothCoreAccountService $accounts,
private readonly VMangosAccountService $accounts,
) {
}
#[OA\Post(
path: '/api/launcher/login',
summary: 'Авторизация лаунчера',
description: 'Авторизация по логину и паролю игрового аккаунта. Возвращает Bearer-токен для доступа к API.',
description: 'Авторизация по логину и паролю сайта. Возвращает Bearer-токен для доступа к API и выдачи игрового билета.',
tags: ['Launcher Auth'],
requestBody: new OA\RequestBody(
required: true,
content: new OA\JsonContent(
required: ['username', 'password'],
properties: [
new OA\Property(property: 'username', type: 'string', minLength: 3, maxLength: 32, pattern: '^[A-Za-z0-9]+$', example: 'Player'),
new OA\Property(property: 'password', type: 'string', minLength: 3, maxLength: 32, example: 'secret123'),
new OA\Property(property: 'username', type: 'string', minLength: 3, maxLength: 16, pattern: '^[A-Za-z0-9]+$', example: 'Player'),
new OA\Property(property: 'password', type: 'string', minLength: 3, maxLength: 16, example: 'secret123'),
],
),
),
@@ -75,7 +75,7 @@ class LauncherAuthController extends Controller
], 401);
}
$gameAccount = GameAccount::on('azerothcore_auth')->findOrFail($user->id);
$gameAccount = GameAccount::on('vmangos_auth')->findOrFail($user->id);
$token = $gameAccount->createToken('launcher');
return response()->json([