add reset button

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Björn Schiessle 2018-08-14 09:39:30 +02:00
parent 3f5fd1cdac
commit 5c07cc8f4e
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
3 changed files with 24 additions and 1 deletions

View File

@ -53,4 +53,8 @@
#user-saml .account-list li.active a {
border-bottom: 1px solid #333;
font-weight: bold;
}
}
#user-saml-reset-settings {
float: right;
}

View File

@ -41,6 +41,16 @@
OCP.AppConfig.setValue('user_saml', 'type', 'saml', {success: function() {location.reload();}});
},
resetSettings: function() {
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.resetSettings, this));
return;
}
OCP.AppConfig.setValue('user_saml', 'type', '', {success: function() {location.reload();}});
},
getConfigIdentifier: function() {
if (this.currentConfig === '1') {
return '';
@ -155,6 +165,11 @@ $(function() {
}
});
$('#user-saml-reset-settings').click(function(e) {
e.preventDefault();
OCA.User_SAML.Admin.resetSettings();
});
var switchProvider = function(providerId) {
$('.account-list li').removeClass('active');
$('.account-list li[data-id="' + providerId + '"]').addClass('active');

View File

@ -166,6 +166,10 @@ style('user_saml', 'admin');
href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('user_saml.SAML.getMetadata', ['idp' => $_['providers'][0]['id']])) ?>" class="button">
<?php p($l->t('Download metadata XML')) ?>
</a>
<button id="user-saml-reset-settings"><?php p($l->t('Reset settings')) ?></button>
<span class="warning hidden" id="user-saml-settings-incomplete"><?php p($l->t('Metadata invalid')) ?></span>
<span class="success hidden" id="user-saml-settings-complete"><?php p($l->t('Metadata valid')) ?></span>
</div>