@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $storedPassword = $share->getPassword(); |
148 | 148 | $authenticated = $this->session->get('public_link_authenticated') === $share->getId() || |
149 | 149 | $this->shareManager->checkPassword($share, $password); |
150 | - if (!empty($storedPassword) && !$authenticated ) { |
|
150 | + if (!empty($storedPassword) && !$authenticated) { |
|
151 | 151 | $response = new JSONResponse( |
152 | 152 | ['message' => 'No permission to access the share'], |
153 | 153 | Http::STATUS_BAD_REQUEST |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $httpClient = $this->clientService->newClient(); |
192 | 192 | |
193 | 193 | try { |
194 | - $response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare', |
|
194 | + $response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare', |
|
195 | 195 | [ |
196 | 196 | 'body' => |
197 | 197 | [ |
@@ -285,14 +285,14 @@ discard block |
||
285 | 285 | // note: checkStorageAvailability will already remove the invalid share |
286 | 286 | Util::writeLog( |
287 | 287 | 'federatedfilesharing', |
288 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
288 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
289 | 289 | Util::DEBUG |
290 | 290 | ); |
291 | 291 | return new JSONResponse(['message' => $this->l->t('Could not authenticate to remote share, password might be wrong')], Http::STATUS_BAD_REQUEST); |
292 | 292 | } catch (\Exception $e) { |
293 | 293 | Util::writeLog( |
294 | 294 | 'federatedfilesharing', |
295 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
295 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
296 | 296 | Util::DEBUG |
297 | 297 | ); |
298 | 298 | $externalManager->removeShare($mount->getMountPoint()); |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | } catch (StorageInvalidException $e) { |
312 | 312 | Util::writeLog( |
313 | 313 | 'federatedfilesharing', |
314 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
314 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
315 | 315 | Util::DEBUG |
316 | 316 | ); |
317 | 317 | return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST); |
318 | 318 | } catch (\Exception $e) { |
319 | 319 | Util::writeLog( |
320 | 320 | 'federatedfilesharing', |
321 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
321 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
322 | 322 | Util::DEBUG |
323 | 323 | ); |
324 | 324 | return new JSONResponse(['message' => $this->l->t('Couldn\'t add remote share')], Http::STATUS_BAD_REQUEST); |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected function checkPasswordResetToken($token, $userId) { |
162 | 162 | $user = $this->userManager->get($userId); |
163 | - if($user === null) { |
|
163 | + if ($user === null) { |
|
164 | 164 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); |
165 | 165 | } |
166 | 166 | |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | $splittedToken = explode(':', $decryptedToken); |
176 | - if(count($splittedToken) !== 2) { |
|
176 | + if (count($splittedToken) !== 2) { |
|
177 | 177 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); |
178 | 178 | } |
179 | 179 | |
180 | - if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*12) || |
|
180 | + if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 12) || |
|
181 | 181 | $user->getLastLogin() > $splittedToken[0]) { |
182 | 182 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired')); |
183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @param array $additional |
193 | 193 | * @return array |
194 | 194 | */ |
195 | - private function error($message, array $additional=array()) { |
|
195 | + private function error($message, array $additional = array()) { |
|
196 | 196 | return array_merge(array('status' => 'error', 'msg' => $message), $additional); |
197 | 197 | } |
198 | 198 | |
@@ -210,11 +210,11 @@ discard block |
||
210 | 210 | * @param string $user |
211 | 211 | * @return JSONResponse |
212 | 212 | */ |
213 | - public function email($user){ |
|
213 | + public function email($user) { |
|
214 | 214 | // FIXME: use HTTP error codes |
215 | 215 | try { |
216 | 216 | $this->sendEmail($user); |
217 | - } catch (\Exception $e){ |
|
217 | + } catch (\Exception $e) { |
|
218 | 218 | $response = new JSONResponse($this->error($e->getMessage())); |
219 | 219 | $response->throttle(); |
220 | 220 | return $response; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | $this->config->deleteUserValue($userId, 'core', 'lostpassword'); |
254 | 254 | @\OC_User::unsetMagicInCookie(); |
255 | - } catch (\Exception $e){ |
|
255 | + } catch (\Exception $e) { |
|
256 | 256 | return $this->error($e->getMessage()); |
257 | 257 | } |
258 | 258 | |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | ISecureRandom::CHAR_LOWER. |
284 | 284 | ISecureRandom::CHAR_UPPER |
285 | 285 | ); |
286 | - $tokenValue = $this->timeFactory->getTime() .':'. $token; |
|
287 | - $encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret')); |
|
286 | + $tokenValue = $this->timeFactory->getTime().':'.$token; |
|
287 | + $encryptedValue = $this->crypto->encrypt($tokenValue, $email.$this->config->getSystemValue('secret')); |
|
288 | 288 | $this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue); |
289 | 289 | |
290 | 290 | $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user->getUID(), 'token' => $token)); |