@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | */ |
| 183 | 183 | protected function checkPasswordResetToken($token, $userId) { |
| 184 | 184 | $user = $this->userManager->get($userId); |
| 185 | - if($user === null || !$user->isEnabled()) { |
|
| 185 | + if ($user === null || !$user->isEnabled()) { |
|
| 186 | 186 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $splittedToken = explode(':', $decryptedToken); |
| 198 | - if(count($splittedToken) !== 2) { |
|
| 198 | + if (count($splittedToken) !== 2) { |
|
| 199 | 199 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) || |
|
| 202 | + if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) || |
|
| 203 | 203 | $user->getLastLogin() > $splittedToken[0]) { |
| 204 | 204 | throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired')); |
| 205 | 205 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | * @param array $additional |
| 215 | 215 | * @return array |
| 216 | 216 | */ |
| 217 | - private function error($message, array $additional=array()) { |
|
| 217 | + private function error($message, array $additional = array()) { |
|
| 218 | 218 | return array_merge(array('status' => 'error', 'msg' => $message), $additional); |
| 219 | 219 | } |
| 220 | 220 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @param string $user |
| 235 | 235 | * @return JSONResponse |
| 236 | 236 | */ |
| 237 | - public function email($user){ |
|
| 237 | + public function email($user) { |
|
| 238 | 238 | if ($this->config->getSystemValue('lost_password_link', '') !== '') { |
| 239 | 239 | return new JSONResponse($this->error($this->l10n->t('Password reset is disabled'))); |
| 240 | 240 | } |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | $this->config->deleteUserValue($userId, 'core', 'lostpassword'); |
| 303 | 303 | @\OC::$server->getUserSession()->unsetMagicInCookie(); |
| 304 | - } catch (HintException $e){ |
|
| 304 | + } catch (HintException $e) { |
|
| 305 | 305 | return $this->error($e->getHint()); |
| 306 | - } catch (\Exception $e){ |
|
| 306 | + } catch (\Exception $e) { |
|
| 307 | 307 | return $this->error($e->getMessage()); |
| 308 | 308 | } |
| 309 | 309 | |
@@ -334,8 +334,8 @@ discard block |
||
| 334 | 334 | ISecureRandom::CHAR_LOWER. |
| 335 | 335 | ISecureRandom::CHAR_UPPER |
| 336 | 336 | ); |
| 337 | - $tokenValue = $this->timeFactory->getTime() .':'. $token; |
|
| 338 | - $encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret')); |
|
| 337 | + $tokenValue = $this->timeFactory->getTime().':'.$token; |
|
| 338 | + $encryptedValue = $this->crypto->encrypt($tokenValue, $email.$this->config->getSystemValue('secret')); |
|
| 339 | 339 | $this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue); |
| 340 | 340 | |
| 341 | 341 | $link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user->getUID(), 'token' => $token)); |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | return $user; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - $users = array_filter($this->userManager->getByEmail($input), function (IUser $user) { |
|
| 395 | + $users = array_filter($this->userManager->getByEmail($input), function(IUser $user) { |
|
| 396 | 396 | return $user->isEnabled(); |
| 397 | 397 | }); |
| 398 | 398 | |