mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-28 14:30:13 +00:00
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/47f426be-1843-41f2-85ff-8fcac1e6f3d6 Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
28 lines
878 B
PHP
28 lines
878 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace AIO\Controller;
|
|
|
|
use AIO\Desec\DesecManager;
|
|
use Psr\Http\Message\ResponseInterface as Response;
|
|
use Psr\Http\Message\ServerRequestInterface as Request;
|
|
|
|
readonly class DesecController {
|
|
public function __construct(
|
|
private DesecManager $desecManager,
|
|
) {
|
|
}
|
|
|
|
public function Register(Request $request, Response $response, array $args): Response {
|
|
try {
|
|
$email = (string)($request->getParsedBody()['desec_email'] ?? '');
|
|
$slug = (string)($request->getParsedBody()['desec_slug'] ?? '');
|
|
$this->desecManager->register($email, $slug);
|
|
return $response->withStatus(201)->withHeader('Location', '.');
|
|
} catch (\Exception $ex) {
|
|
$response->getBody()->write($ex->getMessage());
|
|
return $response->withStatus(422);
|
|
}
|
|
}
|
|
}
|