hide client secret by default

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2017-05-12 14:55:30 +02:00 committed by Lukas Reschke
parent baa8490f44
commit bb19b37097
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
3 changed files with 26 additions and 2 deletions

View File

@ -0,0 +1,5 @@
.show-oauth-credentials {
padding-left: 10px;
opacity: 0.3;
cursor: pointer;
}

View File

@ -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);
}
})
});

View File

@ -22,6 +22,9 @@
$urlGenerator = \OC::$server->getURLGenerator(); $urlGenerator = \OC::$server->getURLGenerator();
$themingDefaults = \OC::$server->getThemingDefaults(); $themingDefaults = \OC::$server->getThemingDefaults();
script('oauth2', 'setting-admin');
style('oauth2', 'setting-admin');
/** @var array $_ */ /** @var array $_ */
/** @var \OCA\OAuth2\Db\Client[] $clients */ /** @var \OCA\OAuth2\Db\Client[] $clients */
$clients = $_['clients']; $clients = $_['clients'];
@ -47,7 +50,7 @@ $clients = $_['clients'];
<td><?php p($client->getName()); ?></td> <td><?php p($client->getName()); ?></td>
<td><?php p($client->getRedirectUri()); ?></td> <td><?php p($client->getRedirectUri()); ?></td>
<td><code><?php p($client->getClientIdentifier()); ?></code></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> <td>
<form id="form-inline" class="delete" action="<?php p($urlGenerator->linkToRoute('oauth2.Settings.deleteClient', ['id' => $client->getId()])); ?>" method="POST"> <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']) ?>" /> <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="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" />
<input type="submit" class="button" value="<?php p($l->t('Add')); ?>"> <input type="submit" class="button" value="<?php p($l->t('Add')); ?>">
</form> </form>
</div> </div>