aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-06-25 18:47:16 -0700
committerzotlabs <mike@macgirvin.com>2019-06-25 18:47:16 -0700
commit4f280b5497325c7e7389096cb39f1f409de2638c (patch)
treee118486c64c5f1d8f5465e21a075316c1dbd3491
parent5ee70092712be1604ce1450a8735154fdb7c9485 (diff)
downloadvolse-hubzilla-4f280b5497325c7e7389096cb39f1f409de2638c.tar.gz
volse-hubzilla-4f280b5497325c7e7389096cb39f1f409de2638c.tar.bz2
volse-hubzilla-4f280b5497325c7e7389096cb39f1f409de2638c.zip
allow api login by address or url (url will use zot6 hubloc records, address can use either zot or zot6 hubloc records)
-rw-r--r--include/api_auth.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/api_auth.php b/include/api_auth.php
index 23ab9c946..9235bd28c 100644
--- a/include/api_auth.php
+++ b/include/api_auth.php
@@ -96,11 +96,15 @@ function api_login(&$a){
if($sigblock) {
$keyId = str_replace('acct:','',$sigblock['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)
);
if($r) {
$c = channelx_by_hash($r[0]['hubloc_hash']);
+ if (! $c) {
+ $c = channelx_by_portid($r[0]['hubloc_hash']);
+ }
if($c) {
$a = q("select * from account where account_id = %d limit 1",
intval($c['channel_account_id'])