allow api login by address or url (url will use zot6 hubloc records, address can use either zot or zot6 hubloc records)

This commit is contained in:
zotlabs 2019-06-25 18:47:16 -07:00
parent 5ee7009271
commit 4f280b5497

View File

@ -96,11 +96,15 @@ function api_login(&$a){
if($sigblock) { if($sigblock) {
$keyId = str_replace('acct:','',$sigblock['keyId']); $keyId = str_replace('acct:','',$sigblock['keyId']);
if($keyId) { if($keyId) {
$r = q("select * from hubloc where hubloc_addr = '%s' limit 1", $r = q("select * from hubloc where ( hubloc_addr = '%s' or hubloc_id_url = '%s' ) limit 1",
dbesc($keyId),
dbesc($keyId) dbesc($keyId)
); );
if($r) { if($r) {
$c = channelx_by_hash($r[0]['hubloc_hash']); $c = channelx_by_hash($r[0]['hubloc_hash']);
if (! $c) {
$c = channelx_by_portid($r[0]['hubloc_hash']);
}
if($c) { if($c) {
$a = q("select * from account where account_id = %d limit 1", $a = q("select * from account where account_id = %d limit 1",
intval($c['channel_account_id']) intval($c['channel_account_id'])