only let the user change the recovery admin settings if a key passwords was entered.
This commit is contained in:
parent
7461e9c2b5
commit
d8ae2fa80d
|
@ -8,33 +8,32 @@
|
|||
|
||||
$(document).ready(function(){
|
||||
// Trigger ajax on recoveryAdmin status change
|
||||
var enabledStatus = $('#adminEnableRecovery').val();
|
||||
|
||||
$('input:password[name="recoveryPassword"]').keyup(function(event) {
|
||||
var recoveryPassword = $( '#recoveryPassword' ).val();
|
||||
var checkedButton = $('input:radio[name="adminEnableRecovery"]:checked').val();
|
||||
var uncheckedValue = (1+parseInt(checkedButton)) % 2;
|
||||
if (recoveryPassword != '' ) {
|
||||
$('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').removeAttr("disabled");
|
||||
} else {
|
||||
$('input:radio[name="adminEnableRecovery"][value="'+uncheckedValue.toString()+'"]').attr("disabled", "true");
|
||||
}
|
||||
});
|
||||
|
||||
$( 'input:radio[name="adminEnableRecovery"]' ).change(
|
||||
function() {
|
||||
|
||||
var recoveryStatus = $( this ).val();
|
||||
var recoveryPassword = $( '#recoveryPassword' ).val();
|
||||
|
||||
if ( '' == recoveryPassword ) {
|
||||
|
||||
// FIXME: add proper OC notification
|
||||
alert( 'You must set a recovery account password first' );
|
||||
|
||||
} else {
|
||||
|
||||
$.post(
|
||||
OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' )
|
||||
, { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword }
|
||||
, function( data ) {
|
||||
alert( data );
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
$.post(
|
||||
OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' )
|
||||
, { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword }
|
||||
, function( data ) {
|
||||
alert( data );
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
function blackListChange(){
|
||||
var blackList=$( '#encryption_blacklist' ).val().join( ',' );
|
||||
OC.AppConfig.setValue( 'files_encryption', 'type_blacklist', blackList );
|
||||
}
|
||||
})
|
|
@ -10,18 +10,13 @@
|
|||
|
||||
$tmpl = new OCP\Template( 'files_encryption', 'settings-admin' );
|
||||
|
||||
$blackList = explode( ',', \OCP\Config::getAppValue( 'files_encryption', 'type_blacklist', '' ) );
|
||||
|
||||
// Check if an adminRecovery account is enabled for recovering files after lost pwd
|
||||
$view = new OC_FilesystemView( '' );
|
||||
|
||||
$recoveryAdminEnabled = OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' );
|
||||
$recoveryAdminUid = OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminUid' );
|
||||
|
||||
$tmpl->assign( 'blacklist', $blackList );
|
||||
$tmpl->assign( 'encryption_mode', \OC_Appconfig::getValue( 'files_encryption', 'mode', 'none' ) );
|
||||
$tmpl->assign( 'recoveryEnabled', $recoveryAdminEnabled );
|
||||
$tmpl->assign( 'recoveryAdminUid', $recoveryAdminUid );
|
||||
|
||||
\OCP\Util::addscript( 'files_encryption', 'settings-admin' );
|
||||
\OCP\Util::addscript( 'core', 'multiselect' );
|
||||
|
|
|
@ -9,16 +9,14 @@
|
|||
<?php p($l->t( "Enable encryption passwords recovery key (allow sharing to recovery key):" )); ?>
|
||||
<br />
|
||||
<br />
|
||||
<?php if ( empty( $_['recoveryAdminUid'] ) ): ?>
|
||||
<input type="password" name="recoveryPassword" id="recoveryPassword" />
|
||||
<label for="recoveryPassword">Recovery account password</label>
|
||||
<br />
|
||||
<?php endif; ?>
|
||||
<input type="password" name="recoveryPassword" id="recoveryPassword" />
|
||||
<label for="recoveryPassword">Recovery account password</label>
|
||||
<br />
|
||||
<input
|
||||
type='radio'
|
||||
name='adminEnableRecovery'
|
||||
value='1'
|
||||
<?php echo ( $_["recoveryEnabled"] == 1 ? 'checked="checked"' : '' ); ?> />
|
||||
<?php echo ( $_["recoveryEnabled"] == 1 ? 'checked="checked"' : 'disabled' ); ?> />
|
||||
<?php p($l->t( "Enabled" )); ?>
|
||||
<br />
|
||||
|
||||
|
@ -26,7 +24,7 @@
|
|||
type='radio'
|
||||
name='adminEnableRecovery'
|
||||
value='0'
|
||||
<?php echo ( $_["recoveryEnabled"] == 0 ? 'checked="checked"' : '' ); ?> />
|
||||
<?php echo ( $_["recoveryEnabled"] == 0 ? 'checked="checked"' : 'disabled' ); ?> />
|
||||
<?php p($l->t( "Disabled" )); ?>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
|
Loading…
Reference in New Issue