diff options
-rw-r--r-- | apps/files_encryption/js/settings-admin.js | 41 | ||||
-rw-r--r-- | apps/files_encryption/settings-admin.php | 5 | ||||
-rw-r--r-- | apps/files_encryption/templates/settings-admin.php | 12 |
3 files changed, 25 insertions, 33 deletions
diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js index 9cdb7aca68a..2fffcf77b32 100644 --- a/apps/files_encryption/js/settings-admin.js +++ b/apps/files_encryption/js/settings-admin.js @@ -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 ); - } })
\ No newline at end of file diff --git a/apps/files_encryption/settings-admin.php b/apps/files_encryption/settings-admin.php index ae9a85643ef..66efc584367 100644 --- a/apps/files_encryption/settings-admin.php +++ b/apps/files_encryption/settings-admin.php @@ -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' ); diff --git a/apps/files_encryption/templates/settings-admin.php b/apps/files_encryption/templates/settings-admin.php index be7beecf696..95c1b66681c 100644 --- a/apps/files_encryption/templates/settings-admin.php +++ b/apps/files_encryption/templates/settings-admin.php @@ -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> |