aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-07-14 21:28:17 -0700
committerredmatrix <git@macgirvin.com>2016-07-14 21:28:17 -0700
commit397a23499dc64e2abdd2c27ccdf7e059a23dcfff (patch)
treee195aad36a5674cd7dc7709c6fa517af3561f519
parentd660bde3244055a456a506ca05b080a9c8fc9074 (diff)
downloadvolse-hubzilla-397a23499dc64e2abdd2c27ccdf7e059a23dcfff.tar.gz
volse-hubzilla-397a23499dc64e2abdd2c27ccdf7e059a23dcfff.tar.bz2
volse-hubzilla-397a23499dc64e2abdd2c27ccdf7e059a23dcfff.zip
make the xchan_hash for the access token location independent
-rw-r--r--Zotlabs/Module/Acl.php10
-rw-r--r--include/security.php27
2 files changed, 21 insertions, 16 deletions
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index c8a4fdd7c..15609c3c8 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -137,15 +137,17 @@ class Acl extends \Zotlabs\Web\Controller {
intval(local_channel())
);
if($r1) {
+ require_once('include/security.php');
$r2 = array();
foreach($r1 as $rr) {
+ $x = atoken_xchan($rr);
$r2[] = [
'id' => 'a' . $rr['atoken_id'] ,
- 'hash' => $rr['atoken_uid'] . '.' . $rr['atoken_name'],
- 'name' => $rr['atoken_name'],
- 'micro' => get_default_profile_photo(48),
+ 'hash' => $x['xchan_hash'],
+ 'name' => $x['xchan_name'],
+ 'micro' => $x['xchan_photo_m'],
'url' => z_root(),
- 'nick' => t('guest:') . $rr['atoken_name'],
+ 'nick' => $x['xchan_addr'],
'abook_their_perms' => 0,
'abook_flags' => 0,
'abook_self' => 0
diff --git a/include/security.php b/include/security.php
index c2515a6e1..e345636e7 100644
--- a/include/security.php
+++ b/include/security.php
@@ -100,18 +100,21 @@ function atoken_login($atoken) {
function atoken_xchan($atoken) {
- return [
- 'xchan_hash' => $atoken['atoken_uid'] . '.' . $atoken['atoken_name'],
- 'xchan_name' => $atoken['atoken_name'],
- 'xchan_addr' => t('guest:') . $atoken['atoken_name'] . '@' . \App::get_hostname(),
- 'xchan_network' => 'unknown',
- 'xchan_hidden' => 1,
- 'xchan_photo_mimetype' => 'image/jpeg',
- 'xchan_photo_l' => get_default_profile_photo(300),
- 'xchan_photo_m' => get_default_profile_photo(80),
- 'xchan_photo_s' => get_default_profile_photo(48)
-
- ];
+ $c = channelx_by_n($atoken['atoken_uid']);
+ if($c) {
+ return [
+ 'xchan_hash' => substr($c['channel_hash'],0,16) . '.' . $atoken['atoken_name'],
+ 'xchan_name' => $atoken['atoken_name'],
+ 'xchan_addr' => t('guest:') . $atoken['atoken_name'] . '@' . \App::get_hostname(),
+ 'xchan_network' => 'unknown',
+ 'xchan_hidden' => 1,
+ 'xchan_photo_mimetype' => 'image/jpeg',
+ 'xchan_photo_l' => get_default_profile_photo(300),
+ 'xchan_photo_m' => get_default_profile_photo(80),
+ 'xchan_photo_s' => get_default_profile_photo(48)
+
+ ];
+ }
}