couple of additional checks

This commit is contained in:
friendica 2013-12-05 15:55:14 -08:00
parent d66d8ff524
commit 539988b62f

View File

@ -172,19 +172,30 @@ function post_init(&$a) {
$result = zot_zot($x[0]['hubloc_callback'],$p);
$ret['message'] .= 'auth check request to your site returned .' . print_r($result, true) . EOL;
if(! $result['success']) {
logger('mod_zot: auth_check callback failed.');
if($test) {
$ret['message'] .= 'auth check request to your site returned .' . print_r($result, true) . EOL;
json_return_and_die($ret);
}
goaway($desturl);
}
$j = json_decode($result['body'],true);
if(! $j) {
logger('mod_zot: auth_check json data malformed.');
if($test) {
$ret['message'] .= 'json malformed: ' . $result['body'] . EOL;
json_return_and_die($ret);
}
}
}
if($test) {
$ret['message'] .= 'auth check request returned .' . print_r($j, true) . EOL;
}
if($already_authed || $j['success']) {
if($j['success']) {
// legit response, but we do need to check that this wasn't answered by a man-in-middle