summaryrefslogtreecommitdiffstats
path: root/apps/encryption/hooks
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-09-11 21:18:13 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-09-14 11:49:16 +0200
commit7f459c64cb3bc011d8eb72ddb78cbd678949c675 (patch)
treec61b0836e697fb7a9a830598b6ec58b23f10e143 /apps/encryption/hooks
parent1924dd348a41bb52968f4fe598dd6f170536c724 (diff)
downloadnextcloud-server-7f459c64cb3bc011d8eb72ddb78cbd678949c675.tar.gz
nextcloud-server-7f459c64cb3bc011d8eb72ddb78cbd678949c675.zip
check for the right user if we can change his password
Diffstat (limited to 'apps/encryption/hooks')
-rw-r--r--apps/encryption/hooks/userhooks.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/encryption/hooks/userhooks.php b/apps/encryption/hooks/userhooks.php
index 8b6f17bec6d..5bd5e39f3c5 100644
--- a/apps/encryption/hooks/userhooks.php
+++ b/apps/encryption/hooks/userhooks.php
@@ -24,6 +24,7 @@
namespace OCA\Encryption\Hooks;
+use OCP\IUserManager;
use OCP\Util as OCUtil;
use OCA\Encryption\Hooks\Contracts\IHook;
use OCA\Encryption\KeyManager;
@@ -42,6 +43,10 @@ class UserHooks implements IHook {
*/
private $keyManager;
/**
+ * @var IUserManager
+ */
+ private $userManager;
+ /**
* @var ILogger
*/
private $logger;
@@ -74,6 +79,7 @@ class UserHooks implements IHook {
* UserHooks constructor.
*
* @param KeyManager $keyManager
+ * @param IUserManager $userManager
* @param ILogger $logger
* @param Setup $userSetup
* @param IUserSession $user
@@ -83,6 +89,7 @@ class UserHooks implements IHook {
* @param Recovery $recovery
*/
public function __construct(KeyManager $keyManager,
+ IUserManager $userManager,
ILogger $logger,
Setup $userSetup,
IUserSession $user,
@@ -92,6 +99,7 @@ class UserHooks implements IHook {
Recovery $recovery) {
$this->keyManager = $keyManager;
+ $this->userManager = $userManager;
$this->logger = $logger;
$this->userSetup = $userSetup;
$this->user = $user;
@@ -196,7 +204,7 @@ class UserHooks implements IHook {
public function preSetPassphrase($params) {
if (App::isEnabled('encryption')) {
- $user = $this->user->getUser();
+ $user = $this->userManager->get($params['uid']);
if ($user && !$user->canChangePassword()) {
$this->setPassphrase($params);