Fixes U2F, fixes #231

master
andryyy 2017-05-01 16:34:09 +02:00
parent 4cce211c22
commit ea77f60dae
2 changed files with 4 additions and 2 deletions

View File

@ -67,7 +67,7 @@ $(document).ready(function() {
type: "GET", type: "GET",
cache: false, cache: false,
dataType: 'script', dataType: 'script',
url: "/api/v1/u2f-authentication/<?=(isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null;?>", url: "/api/v1/get/u2f-authentication/<?=(isset($_SESSION['pending_mailcow_cc_username'])) ? $_SESSION['pending_mailcow_cc_username'] : null;?>",
success: function(data){ success: function(data){
data; data;
} }
@ -100,7 +100,7 @@ $(document).ready(function() {
type: "GET", type: "GET",
cache: false, cache: false,
dataType: 'script', dataType: 'script',
url: "/api/v1/u2f-registration/<?=(isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null;?>", url: "/api/v1/get/u2f-registration/<?=(isset($_SESSION['mailcow_cc_username'])) ? $_SESSION['mailcow_cc_username'] : null;?>",
success: function(data){ success: function(data){
data; data;
} }

View File

@ -235,6 +235,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
} }
break; break;
case "u2f-registration": case "u2f-registration":
header('Content-Type: application/javascript');
if (($_SESSION["mailcow_cc_role"] == "admin" || $_SESSION["mailcow_cc_role"] == "domainadmin") && $_SESSION["mailcow_cc_username"] == $object) { if (($_SESSION["mailcow_cc_role"] == "admin" || $_SESSION["mailcow_cc_role"] == "domainadmin") && $_SESSION["mailcow_cc_username"] == $object) {
$data = $u2f->getRegisterData(get_u2f_registrations($object)); $data = $u2f->getRegisterData(get_u2f_registrations($object));
list($req, $sigs) = $data; list($req, $sigs) = $data;
@ -246,6 +247,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
} }
break; break;
case "u2f-authentication": case "u2f-authentication":
header('Content-Type: application/javascript');
if (isset($_SESSION['pending_mailcow_cc_username']) && $_SESSION['pending_mailcow_cc_username'] == $object) { if (isset($_SESSION['pending_mailcow_cc_username']) && $_SESSION['pending_mailcow_cc_username'] == $object) {
$reqs = json_encode($u2f->getAuthenticateData(get_u2f_registrations($object))); $reqs = json_encode($u2f->getAuthenticateData(get_u2f_registrations($object)));
$_SESSION['authReq'] = $reqs; $_SESSION['authReq'] = $reqs;