From ea77f60dae33681c1257ed63aab5666048805c17 Mon Sep 17 00:00:00 2001 From: andryyy Date: Mon, 1 May 2017 16:34:09 +0200 Subject: [PATCH] Fixes U2F, fixes #231 --- data/web/inc/footer.inc.php | 4 ++-- data/web/json_api.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/data/web/inc/footer.inc.php b/data/web/inc/footer.inc.php index 6cf48242..3a3f9009 100644 --- a/data/web/inc/footer.inc.php +++ b/data/web/inc/footer.inc.php @@ -67,7 +67,7 @@ $(document).ready(function() { type: "GET", cache: false, dataType: 'script', - url: "/api/v1/u2f-authentication/", + url: "/api/v1/get/u2f-authentication/", success: function(data){ data; } @@ -100,7 +100,7 @@ $(document).ready(function() { type: "GET", cache: false, dataType: 'script', - url: "/api/v1/u2f-registration/", + url: "/api/v1/get/u2f-registration/", success: function(data){ data; } diff --git a/data/web/json_api.php b/data/web/json_api.php index 44e7d934..894a9442 100644 --- a/data/web/json_api.php +++ b/data/web/json_api.php @@ -235,6 +235,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u } break; case "u2f-registration": + header('Content-Type: application/javascript'); if (($_SESSION["mailcow_cc_role"] == "admin" || $_SESSION["mailcow_cc_role"] == "domainadmin") && $_SESSION["mailcow_cc_username"] == $object) { $data = $u2f->getRegisterData(get_u2f_registrations($object)); list($req, $sigs) = $data; @@ -246,6 +247,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u } break; case "u2f-authentication": + header('Content-Type: application/javascript'); if (isset($_SESSION['pending_mailcow_cc_username']) && $_SESSION['pending_mailcow_cc_username'] == $object) { $reqs = json_encode($u2f->getAuthenticateData(get_u2f_registrations($object))); $_SESSION['authReq'] = $reqs;