@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | |
24 | 24 | return [ |
25 | - 'routes' => [ |
|
26 | - ['name' => 'LastUsed#getLastUsedTagIds', 'url' => '/lastused', 'verb' => 'GET'], |
|
27 | - ] |
|
25 | + 'routes' => [ |
|
26 | + ['name' => 'LastUsed#getLastUsedTagIds', 'url' => '/lastused', 'verb' => 'GET'], |
|
27 | + ] |
|
28 | 28 | ]; |
@@ -27,44 +27,44 @@ |
||
27 | 27 | use OCP\Federation\ICloudId; |
28 | 28 | |
29 | 29 | class Cache extends \OC\Files\Cache\Cache { |
30 | - /** @var ICloudId */ |
|
31 | - private $cloudId; |
|
32 | - private $remote; |
|
33 | - private $remoteUser; |
|
34 | - private $storage; |
|
30 | + /** @var ICloudId */ |
|
31 | + private $cloudId; |
|
32 | + private $remote; |
|
33 | + private $remoteUser; |
|
34 | + private $storage; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param \OCA\Files_Sharing\External\Storage $storage |
|
38 | - * @param ICloudId $cloudId |
|
39 | - */ |
|
40 | - public function __construct($storage, ICloudId $cloudId) { |
|
41 | - $this->cloudId = $cloudId; |
|
42 | - $this->storage = $storage; |
|
43 | - list(, $remote) = explode('://', $cloudId->getRemote(), 2); |
|
44 | - $this->remote = $remote; |
|
45 | - $this->remoteUser = $cloudId->getUser(); |
|
46 | - parent::__construct($storage); |
|
47 | - } |
|
36 | + /** |
|
37 | + * @param \OCA\Files_Sharing\External\Storage $storage |
|
38 | + * @param ICloudId $cloudId |
|
39 | + */ |
|
40 | + public function __construct($storage, ICloudId $cloudId) { |
|
41 | + $this->cloudId = $cloudId; |
|
42 | + $this->storage = $storage; |
|
43 | + list(, $remote) = explode('://', $cloudId->getRemote(), 2); |
|
44 | + $this->remote = $remote; |
|
45 | + $this->remoteUser = $cloudId->getUser(); |
|
46 | + parent::__construct($storage); |
|
47 | + } |
|
48 | 48 | |
49 | - public function get($file) { |
|
50 | - $result = parent::get($file); |
|
51 | - if (!$result) { |
|
52 | - return false; |
|
53 | - } |
|
54 | - $result['displayname_owner'] = $this->cloudId->getDisplayId(); |
|
55 | - if (!$file || $file === '') { |
|
56 | - $result['is_share_mount_point'] = true; |
|
57 | - $mountPoint = rtrim($this->storage->getMountPoint()); |
|
58 | - $result['name'] = basename($mountPoint); |
|
59 | - } |
|
60 | - return $result; |
|
61 | - } |
|
49 | + public function get($file) { |
|
50 | + $result = parent::get($file); |
|
51 | + if (!$result) { |
|
52 | + return false; |
|
53 | + } |
|
54 | + $result['displayname_owner'] = $this->cloudId->getDisplayId(); |
|
55 | + if (!$file || $file === '') { |
|
56 | + $result['is_share_mount_point'] = true; |
|
57 | + $mountPoint = rtrim($this->storage->getMountPoint()); |
|
58 | + $result['name'] = basename($mountPoint); |
|
59 | + } |
|
60 | + return $result; |
|
61 | + } |
|
62 | 62 | |
63 | - public function getFolderContentsById($id) { |
|
64 | - $results = parent::getFolderContentsById($id); |
|
65 | - foreach ($results as &$file) { |
|
66 | - $file['displayname_owner'] = $this->cloudId->getDisplayId(); |
|
67 | - } |
|
68 | - return $results; |
|
69 | - } |
|
63 | + public function getFolderContentsById($id) { |
|
64 | + $results = parent::getFolderContentsById($id); |
|
65 | + foreach ($results as &$file) { |
|
66 | + $file['displayname_owner'] = $this->cloudId->getDisplayId(); |
|
67 | + } |
|
68 | + return $results; |
|
69 | + } |
|
70 | 70 | } |
@@ -61,7 +61,7 @@ |
||
61 | 61 | $managerProvider = $this->managerProvider; |
62 | 62 | $manager = $managerProvider(); |
63 | 63 | $data['manager'] = $manager; |
64 | - $mountPoint = '/' . $user->getUID() . '/files/' . ltrim($data['mountpoint'], '/'); |
|
64 | + $mountPoint = '/'.$user->getUID().'/files/'.ltrim($data['mountpoint'], '/'); |
|
65 | 65 | $data['mountpoint'] = $mountPoint; |
66 | 66 | $data['cloudId'] = $this->cloudIdManager->getCloudId($data['owner'], $data['remote']); |
67 | 67 | $data['certificateManager'] = \OC::$server->getCertificateManager($user->getUID()); |
@@ -30,59 +30,59 @@ |
||
30 | 30 | use OCP\IUser; |
31 | 31 | |
32 | 32 | class MountProvider implements IMountProvider { |
33 | - public const STORAGE = '\OCA\Files_Sharing\External\Storage'; |
|
33 | + public const STORAGE = '\OCA\Files_Sharing\External\Storage'; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @var \OCP\IDBConnection |
|
37 | - */ |
|
38 | - private $connection; |
|
35 | + /** |
|
36 | + * @var \OCP\IDBConnection |
|
37 | + */ |
|
38 | + private $connection; |
|
39 | 39 | |
40 | - /** |
|
41 | - * @var callable |
|
42 | - */ |
|
43 | - private $managerProvider; |
|
40 | + /** |
|
41 | + * @var callable |
|
42 | + */ |
|
43 | + private $managerProvider; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @var ICloudIdManager |
|
47 | - */ |
|
48 | - private $cloudIdManager; |
|
45 | + /** |
|
46 | + * @var ICloudIdManager |
|
47 | + */ |
|
48 | + private $cloudIdManager; |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param \OCP\IDBConnection $connection |
|
52 | - * @param callable $managerProvider due to setup order we need a callable that return the manager instead of the manager itself |
|
53 | - * @param ICloudIdManager $cloudIdManager |
|
54 | - */ |
|
55 | - public function __construct(IDBConnection $connection, callable $managerProvider, ICloudIdManager $cloudIdManager) { |
|
56 | - $this->connection = $connection; |
|
57 | - $this->managerProvider = $managerProvider; |
|
58 | - $this->cloudIdManager = $cloudIdManager; |
|
59 | - } |
|
50 | + /** |
|
51 | + * @param \OCP\IDBConnection $connection |
|
52 | + * @param callable $managerProvider due to setup order we need a callable that return the manager instead of the manager itself |
|
53 | + * @param ICloudIdManager $cloudIdManager |
|
54 | + */ |
|
55 | + public function __construct(IDBConnection $connection, callable $managerProvider, ICloudIdManager $cloudIdManager) { |
|
56 | + $this->connection = $connection; |
|
57 | + $this->managerProvider = $managerProvider; |
|
58 | + $this->cloudIdManager = $cloudIdManager; |
|
59 | + } |
|
60 | 60 | |
61 | - public function getMount(IUser $user, $data, IStorageFactory $storageFactory) { |
|
62 | - $managerProvider = $this->managerProvider; |
|
63 | - $manager = $managerProvider(); |
|
64 | - $data['manager'] = $manager; |
|
65 | - $mountPoint = '/' . $user->getUID() . '/files/' . ltrim($data['mountpoint'], '/'); |
|
66 | - $data['mountpoint'] = $mountPoint; |
|
67 | - $data['cloudId'] = $this->cloudIdManager->getCloudId($data['owner'], $data['remote']); |
|
68 | - $data['certificateManager'] = \OC::$server->getCertificateManager($user->getUID()); |
|
69 | - $data['HttpClientService'] = \OC::$server->getHTTPClientService(); |
|
70 | - return new Mount(self::STORAGE, $mountPoint, $data, $manager, $storageFactory); |
|
71 | - } |
|
61 | + public function getMount(IUser $user, $data, IStorageFactory $storageFactory) { |
|
62 | + $managerProvider = $this->managerProvider; |
|
63 | + $manager = $managerProvider(); |
|
64 | + $data['manager'] = $manager; |
|
65 | + $mountPoint = '/' . $user->getUID() . '/files/' . ltrim($data['mountpoint'], '/'); |
|
66 | + $data['mountpoint'] = $mountPoint; |
|
67 | + $data['cloudId'] = $this->cloudIdManager->getCloudId($data['owner'], $data['remote']); |
|
68 | + $data['certificateManager'] = \OC::$server->getCertificateManager($user->getUID()); |
|
69 | + $data['HttpClientService'] = \OC::$server->getHTTPClientService(); |
|
70 | + return new Mount(self::STORAGE, $mountPoint, $data, $manager, $storageFactory); |
|
71 | + } |
|
72 | 72 | |
73 | - public function getMountsForUser(IUser $user, IStorageFactory $loader) { |
|
74 | - $query = $this->connection->prepare(' |
|
73 | + public function getMountsForUser(IUser $user, IStorageFactory $loader) { |
|
74 | + $query = $this->connection->prepare(' |
|
75 | 75 | SELECT `remote`, `share_token`, `password`, `mountpoint`, `owner` |
76 | 76 | FROM `*PREFIX*share_external` |
77 | 77 | WHERE `user` = ? AND `accepted` = ? |
78 | 78 | '); |
79 | - $query->execute([$user->getUID(), 1]); |
|
80 | - $mounts = []; |
|
81 | - while ($row = $query->fetch()) { |
|
82 | - $row['manager'] = $this; |
|
83 | - $row['token'] = $row['share_token']; |
|
84 | - $mounts[] = $this->getMount($user, $row, $loader); |
|
85 | - } |
|
86 | - return $mounts; |
|
87 | - } |
|
79 | + $query->execute([$user->getUID(), 1]); |
|
80 | + $mounts = []; |
|
81 | + while ($row = $query->fetch()) { |
|
82 | + $row['manager'] = $this; |
|
83 | + $row['token'] = $row['share_token']; |
|
84 | + $mounts[] = $this->getMount($user, $row, $loader); |
|
85 | + } |
|
86 | + return $mounts; |
|
87 | + } |
|
88 | 88 | } |
@@ -23,12 +23,12 @@ |
||
23 | 23 | namespace OCA\Files_Sharing\External; |
24 | 24 | |
25 | 25 | class Watcher extends \OC\Files\Cache\Watcher { |
26 | - /** |
|
27 | - * remove deleted files in $path from the cache |
|
28 | - * |
|
29 | - * @param string $path |
|
30 | - */ |
|
31 | - public function cleanFolder($path) { |
|
32 | - // not needed, the scanner takes care of this |
|
33 | - } |
|
26 | + /** |
|
27 | + * remove deleted files in $path from the cache |
|
28 | + * |
|
29 | + * @param string $path |
|
30 | + */ |
|
31 | + public function cleanFolder($path) { |
|
32 | + // not needed, the scanner takes care of this |
|
33 | + } |
|
34 | 34 | } |
@@ -28,55 +28,55 @@ |
||
28 | 28 | use OCP\Settings\IIconSection; |
29 | 29 | |
30 | 30 | class Section implements IIconSection { |
31 | - /** @var IL10N */ |
|
32 | - private $l; |
|
33 | - /** @var IURLGenerator */ |
|
34 | - private $url; |
|
31 | + /** @var IL10N */ |
|
32 | + private $l; |
|
33 | + /** @var IURLGenerator */ |
|
34 | + private $url; |
|
35 | 35 | |
36 | - /** |
|
37 | - * @param IURLGenerator $url |
|
38 | - * @param IL10N $l |
|
39 | - */ |
|
40 | - public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | - $this->url = $url; |
|
42 | - $this->l = $l; |
|
43 | - } |
|
36 | + /** |
|
37 | + * @param IURLGenerator $url |
|
38 | + * @param IL10N $l |
|
39 | + */ |
|
40 | + public function __construct(IURLGenerator $url, IL10N $l) { |
|
41 | + $this->url = $url; |
|
42 | + $this->l = $l; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | - * e.g. 'ldap' |
|
48 | - * |
|
49 | - * @returns string |
|
50 | - */ |
|
51 | - public function getID() { |
|
52 | - return 'theming'; |
|
53 | - } |
|
45 | + /** |
|
46 | + * returns the ID of the section. It is supposed to be a lower case string, |
|
47 | + * e.g. 'ldap' |
|
48 | + * |
|
49 | + * @returns string |
|
50 | + */ |
|
51 | + public function getID() { |
|
52 | + return 'theming'; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | - * integration'. Use the L10N service to translate it. |
|
58 | - * |
|
59 | - * @return string |
|
60 | - */ |
|
61 | - public function getName() { |
|
62 | - return $this->l->t('Theming'); |
|
63 | - } |
|
55 | + /** |
|
56 | + * returns the translated name as it should be displayed, e.g. 'LDAP / AD |
|
57 | + * integration'. Use the L10N service to translate it. |
|
58 | + * |
|
59 | + * @return string |
|
60 | + */ |
|
61 | + public function getName() { |
|
62 | + return $this->l->t('Theming'); |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @return int whether the form should be rather on the top or bottom of |
|
67 | - * the settings navigation. The sections are arranged in ascending order of |
|
68 | - * the priority values. It is required to return a value between 0 and 99. |
|
69 | - * |
|
70 | - * E.g.: 70 |
|
71 | - */ |
|
72 | - public function getPriority() { |
|
73 | - return 30; |
|
74 | - } |
|
65 | + /** |
|
66 | + * @return int whether the form should be rather on the top or bottom of |
|
67 | + * the settings navigation. The sections are arranged in ascending order of |
|
68 | + * the priority values. It is required to return a value between 0 and 99. |
|
69 | + * |
|
70 | + * E.g.: 70 |
|
71 | + */ |
|
72 | + public function getPriority() { |
|
73 | + return 30; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * {@inheritdoc} |
|
78 | - */ |
|
79 | - public function getIcon() { |
|
80 | - return $this->url->imagePath('theming', 'app-dark.svg'); |
|
81 | - } |
|
76 | + /** |
|
77 | + * {@inheritdoc} |
|
78 | + */ |
|
79 | + public function getIcon() { |
|
80 | + return $this->url->imagePath('theming', 'app-dark.svg'); |
|
81 | + } |
|
82 | 82 | } |
@@ -34,13 +34,13 @@ |
||
34 | 34 | */ |
35 | 35 | class BackupCode extends Entity { |
36 | 36 | |
37 | - /** @var string */ |
|
38 | - protected $userId; |
|
37 | + /** @var string */ |
|
38 | + protected $userId; |
|
39 | 39 | |
40 | - /** @var string */ |
|
41 | - protected $code; |
|
40 | + /** @var string */ |
|
41 | + protected $code; |
|
42 | 42 | |
43 | - /** @var int */ |
|
44 | - protected $used; |
|
43 | + /** @var int */ |
|
44 | + protected $used; |
|
45 | 45 | |
46 | 46 | } |
@@ -128,7 +128,7 @@ |
||
128 | 128 | $encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid); |
129 | 129 | $header = $this->crypt->generateHeader(); |
130 | 130 | if ($encryptedKey) { |
131 | - $this->keyManager->setPrivateKey($uid, $header . $encryptedKey); |
|
131 | + $this->keyManager->setPrivateKey($uid, $header.$encryptedKey); |
|
132 | 132 | $this->session->setPrivateKey($decryptedKey); |
133 | 133 | $result = true; |
134 | 134 | } |
@@ -38,128 +38,128 @@ |
||
38 | 38 | |
39 | 39 | class SettingsController extends Controller { |
40 | 40 | |
41 | - /** @var IL10N */ |
|
42 | - private $l; |
|
43 | - |
|
44 | - /** @var IUserManager */ |
|
45 | - private $userManager; |
|
46 | - |
|
47 | - /** @var IUserSession */ |
|
48 | - private $userSession; |
|
49 | - |
|
50 | - /** @var KeyManager */ |
|
51 | - private $keyManager; |
|
52 | - |
|
53 | - /** @var Crypt */ |
|
54 | - private $crypt; |
|
55 | - |
|
56 | - /** @var Session */ |
|
57 | - private $session; |
|
58 | - |
|
59 | - /** @var ISession */ |
|
60 | - private $ocSession; |
|
61 | - |
|
62 | - /** @var Util */ |
|
63 | - private $util; |
|
64 | - |
|
65 | - /** |
|
66 | - * @param string $AppName |
|
67 | - * @param IRequest $request |
|
68 | - * @param IL10N $l10n |
|
69 | - * @param IUserManager $userManager |
|
70 | - * @param IUserSession $userSession |
|
71 | - * @param KeyManager $keyManager |
|
72 | - * @param Crypt $crypt |
|
73 | - * @param Session $session |
|
74 | - * @param ISession $ocSession |
|
75 | - * @param Util $util |
|
76 | - */ |
|
77 | - public function __construct($AppName, |
|
78 | - IRequest $request, |
|
79 | - IL10N $l10n, |
|
80 | - IUserManager $userManager, |
|
81 | - IUserSession $userSession, |
|
82 | - KeyManager $keyManager, |
|
83 | - Crypt $crypt, |
|
84 | - Session $session, |
|
85 | - ISession $ocSession, |
|
86 | - Util $util |
|
41 | + /** @var IL10N */ |
|
42 | + private $l; |
|
43 | + |
|
44 | + /** @var IUserManager */ |
|
45 | + private $userManager; |
|
46 | + |
|
47 | + /** @var IUserSession */ |
|
48 | + private $userSession; |
|
49 | + |
|
50 | + /** @var KeyManager */ |
|
51 | + private $keyManager; |
|
52 | + |
|
53 | + /** @var Crypt */ |
|
54 | + private $crypt; |
|
55 | + |
|
56 | + /** @var Session */ |
|
57 | + private $session; |
|
58 | + |
|
59 | + /** @var ISession */ |
|
60 | + private $ocSession; |
|
61 | + |
|
62 | + /** @var Util */ |
|
63 | + private $util; |
|
64 | + |
|
65 | + /** |
|
66 | + * @param string $AppName |
|
67 | + * @param IRequest $request |
|
68 | + * @param IL10N $l10n |
|
69 | + * @param IUserManager $userManager |
|
70 | + * @param IUserSession $userSession |
|
71 | + * @param KeyManager $keyManager |
|
72 | + * @param Crypt $crypt |
|
73 | + * @param Session $session |
|
74 | + * @param ISession $ocSession |
|
75 | + * @param Util $util |
|
76 | + */ |
|
77 | + public function __construct($AppName, |
|
78 | + IRequest $request, |
|
79 | + IL10N $l10n, |
|
80 | + IUserManager $userManager, |
|
81 | + IUserSession $userSession, |
|
82 | + KeyManager $keyManager, |
|
83 | + Crypt $crypt, |
|
84 | + Session $session, |
|
85 | + ISession $ocSession, |
|
86 | + Util $util |
|
87 | 87 | ) { |
88 | - parent::__construct($AppName, $request); |
|
89 | - $this->l = $l10n; |
|
90 | - $this->userSession = $userSession; |
|
91 | - $this->userManager = $userManager; |
|
92 | - $this->keyManager = $keyManager; |
|
93 | - $this->crypt = $crypt; |
|
94 | - $this->session = $session; |
|
95 | - $this->ocSession = $ocSession; |
|
96 | - $this->util = $util; |
|
97 | - } |
|
98 | - |
|
99 | - |
|
100 | - /** |
|
101 | - * @NoAdminRequired |
|
102 | - * @UseSession |
|
103 | - * |
|
104 | - * @param string $oldPassword |
|
105 | - * @param string $newPassword |
|
106 | - * @return DataResponse |
|
107 | - */ |
|
108 | - public function updatePrivateKeyPassword($oldPassword, $newPassword) { |
|
109 | - $result = false; |
|
110 | - $uid = $this->userSession->getUser()->getUID(); |
|
111 | - $errorMessage = $this->l->t('Could not update the private key password.'); |
|
112 | - |
|
113 | - //check if password is correct |
|
114 | - $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword); |
|
115 | - if ($passwordCorrect === false) { |
|
116 | - // if check with uid fails we need to check the password with the login name |
|
117 | - // e.g. in the ldap case. For local user we need to check the password with |
|
118 | - // the uid because in this case the login name is case insensitive |
|
119 | - $loginName = $this->ocSession->get('loginname'); |
|
120 | - $passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword); |
|
121 | - } |
|
122 | - |
|
123 | - if ($passwordCorrect !== false) { |
|
124 | - $encryptedKey = $this->keyManager->getPrivateKey($uid); |
|
125 | - $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid); |
|
126 | - |
|
127 | - if ($decryptedKey) { |
|
128 | - $encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid); |
|
129 | - $header = $this->crypt->generateHeader(); |
|
130 | - if ($encryptedKey) { |
|
131 | - $this->keyManager->setPrivateKey($uid, $header . $encryptedKey); |
|
132 | - $this->session->setPrivateKey($decryptedKey); |
|
133 | - $result = true; |
|
134 | - } |
|
135 | - } else { |
|
136 | - $errorMessage = $this->l->t('The old password was not correct, please try again.'); |
|
137 | - } |
|
138 | - } else { |
|
139 | - $errorMessage = $this->l->t('The current log-in password was not correct, please try again.'); |
|
140 | - } |
|
141 | - |
|
142 | - if ($result === true) { |
|
143 | - $this->session->setStatus(Session::INIT_SUCCESSFUL); |
|
144 | - return new DataResponse( |
|
145 | - ['message' => (string) $this->l->t('Private key password successfully updated.')] |
|
146 | - ); |
|
147 | - } else { |
|
148 | - return new DataResponse( |
|
149 | - ['message' => (string) $errorMessage], |
|
150 | - Http::STATUS_BAD_REQUEST |
|
151 | - ); |
|
152 | - } |
|
153 | - } |
|
154 | - |
|
155 | - /** |
|
156 | - * @UseSession |
|
157 | - * |
|
158 | - * @param bool $encryptHomeStorage |
|
159 | - * @return DataResponse |
|
160 | - */ |
|
161 | - public function setEncryptHomeStorage($encryptHomeStorage) { |
|
162 | - $this->util->setEncryptHomeStorage($encryptHomeStorage); |
|
163 | - return new DataResponse(); |
|
164 | - } |
|
88 | + parent::__construct($AppName, $request); |
|
89 | + $this->l = $l10n; |
|
90 | + $this->userSession = $userSession; |
|
91 | + $this->userManager = $userManager; |
|
92 | + $this->keyManager = $keyManager; |
|
93 | + $this->crypt = $crypt; |
|
94 | + $this->session = $session; |
|
95 | + $this->ocSession = $ocSession; |
|
96 | + $this->util = $util; |
|
97 | + } |
|
98 | + |
|
99 | + |
|
100 | + /** |
|
101 | + * @NoAdminRequired |
|
102 | + * @UseSession |
|
103 | + * |
|
104 | + * @param string $oldPassword |
|
105 | + * @param string $newPassword |
|
106 | + * @return DataResponse |
|
107 | + */ |
|
108 | + public function updatePrivateKeyPassword($oldPassword, $newPassword) { |
|
109 | + $result = false; |
|
110 | + $uid = $this->userSession->getUser()->getUID(); |
|
111 | + $errorMessage = $this->l->t('Could not update the private key password.'); |
|
112 | + |
|
113 | + //check if password is correct |
|
114 | + $passwordCorrect = $this->userManager->checkPassword($uid, $newPassword); |
|
115 | + if ($passwordCorrect === false) { |
|
116 | + // if check with uid fails we need to check the password with the login name |
|
117 | + // e.g. in the ldap case. For local user we need to check the password with |
|
118 | + // the uid because in this case the login name is case insensitive |
|
119 | + $loginName = $this->ocSession->get('loginname'); |
|
120 | + $passwordCorrect = $this->userManager->checkPassword($loginName, $newPassword); |
|
121 | + } |
|
122 | + |
|
123 | + if ($passwordCorrect !== false) { |
|
124 | + $encryptedKey = $this->keyManager->getPrivateKey($uid); |
|
125 | + $decryptedKey = $this->crypt->decryptPrivateKey($encryptedKey, $oldPassword, $uid); |
|
126 | + |
|
127 | + if ($decryptedKey) { |
|
128 | + $encryptedKey = $this->crypt->encryptPrivateKey($decryptedKey, $newPassword, $uid); |
|
129 | + $header = $this->crypt->generateHeader(); |
|
130 | + if ($encryptedKey) { |
|
131 | + $this->keyManager->setPrivateKey($uid, $header . $encryptedKey); |
|
132 | + $this->session->setPrivateKey($decryptedKey); |
|
133 | + $result = true; |
|
134 | + } |
|
135 | + } else { |
|
136 | + $errorMessage = $this->l->t('The old password was not correct, please try again.'); |
|
137 | + } |
|
138 | + } else { |
|
139 | + $errorMessage = $this->l->t('The current log-in password was not correct, please try again.'); |
|
140 | + } |
|
141 | + |
|
142 | + if ($result === true) { |
|
143 | + $this->session->setStatus(Session::INIT_SUCCESSFUL); |
|
144 | + return new DataResponse( |
|
145 | + ['message' => (string) $this->l->t('Private key password successfully updated.')] |
|
146 | + ); |
|
147 | + } else { |
|
148 | + return new DataResponse( |
|
149 | + ['message' => (string) $errorMessage], |
|
150 | + Http::STATUS_BAD_REQUEST |
|
151 | + ); |
|
152 | + } |
|
153 | + } |
|
154 | + |
|
155 | + /** |
|
156 | + * @UseSession |
|
157 | + * |
|
158 | + * @param bool $encryptHomeStorage |
|
159 | + * @return DataResponse |
|
160 | + */ |
|
161 | + public function setEncryptHomeStorage($encryptHomeStorage) { |
|
162 | + $this->util->setEncryptHomeStorage($encryptHomeStorage); |
|
163 | + return new DataResponse(); |
|
164 | + } |
|
165 | 165 | } |
@@ -27,72 +27,72 @@ |
||
27 | 27 | |
28 | 28 | class Setting implements ISetting { |
29 | 29 | |
30 | - /** @var IL10N */ |
|
31 | - protected $l; |
|
30 | + /** @var IL10N */ |
|
31 | + protected $l; |
|
32 | 32 | |
33 | - /** |
|
34 | - * @param IL10N $l |
|
35 | - */ |
|
36 | - public function __construct(IL10N $l) { |
|
37 | - $this->l = $l; |
|
38 | - } |
|
33 | + /** |
|
34 | + * @param IL10N $l |
|
35 | + */ |
|
36 | + public function __construct(IL10N $l) { |
|
37 | + $this->l = $l; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return string Lowercase a-z and underscore only identifier |
|
42 | - * @since 11.0.0 |
|
43 | - */ |
|
44 | - public function getIdentifier() { |
|
45 | - return 'comments'; |
|
46 | - } |
|
40 | + /** |
|
41 | + * @return string Lowercase a-z and underscore only identifier |
|
42 | + * @since 11.0.0 |
|
43 | + */ |
|
44 | + public function getIdentifier() { |
|
45 | + return 'comments'; |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return string A translated string |
|
50 | - * @since 11.0.0 |
|
51 | - */ |
|
52 | - public function getName() { |
|
53 | - return $this->l->t('<strong>Comments</strong> for files'); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return string A translated string |
|
50 | + * @since 11.0.0 |
|
51 | + */ |
|
52 | + public function getName() { |
|
53 | + return $this->l->t('<strong>Comments</strong> for files'); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @return int whether the filter should be rather on the top or bottom of |
|
58 | - * the admin section. The filters are arranged in ascending order of the |
|
59 | - * priority values. It is required to return a value between 0 and 100. |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 50; |
|
64 | - } |
|
56 | + /** |
|
57 | + * @return int whether the filter should be rather on the top or bottom of |
|
58 | + * the admin section. The filters are arranged in ascending order of the |
|
59 | + * priority values. It is required to return a value between 0 and 100. |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 50; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return bool True when the option can be changed for the stream |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function canChangeStream() { |
|
71 | - return true; |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return bool True when the option can be changed for the stream |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function canChangeStream() { |
|
71 | + return true; |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @return bool True when the option can be changed for the stream |
|
76 | - * @since 11.0.0 |
|
77 | - */ |
|
78 | - public function isDefaultEnabledStream() { |
|
79 | - return true; |
|
80 | - } |
|
74 | + /** |
|
75 | + * @return bool True when the option can be changed for the stream |
|
76 | + * @since 11.0.0 |
|
77 | + */ |
|
78 | + public function isDefaultEnabledStream() { |
|
79 | + return true; |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * @return bool True when the option can be changed for the mail |
|
84 | - * @since 11.0.0 |
|
85 | - */ |
|
86 | - public function canChangeMail() { |
|
87 | - return true; |
|
88 | - } |
|
82 | + /** |
|
83 | + * @return bool True when the option can be changed for the mail |
|
84 | + * @since 11.0.0 |
|
85 | + */ |
|
86 | + public function canChangeMail() { |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * @return bool True when the option can be changed for the stream |
|
92 | - * @since 11.0.0 |
|
93 | - */ |
|
94 | - public function isDefaultEnabledMail() { |
|
95 | - return false; |
|
96 | - } |
|
90 | + /** |
|
91 | + * @return bool True when the option can be changed for the stream |
|
92 | + * @since 11.0.0 |
|
93 | + */ |
|
94 | + public function isDefaultEnabledMail() { |
|
95 | + return false; |
|
96 | + } |
|
97 | 97 | } |
98 | 98 |
@@ -28,63 +28,63 @@ |
||
28 | 28 | |
29 | 29 | class Filter implements IFilter { |
30 | 30 | |
31 | - /** @var IL10N */ |
|
32 | - protected $l; |
|
31 | + /** @var IL10N */ |
|
32 | + protected $l; |
|
33 | 33 | |
34 | - /** @var IURLGenerator */ |
|
35 | - protected $url; |
|
34 | + /** @var IURLGenerator */ |
|
35 | + protected $url; |
|
36 | 36 | |
37 | - public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | - $this->l = $l; |
|
39 | - $this->url = $url; |
|
40 | - } |
|
37 | + public function __construct(IL10N $l, IURLGenerator $url) { |
|
38 | + $this->l = $l; |
|
39 | + $this->url = $url; |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * @return string Lowercase a-z only identifier |
|
44 | - * @since 11.0.0 |
|
45 | - */ |
|
46 | - public function getIdentifier() { |
|
47 | - return 'comments'; |
|
48 | - } |
|
42 | + /** |
|
43 | + * @return string Lowercase a-z only identifier |
|
44 | + * @since 11.0.0 |
|
45 | + */ |
|
46 | + public function getIdentifier() { |
|
47 | + return 'comments'; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @return string A translated string |
|
52 | - * @since 11.0.0 |
|
53 | - */ |
|
54 | - public function getName() { |
|
55 | - return $this->l->t('Comments'); |
|
56 | - } |
|
50 | + /** |
|
51 | + * @return string A translated string |
|
52 | + * @since 11.0.0 |
|
53 | + */ |
|
54 | + public function getName() { |
|
55 | + return $this->l->t('Comments'); |
|
56 | + } |
|
57 | 57 | |
58 | - /** |
|
59 | - * @return int |
|
60 | - * @since 11.0.0 |
|
61 | - */ |
|
62 | - public function getPriority() { |
|
63 | - return 40; |
|
64 | - } |
|
58 | + /** |
|
59 | + * @return int |
|
60 | + * @since 11.0.0 |
|
61 | + */ |
|
62 | + public function getPriority() { |
|
63 | + return 40; |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * @return string Full URL to an icon, empty string when none is given |
|
68 | - * @since 11.0.0 |
|
69 | - */ |
|
70 | - public function getIcon() { |
|
71 | - return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')); |
|
72 | - } |
|
66 | + /** |
|
67 | + * @return string Full URL to an icon, empty string when none is given |
|
68 | + * @since 11.0.0 |
|
69 | + */ |
|
70 | + public function getIcon() { |
|
71 | + return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/comment.svg')); |
|
72 | + } |
|
73 | 73 | |
74 | - /** |
|
75 | - * @param string[] $types |
|
76 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
77 | - * @since 11.0.0 |
|
78 | - */ |
|
79 | - public function filterTypes(array $types) { |
|
80 | - return $types; |
|
81 | - } |
|
74 | + /** |
|
75 | + * @param string[] $types |
|
76 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
77 | + * @since 11.0.0 |
|
78 | + */ |
|
79 | + public function filterTypes(array $types) { |
|
80 | + return $types; |
|
81 | + } |
|
82 | 82 | |
83 | - /** |
|
84 | - * @return string[] An array of allowed apps from which activities should be displayed |
|
85 | - * @since 11.0.0 |
|
86 | - */ |
|
87 | - public function allowedApps() { |
|
88 | - return ['comments']; |
|
89 | - } |
|
83 | + /** |
|
84 | + * @return string[] An array of allowed apps from which activities should be displayed |
|
85 | + * @since 11.0.0 |
|
86 | + */ |
|
87 | + public function allowedApps() { |
|
88 | + return ['comments']; |
|
89 | + } |
|
90 | 90 | } |