diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-19 15:08:02 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-05-19 15:53:50 +0200 |
commit | d9f715bdad6ced747924567638471a7402726abf (patch) | |
tree | d817676a46b03db8369d91b1fc69440643d6f383 /apps/files_encryption/hooks/hooks.php | |
parent | 6c4b650524c4a8655984b89d4e7d105cfa61808c (diff) | |
download | nextcloud-server-d9f715bdad6ced747924567638471a7402726abf.tar.gz nextcloud-server-d9f715bdad6ced747924567638471a7402726abf.zip |
only start migration if the encryption was initialized; allow to overwrite keys if no files exists
Diffstat (limited to 'apps/files_encryption/hooks/hooks.php')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 0ab1c4b129c..0d5e4fca05d 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -81,7 +81,7 @@ class Hooks { // Check if first-run file migration has already been performed
$ready = false;
$migrationStatus = $util->getMigrationStatus();
- if ($migrationStatus === Util::MIGRATION_OPEN) {
+ if ($migrationStatus === Util::MIGRATION_OPEN && $session !== false) {
$ready = $util->beginMigration();
} elseif ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
// refuse login as long as the initial encryption is running
@@ -222,10 +222,14 @@ class Hooks { $util = new Util($view, $user);
$recoveryPassword = isset($params['recoveryPassword']) ? $params['recoveryPassword'] : null;
+ // we generate new keys if...
+ // ...we have a recovery password and the user enabled the recovery key
+ // ...encryption was activated for the first time (no keys exists)
+ // ...the user doesn't have any files
if (($util->recoveryEnabledForUser() && $recoveryPassword)
- || !$util->userKeysExists()) {
+ || !$util->userKeysExists()
+ || !$view->file_exists($user . '/files')) {
- $recoveryPassword = $params['recoveryPassword'];
$newUserPassword = $params['password'];
// make sure that the users home is mounted
|