From f3aff45042096ab113b77492c0018d5e6b47c7e4 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Fri, 15 Jul 2016 16:31:21 -0700 Subject: provide examples for using access tokens in urls --- Zotlabs/Module/Settings.php | 9 +++++++-- view/js/mod_settings.js | 3 +++ view/theme/redbasic/css/style.css | 6 ++++++ view/tpl/settings_tokens.tpl | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Settings.php b/Zotlabs/Module/Settings.php index 20aa59f78..ccc5ec04a 100644 --- a/Zotlabs/Module/Settings.php +++ b/Zotlabs/Module/Settings.php @@ -776,15 +776,20 @@ class Settings extends \Zotlabs\Web\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 the private content.'); + $desc2 = t('You may also provide dropbox style access links to friends and associates by adding the Login Password to any specific site URL as shown. Examples:'); + $tpl = get_markup_template("settings_tokens.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_tokens"), '$title' => t('Guest Access Tokens'), '$desc' => $desc, + '$desc2' => $desc2, '$tokens' => $t, '$atoken' => $atoken, - '$name' => array('name', t('Login Name'), (($atoken) ? $atoken['atoken_name'] : ''),''), - '$token'=> array('token', t('Login Password'),(($atoken) ? $atoken['atoken_token'] : autoname(8)), ''), + '$url1' => z_root() . '/channel/' . $channel['channel_address'], + '$url2' => z_root() . '/photos/' . $channel['channel_address'], + '$name' => array('name', t('Login Name') . ' *', (($atoken) ? $atoken['atoken_name'] : ''),''), + '$token'=> array('token', t('Login Password') . ' *',(($atoken) ? $atoken['atoken_token'] : autoname(8)), ''), '$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/view/js/mod_settings.js b/view/js/mod_settings.js index 640c154dd..0f45e0d16 100644 --- a/view/js/mod_settings.js +++ b/view/js/mod_settings.js @@ -5,6 +5,9 @@ $(document).ready(function() { $('form').areYouSure({'addRemoveFieldsMarksDirty':true, 'message': aStr['leavethispage'] }); // Warn user about unsaved settings + $('.token-mirror').html($('#id_token').val()); + $('#id_token').keyup( function() { $('.token-mirror').html($('#id_token').val()); }); + $("#id_permissions_role").change(function() { var role = $("#id_permissions_role").val(); if(role == 'custom') diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 06d72588b..eeaf021c1 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -2046,4 +2046,10 @@ dl.bb-dl > dd > li { } .atoken-text { margin: 5px 10px 5px 10px; +} +.atoken-example { + margin-left: 20px; +} +.zat-example { + color: red; } \ No newline at end of file diff --git a/view/tpl/settings_tokens.tpl b/view/tpl/settings_tokens.tpl index a81d65dfc..6819a2e58 100644 --- a/view/tpl/settings_tokens.tpl +++ b/view/tpl/settings_tokens.tpl @@ -4,6 +4,10 @@
{{$desc}}
+
{{$desc2}}
+
{{$url1}}&f=&zat=
+
{{$url2}}&f=&zat=
+
{{if $atoken}}{{/if}} -- cgit v1.2.3