Passed
Push — master ( 53c077...a32577 )
by Roeland
12:47
created
core/Controller/LostController.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	protected function checkPasswordResetToken($token, $userId) {
177 177
 		$user = $this->userManager->get($userId);
178
-		if($user === null || !$user->isEnabled()) {
178
+		if ($user === null || !$user->isEnabled()) {
179 179
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
180 180
 		}
181 181
 
@@ -188,11 +188,11 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		$splittedToken = explode(':', $decryptedToken);
191
-		if(count($splittedToken) !== 2) {
191
+		if (count($splittedToken) !== 2) {
192 192
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
193 193
 		}
194 194
 
195
-		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60*60*24*7) ||
195
+		if ($splittedToken[0] < ($this->timeFactory->getTime() - 60 * 60 * 24 * 7) ||
196 196
 			$user->getLastLogin() > $splittedToken[0]) {
197 197
 			throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
198 198
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param array $additional
208 208
 	 * @return array
209 209
 	 */
210
-	private function error($message, array $additional=array()) {
210
+	private function error($message, array $additional = array()) {
211 211
 		return array_merge(array('status' => 'error', 'msg' => $message), $additional);
212 212
 	}
213 213
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @param string $user
228 228
 	 * @return JSONResponse
229 229
 	 */
230
-	public function email($user){
230
+	public function email($user) {
231 231
 		if ($this->config->getSystemValue('lost_password_link', '') !== '') {
232 232
 			return new JSONResponse($this->error($this->l10n->t('Password reset is disabled')));
233 233
 		}
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
 
293 293
 			$this->config->deleteUserValue($userId, 'core', 'lostpassword');
294 294
 			@\OC::$server->getUserSession()->unsetMagicInCookie();
295
-		} catch (HintException $e){
295
+		} catch (HintException $e) {
296 296
 			return $this->error($e->getHint());
297
-		} catch (\Exception $e){
297
+		} catch (\Exception $e) {
298 298
 			return $this->error($e->getMessage());
299 299
 		}
300 300
 
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 			ISecureRandom::CHAR_LOWER.
326 326
 			ISecureRandom::CHAR_UPPER
327 327
 		);
328
-		$tokenValue = $this->timeFactory->getTime() .':'. $token;
329
-		$encryptedValue = $this->crypto->encrypt($tokenValue, $email . $this->config->getSystemValue('secret'));
328
+		$tokenValue = $this->timeFactory->getTime().':'.$token;
329
+		$encryptedValue = $this->crypto->encrypt($tokenValue, $email.$this->config->getSystemValue('secret'));
330 330
 		$this->config->setUserValue($user->getUID(), 'core', 'lostpassword', $encryptedValue);
331 331
 
332 332
 		$link = $this->urlGenerator->linkToRouteAbsolute('core.lost.resetform', array('userId' => $user->getUID(), 'token' => $token));
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			return $user;
384 384
 		}
385 385
 
386
-		$users = \array_filter($this->userManager->getByEmail($input), function (IUser $user) {
386
+		$users = \array_filter($this->userManager->getByEmail($input), function(IUser $user) {
387 387
 			return $user->isEnabled();
388 388
 		});
389 389
 
Please login to merge, or discard this patch.