Copybara bot | be50d49 | 2023-11-30 00:16:42 +0100 | [diff] [blame] | 1 | <?php |
| 2 | require_once(__DIR__."/../core.php"); |
| 3 | |
| 4 | if (!secondFactor::isAvailable() || security::userType() !== security::UNKNOWN || !isset($_SESSION["firstfactorid"]) || !secondFactor::isEnabled($_SESSION["firstfactorid"]) || !secondFactor::hasSecurityKeys($_SESSION["firstfactorid"]) || $_SERVER['REQUEST_METHOD'] !== "POST") { |
| 5 | api::error(); |
| 6 | } |
| 7 | |
| 8 | try { |
| 9 | $result = secondFactor::createValidationChallenge(); |
| 10 | } catch (Throwable $e) { |
| 11 | api::error($conf['debug'] ? $e->getMessage() : null); |
| 12 | } |
| 13 | |
| 14 | if (isset($result->publicKey)) $result->publicKey->rpId = ($conf["secondFactor"]["origin"] ?? null); |
| 15 | |
| 16 | api::write($result); |