Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
2 | require_once(__DIR__."/../core.php"); | ||||
3 | security::checkType(security::WORKER, security::METHOD_NOTFOUND); | ||||
4 | secondFactor::checkAvailability(); | ||||
5 | |||||
6 | if ($_SERVER['REQUEST_METHOD'] !== "POST") { | ||||
7 | api::error('This method should be called with POST.'); | ||||
8 | } | ||||
9 | |||||
10 | try { | ||||
11 | $result = secondFactor::createRegistrationChallenge(); | ||||
12 | } catch (Throwable $e) { | ||||
13 | api::error('An unexpected error occurred: ' . $e->getMessage()); | ||||
14 | } | ||||
15 | |||||
16 | api::write($result); |