mirror of
https://github.com/error311/FileRise.git
synced 2026-05-20 04:29:23 -05:00
41 lines
1.3 KiB
PHP
41 lines
1.3 KiB
PHP
<?php
|
|
// public/api/totp_setup.php
|
|
|
|
/**
|
|
* @OA\Get(
|
|
* path="/api/totp_setup.php",
|
|
* summary="Set up TOTP and generate a QR code",
|
|
* description="Generates (or retrieves) the TOTP secret for the user and builds a QR code image for scanning.",
|
|
* operationId="setupTOTP",
|
|
* tags={"TOTP"},
|
|
* security={{"cookieAuth": {}}},
|
|
* @OA\Parameter(name="X-CSRF-Token", in="header", required=true, @OA\Schema(type="string")),
|
|
* @OA\Response(
|
|
* response=200,
|
|
* description="QR code image for TOTP setup",
|
|
* @OA\MediaType(
|
|
* mediaType="image/png"
|
|
* )
|
|
* ),
|
|
* @OA\Response(
|
|
* response=400,
|
|
* description="Missing username"
|
|
* ),
|
|
* @OA\Response(
|
|
* response=403,
|
|
* description="Not authorized or invalid CSRF token"
|
|
* ),
|
|
* @OA\Response(
|
|
* response=500,
|
|
* description="Server error"
|
|
* )
|
|
* )
|
|
*/
|
|
|
|
require_once __DIR__ . '/../../config/config.php';
|
|
require_once PROJECT_ROOT . '/vendor/autoload.php';
|
|
require_once PROJECT_ROOT . '/src/controllers/UserController.php';
|
|
|
|
$userController = new UserController();
|
|
$userController->setupTOTP();
|