parent
2e00acda07
commit
d15c2e52b0
@ -0,0 +1,10 @@ |
||||
/* Copyright (c) 2013, Sam Tuke, <samtuke@owncloud.com> |
||||
This file is licensed under the Affero General Public License version 3 or later. |
||||
See the COPYING-README file. */ |
||||
|
||||
#encryptAllError |
||||
, #encryptAllSuccess |
||||
, #recoveryEnabledError |
||||
, #recoveryEnabledSuccess { |
||||
display: none; |
||||
} |
||||
@ -1,37 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* @author Clark Tomlinson <clark@owncloud.com> |
||||
* @since 2/19/15, 10:02 AM |
||||
* @copyright Copyright (c) 2015, ownCloud, Inc. |
||||
* @license AGPL-3.0 |
||||
* |
||||
* This code is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU Affero General Public License, version 3, |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU Affero General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public License, version 3, |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/> |
||||
* |
||||
*/ |
||||
|
||||
namespace OCA\Encryption\Hooks; |
||||
|
||||
use OCA\Encryption\Hooks\Contracts\IHook; |
||||
use OCP\Util; |
||||
|
||||
class AppHooks implements IHook { |
||||
/** |
||||
* Connects Hooks |
||||
* |
||||
* @return null |
||||
*/ |
||||
public function addHooks() { |
||||
Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable'); |
||||
Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable'); |
||||
} |
||||
} |
||||
@ -1,46 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* @author Clark Tomlinson <clark@owncloud.com> |
||||
* @since 2/19/15, 10:02 AM |
||||
* @copyright Copyright (c) 2015, ownCloud, Inc. |
||||
* @license AGPL-3.0 |
||||
* |
||||
* This code is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU Affero General Public License, version 3, |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU Affero General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public License, version 3, |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/> |
||||
* |
||||
*/ |
||||
|
||||
namespace OCA\Encryption\Hooks; |
||||
|
||||
|
||||
use OCA\Encryption\Hooks\Contracts\IHook; |
||||
use OCP\Util; |
||||
|
||||
class FileSystemHooks implements IHook { |
||||
|
||||
/** |
||||
* Connects Hooks |
||||
* |
||||
* @return null |
||||
*/ |
||||
public function addHooks() { |
||||
Util::connectHook('OC_Filesystem', 'rename', 'OCA\Encryption\Hooks', 'preRename'); |
||||
Util::connectHook('OC_Filesystem', 'post_rename', 'OCA\Encryption\Hooks', 'postRenameOrCopy'); |
||||
Util::connectHook('OC_Filesystem', 'copy', 'OCA\Encryption\Hooks', 'preCopy'); |
||||
Util::connectHook('OC_Filesystem', 'post_copy', 'OCA\Encryption\Hooks', 'postRenameOrCopy'); |
||||
Util::connectHook('OC_Filesystem', 'post_delete', 'OCA\Encryption\Hooks', 'postDelete'); |
||||
Util::connectHook('OC_Filesystem', 'delete', 'OCA\Encryption\Hooks', 'preDelete'); |
||||
Util::connectHook('\OC\Core\LostPassword\Controller\LostController', 'post_passwordReset', 'OCA\Encryption\Hooks', 'postPasswordReset'); |
||||
Util::connectHook('OC_Filesystem', 'post_umount', 'OCA\Encryption\Hooks', 'postUnmount'); |
||||
Util::connectHook('OC_Filesystem', 'umount', 'OCA\Encryption\Hooks', 'preUnmount'); |
||||
} |
||||
} |
||||
@ -1,40 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* @author Clark Tomlinson <clark@owncloud.com> |
||||
* @since 2/19/15, 10:02 AM |
||||
* @copyright Copyright (c) 2015, ownCloud, Inc. |
||||
* @license AGPL-3.0 |
||||
* |
||||
* This code is free software: you can redistribute it and/or modify |
||||
* it under the terms of the GNU Affero General Public License, version 3, |
||||
* as published by the Free Software Foundation. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU Affero General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU Affero General Public License, version 3, |
||||
* along with this program. If not, see <http://www.gnu.org/licenses/> |
||||
* |
||||
*/ |
||||
|
||||
namespace OCA\Encryption\Hooks; |
||||
|
||||
|
||||
use OCA\Encryption\Hooks\Contracts\IHook; |
||||
use OCP\Util; |
||||
|
||||
class ShareHooks implements IHook { |
||||
|
||||
/** |
||||
* Connects Hooks |
||||
* |
||||
* @return null |
||||
*/ |
||||
public function addHooks() { |
||||
Util::connectHook('OCP\Share', 'pre_shared', 'OCA\Encryption\Hooks', 'preShared'); |
||||
Util::connectHook('OCP\Share', 'post_shared', 'OCA\Encryption\Hooks', 'postShared'); |
||||
Util::connectHook('OCP\Share', 'post_unshare', 'OCA\Encryption\Hooks', 'postUnshare'); |
||||
} |
||||
} |
||||
@ -0,0 +1,33 @@ |
||||
/** |
||||
* Copyright (c) 2013 |
||||
* Bjoern Schiessle <schiessle@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
|
||||
$(document).ready(function(){ |
||||
$('form[name="login"]').on('submit', function() { |
||||
var user = $('#user').val(); |
||||
var password = $('#password').val(); |
||||
$.ajax({ |
||||
type: 'POST', |
||||
url: OC.linkTo('files_encryption', 'ajax/getMigrationStatus.php'), |
||||
dataType: 'json', |
||||
data: {user: user, password: password}, |
||||
async: false, |
||||
success: function(response) { |
||||
if (response.data.migrationStatus === OC.Encryption.MIGRATION_OPEN) { |
||||
var message = t('files_encryption', 'Initial encryption started... This can take some time. Please wait.'); |
||||
$('#messageText').text(message); |
||||
$('#message').removeClass('hidden').addClass('update'); |
||||
} else if (response.data.migrationStatus === OC.Encryption.MIGRATION_IN_PROGRESS) { |
||||
var message = t('files_encryption', 'Initial encryption running... Please try again later.'); |
||||
$('#messageText').text(message); |
||||
$('#message').removeClass('hidden').addClass('update'); |
||||
} |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
}); |
||||
@ -0,0 +1,16 @@ |
||||
/** |
||||
* Copyright (c) 2014 |
||||
* Bjoern Schiessle <schiessle@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
/** |
||||
* @namespace |
||||
* @memberOf OC |
||||
*/ |
||||
OC.Encryption={ |
||||
MIGRATION_OPEN:0, |
||||
MIGRATION_COMPLETED:1, |
||||
MIGRATION_IN_PROGRESS:-1, |
||||
}; |
||||
@ -0,0 +1,55 @@ |
||||
/** |
||||
* Copyright (c) 2013 |
||||
* Sam Tuke <samtuke@owncloud.com> |
||||
* Robin Appelman <icewind1991@gmail.com> |
||||
* Bjoern Schiessle <schiessle@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
$( 'input:radio[name="adminEnableRecovery"]' ).change( |
||||
function() { |
||||
var recoveryStatus = $( this ).val(); |
||||
var oldStatus = (1+parseInt(recoveryStatus)) % 2; |
||||
var recoveryPassword = $( '#encryptionRecoveryPassword' ).val(); |
||||
var confirmPassword = $( '#repeatEncryptionRecoveryPassword' ).val(); |
||||
OC.msg.startSaving('#encryptionSetRecoveryKey .msg'); |
||||
$.post( |
||||
OC.filePath( 'files_encryption', 'ajax', 'adminrecovery.php' ) |
||||
, { adminEnableRecovery: recoveryStatus, recoveryPassword: recoveryPassword, confirmPassword: confirmPassword } |
||||
, function( result ) { |
||||
OC.msg.finishedSaving('#encryptionSetRecoveryKey .msg', result); |
||||
if (result.status === "error") { |
||||
$('input:radio[name="adminEnableRecovery"][value="'+oldStatus.toString()+'"]').attr("checked", "true"); |
||||
} else { |
||||
if (recoveryStatus === "0") { |
||||
$('p[name="changeRecoveryPasswordBlock"]').addClass("hidden"); |
||||
} else { |
||||
$('input:password[name="changeRecoveryPassword"]').val(""); |
||||
$('p[name="changeRecoveryPasswordBlock"]').removeClass("hidden"); |
||||
} |
||||
} |
||||
} |
||||
); |
||||
} |
||||
); |
||||
|
||||
// change recovery password
|
||||
|
||||
$('button:button[name="submitChangeRecoveryKey"]').click(function() { |
||||
var oldRecoveryPassword = $('#oldEncryptionRecoveryPassword').val(); |
||||
var newRecoveryPassword = $('#newEncryptionRecoveryPassword').val(); |
||||
var confirmNewPassword = $('#repeatedNewEncryptionRecoveryPassword').val(); |
||||
OC.msg.startSaving('#encryptionChangeRecoveryKey .msg'); |
||||
$.post( |
||||
OC.filePath( 'files_encryption', 'ajax', 'changeRecoveryPassword.php' ) |
||||
, { oldPassword: oldRecoveryPassword, newPassword: newRecoveryPassword, confirmPassword: confirmNewPassword } |
||||
, function( data ) { |
||||
OC.msg.finishedSaving('#encryptionChangeRecoveryKey .msg', data); |
||||
} |
||||
); |
||||
}); |
||||
|
||||
}); |
||||
@ -0,0 +1,89 @@ |
||||
/** |
||||
* Copyright (c) 2013, Sam Tuke <samtuke@owncloud.com> |
||||
* This file is licensed under the Affero General Public License version 3 or later. |
||||
* See the COPYING-README file. |
||||
*/ |
||||
|
||||
function updatePrivateKeyPasswd() { |
||||
var oldPrivateKeyPassword = $('input:password[id="oldPrivateKeyPassword"]').val(); |
||||
var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val(); |
||||
OC.msg.startSaving('#encryption .msg'); |
||||
$.post( |
||||
OC.filePath( 'files_encryption', 'ajax', 'updatePrivateKeyPassword.php' ) |
||||
, { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword } |
||||
, function( data ) { |
||||
if (data.status === "error") { |
||||
OC.msg.finishedSaving('#encryption .msg', data); |
||||
} else { |
||||
OC.msg.finishedSaving('#encryption .msg', data); |
||||
} |
||||
} |
||||
); |
||||
} |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
// Trigger ajax on recoveryAdmin status change
|
||||
$( 'input:radio[name="userEnableRecovery"]' ).change( |
||||
function() { |
||||
var recoveryStatus = $( this ).val(); |
||||
OC.msg.startAction('#userEnableRecovery .msg', 'Updating recovery keys. This can take some time...'); |
||||
$.post( |
||||
OC.filePath( 'files_encryption', 'ajax', 'userrecovery.php' ) |
||||
, { userEnableRecovery: recoveryStatus } |
||||
, function( data ) { |
||||
OC.msg.finishedAction('#userEnableRecovery .msg', data); |
||||
} |
||||
); |
||||
// Ensure page is not reloaded on form submit
|
||||
return false; |
||||
} |
||||
); |
||||
|
||||
$("#encryptAll").click( |
||||
function(){ |
||||
|
||||
// Hide feedback messages in case they're already visible
|
||||
$('#encryptAllSuccess').hide(); |
||||
$('#encryptAllError').hide(); |
||||
|
||||
var userPassword = $( '#userPassword' ).val(); |
||||
var encryptAll = $( '#encryptAll' ).val(); |
||||
|
||||
$.post( |
||||
OC.filePath( 'files_encryption', 'ajax', 'encryptall.php' ) |
||||
, { encryptAll: encryptAll, userPassword: userPassword } |
||||
, function( data ) { |
||||
if ( data.status == "success" ) { |
||||
$('#encryptAllSuccess').show(); |
||||
} else { |
||||
$('#encryptAllError').show(); |
||||
} |
||||
} |
||||
); |
||||
// Ensure page is not reloaded on form submit
|
||||
return false; |
||||
} |
||||
|
||||
); |
||||
|
||||
// update private key password
|
||||
|
||||
$('input:password[name="changePrivateKeyPassword"]').keyup(function(event) { |
||||
var oldPrivateKeyPassword = $('input:password[id="oldPrivateKeyPassword"]').val(); |
||||
var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val(); |
||||
if (newPrivateKeyPassword !== '' && oldPrivateKeyPassword !== '' ) { |
||||
$('button:button[name="submitChangePrivateKeyPassword"]').removeAttr("disabled"); |
||||
if(event.which === 13) { |
||||
updatePrivateKeyPasswd(); |
||||
} |
||||
} else { |
||||
$('button:button[name="submitChangePrivateKeyPassword"]').attr("disabled", "true"); |
||||
} |
||||
}); |
||||
|
||||
$('button:button[name="submitChangePrivateKeyPassword"]').click(function() { |
||||
updatePrivateKeyPasswd(); |
||||
}); |
||||
|
||||
}); |
||||
Loading…
Reference in new issue