summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-08-10 09:10:39 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-08-10 09:10:39 +0200
commit965804425dd13ec9d7d2f5edbfbd62ed6939b12e (patch)
tree24397fcf74e29c4c9c6c31c4f1352ce9aa61f8b3 /settings
parentde44ab0244a0a47dad04b8b53b5d55e31a0e430e (diff)
downloadnextcloud-server-965804425dd13ec9d7d2f5edbfbd62ed6939b12e.tar.gz
nextcloud-server-965804425dd13ec9d7d2f5edbfbd62ed6939b12e.zip
Add clipboardjs for token
Diffstat (limited to 'settings')
-rw-r--r--settings/css/settings.css9
-rw-r--r--settings/js/authtoken_view.js32
-rw-r--r--settings/templates/personal.php1
3 files changed, 42 insertions, 0 deletions
diff --git a/settings/css/settings.css b/settings/css/settings.css
index fe586205bdf..346b8ffa1cf 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -145,6 +145,15 @@ table.nostyle td { padding: 0.2em 0; }
.app-password-row {
display: table-row;
}
+
+.app-password-row .icon {
+ background-size: 16px 16px;
+ display: inline-block;
+ position: relative;
+ top: 3px;
+ margin-left: 5px;
+}
+
.app-password-label {
display: table-cell;
padding-right: 1em;
diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js
index c8cf66a6cea..03d6c188f6e 100644
--- a/settings/js/authtoken_view.js
+++ b/settings/js/authtoken_view.js
@@ -218,6 +218,38 @@
this._newAppPassword.on('focus', _.bind(this._onNewTokenFocus, this));
this._hideAppPasswordBtn = $('#app-password-hide');
this._hideAppPasswordBtn.click(_.bind(this._hideToken, this));
+
+ // Clipboard!
+ var clipboard = new Clipboard('.clipboardButton');
+ clipboard.on('success', function(e) {
+ var $input = $(e.trigger);
+ $input.tooltip({placement: 'bottom', trigger: 'manual', title: t('core', 'Copied!')});
+ $input.tooltip('show');
+ _.delay(function() {
+ $input.tooltip('hide');
+ }, 3000);
+ });
+ clipboard.on('error', function (e) {
+ var $input = $(e.trigger);
+ var actionMsg = '';
+ if (/iPhone|iPad/i.test(navigator.userAgent)) {
+ actionMsg = t('core', 'Not supported!');
+ } else if (/Mac/i.test(navigator.userAgent)) {
+ actionMsg = t('core', 'Press ⌘-C to copy.');
+ } else {
+ actionMsg = t('core', 'Press Ctrl-C to copy.');
+ }
+
+ $input.tooltip({
+ placement: 'bottom',
+ trigger: 'manual',
+ title: actionMsg
+ });
+ $input.tooltip('show');
+ _.delay(function () {
+ $input.tooltip('hide');
+ }, 3000);
+ });
},
render: function () {
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 182fc3c6585..edbc0d24c5d 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -211,6 +211,7 @@ if($_['passwordChangeSupported']) {
<div class="app-password-row">
<span class="app-password-label"><?php p($l->t('Password')); ?></span>
<input id="new-app-password" type="text" readonly="readonly"/>
+ <a class="clipboardButton icon icon-clippy" data-clipboard-target="#new-app-password"></a>
<button id="app-password-hide" class="button"><?php p($l->t('Done')); ?></button>
</div>
</div>