Merge pull request #237 from nextcloud/add-reset-option

Add reset option
This commit is contained in:
Björn Schiessle 2018-08-14 13:58:14 +02:00 committed by GitHub
commit 183c590a72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 1 deletions

View file

@ -69,6 +69,8 @@ switch($config->getAppValue('user_saml', 'type')) {
case 'environment-variable':
$type = 'environment-variable';
break;
default:
return;
}
if($returnScript === true) {

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

@ -176,6 +176,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>