aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Notifier.php2
-rw-r--r--Zotlabs/Module/Tokens.php10
-rw-r--r--include/text.php22
-rw-r--r--view/tpl/tokens.tpl36
4 files changed, 24 insertions, 46 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 76c17545a..7964621c7 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -240,7 +240,7 @@ class Notifier {
$target_item = $r[0];
- if (in_array($target_item['author']['xchan_network'], ['rss', 'anon'])) {
+ if (in_array($target_item['author']['xchan_network'], ['rss', 'anon', 'token'])) {
logger('notifier: target item author is not a fetchable actor', LOGGER_DEBUG);
return;
}
diff --git a/Zotlabs/Module/Tokens.php b/Zotlabs/Module/Tokens.php
index b1c8bb4bf..1b074171e 100644
--- a/Zotlabs/Module/Tokens.php
+++ b/Zotlabs/Module/Tokens.php
@@ -250,9 +250,6 @@ class Tokens extends Controller {
$desc = t('Use this form to create temporary access identifiers to share things with non-members. These identities may be used in Access Control Lists and visitors may login using these credentials to access private content.');
- $desc2 = t('You may also provide <em>dropbox</em> style access links to friends and associates by adding the Login Password to any specific site URL as shown. Examples:');
-
-
//TODO: assign role
$pcat = new Permcat(local_channel());
$pcatlist = $pcat->listing();
@@ -266,7 +263,7 @@ class Tokens extends Controller {
if (!$current_permcat) {
- notice(t('Please select a role for this contact!') . EOL);
+ notice(t('Please select a role for this guest!') . EOL);
$permcats[] = '';
}
@@ -282,13 +279,10 @@ class Tokens extends Controller {
'$permcat' => ['permcat', t('Select a role for this token'), $current_permcat, '', $permcats],
'$title' => t('Guest Access Tokens'),
'$desc' => $desc,
- '$desc2' => $desc2,
'$tokens' => $t,
'$atoken' => $atoken,
- '$url1' => z_root() . '/channel/' . $channel['channel_address'],
- '$url2' => z_root() . '/photos/' . $channel['channel_address'],
'$name' => array('name', t('Login Name') . ' <span class="required">*</span>', (($atoken) ? $atoken['atoken_name'] : ''),''),
- '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : autoname(8)), ''),
+ '$token'=> array('token', t('Login Password') . ' <span class="required">*</span>',(($atoken) ? $atoken['atoken_token'] : new_token()), ''),
'$expires'=> array('expires', t('Expires (yyyy-mm-dd)'), (($atoken['atoken_expires'] && $atoken['atoken_expires'] > NULL_DATE) ? datetime_convert('UTC',date_default_timezone_get(),$atoken['atoken_expires']) : ''), ''),
'$submit' => t('Submit')
));
diff --git a/include/text.php b/include/text.php
index 0522dd3c9..29b9d039c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2586,7 +2586,7 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0) {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1");
}
- $xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$arr)) . ") and xchan_network in ('rss','unknown', 'anon')");
+ $xchans = q("select * from xchan where xchan_hash in (" . protect_sprintf(implode(',',$arr)) . ") and xchan_network in ('rss','unknown', 'anon', 'token')");
if(! $chans)
$chans = $xchans;
else
@@ -3889,6 +3889,26 @@ function array_path_exists($str,$arr) {
/**
+ * @brief provide psuedo random token (string) consisting entirely of US-ASCII letters/numbers
+ * and with possibly variable length
+ *
+ * @return string
+ */
+function new_token($minlen = 36, $maxlen = 48) {
+ $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
+ $str = EMPTY_STR;
+
+ $len = (($minlen === $maxlen) ? $minlen : mt_rand($minlen, $maxlen));
+
+ for ($a = 0; $a < $len; $a++) {
+ $str .= $chars[mt_rand(0, 62)];
+ }
+
+ return $str;
+}
+
+
+/**
* @brief Generate a random v4 UUID.
*
* @return string
diff --git a/view/tpl/tokens.tpl b/view/tpl/tokens.tpl
index 51cd4a6cf..443fb5392 100644
--- a/view/tpl/tokens.tpl
+++ b/view/tpl/tokens.tpl
@@ -21,42 +21,6 @@
</div>
</div>
- <!--div class="panel" id="permission-settings">
- <div class="section-subtitle-wrapper" role="tab" id="perms-tool">
- <h3>
- <a data-bs-toggle="collapse" data-bs-parent="#permission-settings" href="#perms-tool-collapse" aria-expanded="true" aria-controls="perms-tool-collapse">
- {{$permlbl}}
- </a>
- </h3>
- </div>
- <div id="perms-tool-collapse" class="panel-collapse collapse" role="tabpanel" aria-labelledby="perms-tool">
- <div class="section-content-tools-wrapper">
- <div class="section-content-warning-wrapper">
- {{$permnote}}
- </div>
-
- <table id="perms-tool-table" class=mb-3>
- <tr>
- <td></td><td colspan="2" class="abook-me">{{$me}}</td>
- </tr>
- {{foreach $perms as $prm}}
- {{include file="field_acheckbox.tpl" field=$prm}}
- {{/foreach}}
- </table>
-
- <div class="settings-submit-wrapper" >
- <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button>
- </div>
- </div>
- </div>
- </div-->
-
- <div class="descriptive-text">{{$desc2}}</div>
- <ul>
- <li>{{$url1}}<span class="zat-example">?f=&zat=<span class="token-mirror"></span></span></li>
- <li>{{$url2}}<span class="zat-example">?f=&zat=<span class="token-mirror"></span></span></li>
- </ul>
-
{{if $tokens}}
<div class="section-content-wrapper-np">
<table id="atoken-index">