disable admin choice of encryption mode once a decision was taken

This commit is contained in:
Bjoern Schiessle 2012-08-09 14:25:09 +02:00
parent 800942ece7
commit a969c23e59
4 changed files with 30 additions and 10 deletions

View File

@ -22,7 +22,7 @@ $(document).ready(function(){
$.post(OC.filePath('files_encryption', 'ajax', 'mode.php'), { mode: 'server', newpasswd: data[0].value, oldpasswd: data[1].value }, function(result) {
if (result.status != 'success') {
document.getElementById(prevmode+'_encryption').checked = true;
OC.dialogs.alert(t('encryption', 'Please check your passwords and try again'), t('encryption', 'Could not change encryption password to login password'))
OC.dialogs.alert(t('encryption', 'Please check your passwords and try again'), t('encryption', 'Could not change your file encryption password to your login password'))
}
});
});

View File

@ -23,13 +23,24 @@ $(document).ready(function(){
,server=$('input[value="server"]:checked').val()
,user=$('input[value="user"]:checked').val()
,none=$('input[value="none"]:checked').val()
if (client)
,disable=false
if (client) {
OC.AppConfig.setValue('files_encryption','mode','client');
else if (server)
disable = true;
} else if (server) {
OC.AppConfig.setValue('files_encryption','mode','server');
else if (user)
disable = true;
} else if (user) {
OC.AppConfig.setValue('files_encryption','mode','user');
else
disable = true;
} else {
OC.AppConfig.setValue('files_encryption','mode','none');
}
if (disable) {
document.getElementById('server_encryption').disabled = true;
document.getElementById('client_encryption').disabled = true;
document.getElementById('user_encryption').disabled = true;
document.getElementById('none_encryption').disabled = true;
}
})
})

View File

@ -199,6 +199,13 @@ class Keymanager {
return $result;
}
/**
* @brief change password of private encryption key
*
* @param string $oldpasswd old password
* @param string $newpasswd new password
* @return bool true/false
*/
public static function changePasswd($oldpasswd, $newpasswd) {
if ( \OCP\User::checkPassword(\OCP\User::getUser(), $newpasswd) ) {
return Crypt::changekeypasscode($oldpasswd, $newpasswd);

View File

@ -2,12 +2,14 @@
<fieldset class="personalblock">
<strong>Choose encryption mode:</strong>
<p><i>Important: Once you selected an encryption mode there is no way to change it back</i></p>
<p>
<input type="radio" name="encryption_mode" value="client" style="width:20px;" <?php if ($_['encryption_mode'] == 'client') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> Client side encryption (most secure but makes it impossible to access your data from the web interface)<br />
<input type="radio" name="encryption_mode" value="server" style="width:20px;" <?php if ($_['encryption_mode'] == 'server') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?> /> Server side encryption (allows you to access your files from the web interface and the desktop client)<br />
<input type="radio" name="encryption_mode" value="user" style="width:20px;" <?php if ($_['encryption_mode'] == 'user') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> User specific (let the user decide)<br/>
<input type="radio" name="encryption_mode" value="none" style="width:20px;" <?php if ($_['encryption_mode'] == 'none') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> None (no encryption at all)<br/>
<input type="radio" name="encryption_mode" id="client_encryption" value="client" style="width:20px;" <?php if ($_['encryption_mode'] == 'client') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> Client side encryption (most secure but makes it impossible to access your data from the web interface)<br />
<input type="radio" name="encryption_mode" id="server_encryption" value="server" style="width:20px;" <?php if ($_['encryption_mode'] == 'server') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?> /> Server side encryption (allows you to access your files from the web interface and the desktop client)<br />
<input type="radio" name="encryption_mode" id="user_encryption" value="user" style="width:20px;" <?php if ($_['encryption_mode'] == 'user') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> User specific (let the user decide)<br/>
<input type="radio" name="encryption_mode" id="none_encryption" value="none" style="width:20px;" <?php if ($_['encryption_mode'] == 'none') echo "checked='checked'"; if ($_['encryption_mode'] != 'none') echo "DISABLED"?>/> None (no encryption at all)<br/>
</p>
<p>
<strong><?php echo $l->t('Encryption'); ?></strong>