authtest: do a better job of success/failure indication
This commit is contained in:
parent
9728a1303d
commit
44ead61339
@ -6,7 +6,7 @@ require_once('mod/magic.php');
|
|||||||
function authtest_content(&$a) {
|
function authtest_content(&$a) {
|
||||||
|
|
||||||
|
|
||||||
|
$auth_success = false;
|
||||||
$o .= '<h3>Magic-Auth Diagnostic</h3>';
|
$o .= '<h3>Magic-Auth Diagnostic</h3>';
|
||||||
|
|
||||||
if(! local_user()) {
|
if(! local_user()) {
|
||||||
@ -34,11 +34,16 @@ function authtest_content(&$a) {
|
|||||||
if(! $j)
|
if(! $j)
|
||||||
$o .= 'json_decode failure from remote site. ' . print_r($z['body'],true);
|
$o .= 'json_decode failure from remote site. ' . print_r($z['body'],true);
|
||||||
$o .= 'Remote site responded: ' . print_r($j,true);
|
$o .= 'Remote site responded: ' . print_r($j,true);
|
||||||
|
if(strpos($j,'Authentication Success'))
|
||||||
|
$auth_success = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$o .= 'fetch url failure.' . print_r($z,true);
|
$o .= 'fetch url failure.' . print_r($z,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(! $auth_success)
|
||||||
|
$o .= 'Authentication Failed!' . EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace("\n",'<br />',$o);
|
return str_replace("\n",'<br />',$o);
|
||||||
|
@ -232,7 +232,7 @@ function post_init(&$a) {
|
|||||||
|
|
||||||
if($test) {
|
if($test) {
|
||||||
$ret['success'] = true;
|
$ret['success'] = true;
|
||||||
$ret['message'] .= 'Success' . EOL;
|
$ret['message'] .= 'Authentication Success!' . EOL;
|
||||||
json_return_and_die($ret);
|
json_return_and_die($ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-12-16.529
|
2013-12-17.530
|
||||||
|
Reference in New Issue
Block a user