OpenWebAuth: can fail after site re-installs; this may need to be pushed forward to master

This commit is contained in:
zotlabs 2018-01-11 12:13:57 -08:00
parent 894b3706e7
commit 468e976a88

View File

@ -31,11 +31,11 @@ class Owa extends \Zotlabs\Web\Controller {
if($keyId) { if($keyId) {
$r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash $r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash
where hubloc_addr = '%s' limit 1", where hubloc_addr = '%s' ",
dbesc(str_replace('acct:','',$keyId)) dbesc(str_replace('acct:','',$keyId))
); );
if($r) { if($r) {
$hubloc = $r[0]; foreach($r as $hubloc) {
$verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']);
if($verified && $verified['header_signed'] && $verified['header_valid']) { if($verified && $verified['header_signed'] && $verified['header_valid']) {
$ret['success'] = true; $ret['success'] = true;
@ -44,6 +44,8 @@ class Owa extends \Zotlabs\Web\Controller {
$result = ''; $result = '';
openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']); openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']);
$ret['encrypted_token'] = base64url_encode($result); $ret['encrypted_token'] = base64url_encode($result);
break;
}
} }
} }
} }