]> source.dussan.org Git - nextcloud-server.git/commitdiff
hide client secret by default
authorBjoern Schiessle <bjoern@schiessle.org>
Fri, 12 May 2017 12:55:30 +0000 (14:55 +0200)
committerLukas Reschke <lukas@statuscode.ch>
Thu, 18 May 2017 18:49:07 +0000 (20:49 +0200)
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
apps/oauth2/css/setting-admin.css [new file with mode: 0644]
apps/oauth2/js/setting-admin.js [new file with mode: 0644]
apps/oauth2/templates/admin.php

diff --git a/apps/oauth2/css/setting-admin.css b/apps/oauth2/css/setting-admin.css
new file mode 100644 (file)
index 0000000..a57a56b
--- /dev/null
@@ -0,0 +1,5 @@
+.show-oauth-credentials {
+       padding-left: 10px;
+       opacity: 0.3;
+       cursor: pointer;
+}
diff --git a/apps/oauth2/js/setting-admin.js b/apps/oauth2/js/setting-admin.js
new file mode 100644 (file)
index 0000000..be774fd
--- /dev/null
@@ -0,0 +1,16 @@
+
+$(document).ready(function () {
+
+       $('.show-oauth-credentials').click(function() {
+               var row = $(this).parent();
+               var code = $(row).find('code');
+               if(code.text() === '****') {
+                       code.text(row.data('value'));
+                       $(this).css('opacity', 0.9);
+               } else {
+                       code.text('****');
+                       $(this).css('opacity', 0.3);
+               }
+       })
+
+});
index f5b8532e6b1e43f102c5002be6cb8ea32e1373d0..9c09499add3d22f81ccfb2a0f8c996d75fbac83d 100644 (file)
@@ -22,6 +22,9 @@
 $urlGenerator = \OC::$server->getURLGenerator();
 $themingDefaults = \OC::$server->getThemingDefaults();
 
+script('oauth2', 'setting-admin');
+style('oauth2', 'setting-admin');
+
 /** @var array $_ */
 /** @var \OCA\OAuth2\Db\Client[] $clients */
 $clients = $_['clients'];
@@ -47,7 +50,7 @@ $clients = $_['clients'];
                                <td><?php p($client->getName()); ?></td>
                                <td><?php p($client->getRedirectUri()); ?></td>
                                <td><code><?php p($client->getClientIdentifier()); ?></code></td>
-                               <td><code><?php p($client->getSecret()); ?></code></td>
+                               <td data-value="<?php p($client->getSecret()); ?>"><code>****</code><img class='show-oauth-credentials' src="<?php p($urlGenerator->imagePath('core', 'actions/toggle.svg'));?>"/></td>
                                <td>
                                        <form id="form-inline" class="delete" action="<?php p($urlGenerator->linkToRoute('oauth2.Settings.deleteClient', ['id' => $client->getId()])); ?>" method="POST">
                                                <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
@@ -67,4 +70,4 @@ $clients = $_['clients'];
                <input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
                <input type="submit" class="button" value="<?php p($l->t('Add')); ?>">
        </form>
-</div>
\ No newline at end of file
+</div>