Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
f6efbfcf
Commit
f6efbfcf
authored
Oct 29, 2014
by
Bjoern Schiessle
Committed by
Lukas Reschke
Nov 17, 2014
Browse files
listen to the post_passwordReset hook, backup the old keys and create a new key pair for the user
parent
11ab457b
Changes
3
Hide whitespace changes
Inline
Side-by-side
apps/files_encryption/hooks/hooks.php
View file @
f6efbfcf
...
...
@@ -263,6 +263,19 @@ class Hooks {
}
}
/**
* after password reset we create a new key pair for the user
*
* @param array $params
*/
public
static
function
postPasswordReset
(
$params
)
{
$uid
=
$params
[
'uid'
];
$password
=
$params
[
'password'
];
$util
=
new
Util
(
new
\
OC\Files\View
(),
$uid
);
$util
->
replaceUserKeys
(
$password
);
}
/*
* check if files can be encrypted to every user.
*/
...
...
apps/files_encryption/lib/helper.php
View file @
f6efbfcf
...
...
@@ -70,6 +70,7 @@ class Helper {
\
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'delete'
,
'OCA\Encryption\Hooks'
,
'preDelete'
);
\
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'post_umount'
,
'OCA\Encryption\Hooks'
,
'postUmount'
);
\
OCP\Util
::
connectHook
(
'OC_Filesystem'
,
'umount'
,
'OCA\Encryption\Hooks'
,
'preUmount'
);
\
OCP\Util
::
connectHook
(
'\OC\Core\LostPassword\Controller\LostController'
,
'post_passwordReset'
,
'OCA\Encryption\Hooks'
,
'postPasswordReset'
);
}
/**
...
...
apps/files_encryption/lib/util.php
View file @
f6efbfcf
...
...
@@ -124,6 +124,18 @@ class Util {
}
}
/**
* create a new public/private key pair for the user
*
* @param string $password password for the private key
*/
public
function
replaceUserKeys
(
$password
)
{
$this
->
backupAllKeys
(
'password_reset'
);
$this
->
view
->
unlink
(
$this
->
publicKeyPath
);
$this
->
view
->
unlink
(
$this
->
privateKeyPath
);
$this
->
setupServerSide
(
$password
);
}
/**
* Sets up user folders and keys for serverside encryption
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment