. */ namespace Liuch\DmarcSrg; use Liuch\DmarcSrg\ErrorHandler; use Liuch\DmarcSrg\Exception\RuntimeException; require realpath(__DIR__ . '/..') . '/init.php'; if (Core::requestMethod() == 'POST' && Core::isJson()) { $jdata = Core::getJsonData(); if ($jdata && isset($jdata['password'])) { try { Core::sendJson( Core::instance()->auth()->login(strval($jdata['username'] ?? ''), strval($jdata['password'])) ); } catch (RuntimeException $e) { Core::sendJson(ErrorHandler::exceptionResult($e)); } return; } } Core::sendBad();