Skip to content

Commit

Permalink
Merge pull request owncloud#16037 from owncloud/enc_dont_disable_encr…
Browse files Browse the repository at this point in the history
…yption

don't let the the user disable encryption once it was activated
  • Loading branch information
jancborchardt committed May 5, 2015
2 parents 6783699 + a1b9444 commit 952a90f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
4 changes: 4 additions & 0 deletions core/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ textarea:disabled {
color: #999;
cursor: default;
}
input:disabled+label, input:disabled:hover+label, input:disabled:focus+label {
color: #999 !important;
cursor: default;
}

/* Primary action button, use sparingly */
.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary {
Expand Down
4 changes: 4 additions & 0 deletions settings/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -494,3 +494,7 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
#encryptionModules {
padding: 10px;
}

#warning {
color: red;
}
19 changes: 7 additions & 12 deletions settings/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,15 @@ $(document).ready(function(){
$('#shareAPI p:not(#enable)').toggleClass('hidden', !this.checked);
});

$('#encryptionEnabled').change(function() {
$('#encryptionAPI div#EncryptionSettingsArea').toggleClass('hidden');
$('#enableEncryption').change(function() {
$('#encryptionAPI div#EncryptionWarning').toggleClass('hidden');
});

$('#encryptionAPI input').change(function() {
var value = $(this).val();
if ($(this).attr('type') === 'checkbox') {
if (this.checked) {
value = 'yes';
} else {
value = 'no';
}
}
OC.AppConfig.setValue('core', $(this).attr('name'), value);
$('#reallyEnableEncryption').click(function() {
$('#encryptionAPI div#EncryptionWarning').toggleClass('hidden');
$('#encryptionAPI div#EncryptionSettingsArea').toggleClass('hidden');
OC.AppConfig.setValue('core', 'encryption_enabled', 'yes');
$('#enableEncryption').attr('disabled', 'disabled');
});

$('#startmigration').click(function(event){
Expand Down
18 changes: 14 additions & 4 deletions settings/templates/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,23 @@
href="<?php p(link_to_docs('admin-encryption')); ?>"></a>

<p id="enable">
<input type="checkbox" name="encryption_enabled"
id="encryptionEnabled"
value="1" <?php if ($_['encryptionEnabled']) print_unescaped('checked="checked"'); ?> />
<input type="checkbox"
id="enableEncryption"
value="1" <?php if ($_['encryptionEnabled']) print_unescaped('checked="checked" disabled="disabled"'); ?> />
<label
for="encryptionEnabled"><?php p($l->t('Enable server-side encryption')); ?> <span id="startmigration_msg" class="msg"></span> </label><br/>
for="enableEncryption"><?php p($l->t('Enable server-side encryption')); ?> <span id="startmigration_msg" class="msg"></span> </label><br/>
</p>

<div id="EncryptionWarning" class="warning hidden">
<?php p($l->t('Encryption is a one way process. Once encryption is enabled,
all files from that point forward will be encrypted on the server and it
will not be possible to disable encryption at a later date. This is the final warning:
Do you really want to enable encryption?')) ?>
<input type="button"
id="reallyEnableEncryption"
value="<?php p($l->t("Enable encryption")); ?>" />
</div>

<div id="EncryptionSettingsArea" class="<?php if (!$_['encryptionEnabled']) p('hidden'); ?>">
<div id='selectEncryptionModules' class="<?php if (!$_['encryptionReady']) p('hidden'); ?>">
<?php
Expand Down

0 comments on commit 952a90f

Please sign in to comment.