Passed
Push — master ( 90c6d5...a6a8f8 )
by Morris
20:05 queued 10:20
created
lib/private/Authentication/Login/ClearLostPasswordTokensCommand.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -29,24 +29,24 @@
 block discarded – undo
29 29
 
30 30
 class ClearLostPasswordTokensCommand extends ALoginCommand {
31 31
 
32
-	/** @var IConfig */
33
-	private $config;
34
-
35
-	public function __construct(IConfig $config) {
36
-		$this->config = $config;
37
-	}
38
-
39
-	/**
40
-	 * User has successfully logged in, now remove the password reset link, when it is available
41
-	 */
42
-	public function process(LoginData $loginData): LoginResult {
43
-		$this->config->deleteUserValue(
44
-			$loginData->getUser()->getUID(),
45
-			'core',
46
-			'lostpassword'
47
-		);
48
-
49
-		return $this->processNextOrFinishSuccessfully($loginData);
50
-	}
32
+    /** @var IConfig */
33
+    private $config;
34
+
35
+    public function __construct(IConfig $config) {
36
+        $this->config = $config;
37
+    }
38
+
39
+    /**
40
+     * User has successfully logged in, now remove the password reset link, when it is available
41
+     */
42
+    public function process(LoginData $loginData): LoginResult {
43
+        $this->config->deleteUserValue(
44
+            $loginData->getUser()->getUID(),
45
+            'core',
46
+            'lostpassword'
47
+        );
48
+
49
+        return $this->processNextOrFinishSuccessfully($loginData);
50
+    }
51 51
 
52 52
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/UidLoginCommand.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -30,28 +30,28 @@
 block discarded – undo
30 30
 
31 31
 class UidLoginCommand extends ALoginCommand {
32 32
 
33
-	/** @var Manager */
34
-	private $userManager;
35
-
36
-	public function __construct(Manager $userManager) {
37
-		$this->userManager = $userManager;
38
-	}
39
-
40
-	/**
41
-	 * @param LoginData $loginData
42
-	 *
43
-	 * @return LoginResult
44
-	 */
45
-	public function process(LoginData $loginData): LoginResult {
46
-		/* @var $loginResult IUser */
47
-		$user = $this->userManager->checkPasswordNoLogging(
48
-			$loginData->getUsername(),
49
-			$loginData->getPassword()
50
-		);
51
-
52
-		$loginData->setUser($user);
53
-
54
-		return $this->processNextOrFinishSuccessfully($loginData);
55
-	}
33
+    /** @var Manager */
34
+    private $userManager;
35
+
36
+    public function __construct(Manager $userManager) {
37
+        $this->userManager = $userManager;
38
+    }
39
+
40
+    /**
41
+     * @param LoginData $loginData
42
+     *
43
+     * @return LoginResult
44
+     */
45
+    public function process(LoginData $loginData): LoginResult {
46
+        /* @var $loginResult IUser */
47
+        $user = $this->userManager->checkPasswordNoLogging(
48
+            $loginData->getUsername(),
49
+            $loginData->getPassword()
50
+        );
51
+
52
+        $loginData->setUser($user);
53
+
54
+        return $this->processNextOrFinishSuccessfully($loginData);
55
+    }
56 56
 
57 57
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/ALoginCommand.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,22 +26,22 @@
 block discarded – undo
26 26
 
27 27
 abstract class ALoginCommand {
28 28
 
29
-	/** @var ALoginCommand */
30
-	protected $next;
31
-
32
-	public function setNext(ALoginCommand $next): ALoginCommand {
33
-		$this->next = $next;
34
-		return $next;
35
-	}
36
-
37
-	protected function processNextOrFinishSuccessfully(LoginData $loginData): LoginResult {
38
-		if ($this->next !== null) {
39
-			return $this->next->process($loginData);
40
-		} else {
41
-			return LoginResult::success($loginData);
42
-		}
43
-	}
44
-
45
-	public abstract function process(LoginData $loginData): LoginResult;
29
+    /** @var ALoginCommand */
30
+    protected $next;
31
+
32
+    public function setNext(ALoginCommand $next): ALoginCommand {
33
+        $this->next = $next;
34
+        return $next;
35
+    }
36
+
37
+    protected function processNextOrFinishSuccessfully(LoginData $loginData): LoginResult {
38
+        if ($this->next !== null) {
39
+            return $this->next->process($loginData);
40
+        } else {
41
+            return LoginResult::success($loginData);
42
+        }
43
+    }
44
+
45
+    public abstract function process(LoginData $loginData): LoginResult;
46 46
 
47 47
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/TwoFactorCommand.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -33,47 +33,47 @@
 block discarded – undo
33 33
 
34 34
 class TwoFactorCommand extends ALoginCommand {
35 35
 
36
-	/** @var Manager */
37
-	private $twoFactorManager;
36
+    /** @var Manager */
37
+    private $twoFactorManager;
38 38
 
39
-	/** @var IURLGenerator */
40
-	private $urlGenerator;
39
+    /** @var IURLGenerator */
40
+    private $urlGenerator;
41 41
 
42
-	public function __construct(Manager $twoFactorManager,
43
-								IURLGenerator $urlGenerator) {
44
-		$this->twoFactorManager = $twoFactorManager;
45
-		$this->urlGenerator = $urlGenerator;
46
-	}
42
+    public function __construct(Manager $twoFactorManager,
43
+                                IURLGenerator $urlGenerator) {
44
+        $this->twoFactorManager = $twoFactorManager;
45
+        $this->urlGenerator = $urlGenerator;
46
+    }
47 47
 
48
-	public function process(LoginData $loginData): LoginResult {
49
-		if (!$this->twoFactorManager->isTwoFactorAuthenticated($loginData->getUser())) {
50
-			return $this->processNextOrFinishSuccessfully($loginData);
51
-		}
48
+    public function process(LoginData $loginData): LoginResult {
49
+        if (!$this->twoFactorManager->isTwoFactorAuthenticated($loginData->getUser())) {
50
+            return $this->processNextOrFinishSuccessfully($loginData);
51
+        }
52 52
 
53
-		$this->twoFactorManager->prepareTwoFactorLogin($loginData->getUser(), $loginData->isRememberLogin());
53
+        $this->twoFactorManager->prepareTwoFactorLogin($loginData->getUser(), $loginData->isRememberLogin());
54 54
 
55
-		$providers = $this->twoFactorManager->getProviderSet($loginData->getUser())->getPrimaryProviders();
56
-		if (count($providers) === 1) {
57
-			// Single provider, hence we can redirect to that provider's challenge page directly
58
-			/* @var $provider IProvider */
59
-			$provider = array_pop($providers);
60
-			$url = 'core.TwoFactorChallenge.showChallenge';
61
-			$urlParams = [
62
-				'challengeProviderId' => $provider->getId(),
63
-			];
64
-		} else {
65
-			$url = 'core.TwoFactorChallenge.selectChallenge';
66
-			$urlParams = [];
67
-		}
55
+        $providers = $this->twoFactorManager->getProviderSet($loginData->getUser())->getPrimaryProviders();
56
+        if (count($providers) === 1) {
57
+            // Single provider, hence we can redirect to that provider's challenge page directly
58
+            /* @var $provider IProvider */
59
+            $provider = array_pop($providers);
60
+            $url = 'core.TwoFactorChallenge.showChallenge';
61
+            $urlParams = [
62
+                'challengeProviderId' => $provider->getId(),
63
+            ];
64
+        } else {
65
+            $url = 'core.TwoFactorChallenge.selectChallenge';
66
+            $urlParams = [];
67
+        }
68 68
 
69
-		if ($loginData->getRedirectUrl() !== null) {
70
-			$urlParams['redirect_url'] = $loginData->getRedirectUrl();
71
-		}
69
+        if ($loginData->getRedirectUrl() !== null) {
70
+            $urlParams['redirect_url'] = $loginData->getRedirectUrl();
71
+        }
72 72
 
73
-		return LoginResult::success(
74
-			$loginData,
75
-			$this->urlGenerator->linkToRoute($url, $urlParams)
76
-		);
77
-	}
73
+        return LoginResult::success(
74
+            $loginData,
75
+            $this->urlGenerator->linkToRoute($url, $urlParams)
76
+        );
77
+    }
78 78
 
79 79
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/LoggedInCheckCommand.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,24 +30,24 @@
 block discarded – undo
30 30
 
31 31
 class LoggedInCheckCommand extends ALoginCommand {
32 32
 
33
-	/** @var ILogger */
34
-	private $logger;
33
+    /** @var ILogger */
34
+    private $logger;
35 35
 
36
-	public function __construct(ILogger $logger) {
37
-		$this->logger = $logger;
38
-	}
36
+    public function __construct(ILogger $logger) {
37
+        $this->logger = $logger;
38
+    }
39 39
 
40
-	public function process(LoginData $loginData): LoginResult {
41
-		if ($loginData->getUser() === false) {
42
-			$username = $loginData->getUsername();
43
-			$ip = $loginData->getRequest()->getRemoteAddress();
40
+    public function process(LoginData $loginData): LoginResult {
41
+        if ($loginData->getUser() === false) {
42
+            $username = $loginData->getUsername();
43
+            $ip = $loginData->getRequest()->getRemoteAddress();
44 44
 
45
-			$this->logger->warning("Login failed: $username (Remote IP: $ip)");
45
+            $this->logger->warning("Login failed: $username (Remote IP: $ip)");
46 46
 
47
-			return LoginResult::failure($loginData, LoginController::LOGIN_MSG_INVALIDPASSWORD);
48
-		}
47
+            return LoginResult::failure($loginData, LoginController::LOGIN_MSG_INVALIDPASSWORD);
48
+        }
49 49
 
50
-		return $this->processNextOrFinishSuccessfully($loginData);
51
-	}
50
+        return $this->processNextOrFinishSuccessfully($loginData);
51
+    }
52 52
 
53 53
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/LoginData.php 1 patch
Indentation   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -30,92 +30,92 @@
 block discarded – undo
30 30
 
31 31
 class LoginData {
32 32
 
33
-	/** @var IRequest */
34
-	private $request;
35
-
36
-	/** @var string */
37
-	private $username;
38
-
39
-	/** @var string */
40
-	private $password;
41
-
42
-	/** @var string */
43
-	private $redirectUrl;
44
-
45
-	/** @var string */
46
-	private $timeZone;
47
-
48
-	/** @var string */
49
-	private $timeZoneOffset;
50
-
51
-	/** @var IUser|false|null */
52
-	private $user = null;
53
-
54
-	/** @var bool */
55
-	private $rememberLogin = true;
56
-
57
-	public function __construct(IRequest $request,
58
-								string $username,
59
-								string $password,
60
-								string $redirectUrl = null,
61
-								string $timeZone = '',
62
-								string $timeZoneOffset = '') {
63
-		$this->request = $request;
64
-		$this->username = $username;
65
-		$this->password = $password;
66
-		$this->redirectUrl = $redirectUrl;
67
-		$this->timeZone = $timeZone;
68
-		$this->timeZoneOffset = $timeZoneOffset;
69
-	}
70
-
71
-	public function getRequest(): IRequest {
72
-		return $this->request;
73
-	}
74
-
75
-	public function setUsername(string $username): void {
76
-		$this->username = $username;
77
-	}
78
-
79
-	public function getUsername(): string {
80
-		return $this->username;
81
-	}
82
-
83
-	public function getPassword(): string {
84
-		return $this->password;
85
-	}
86
-
87
-	public function getRedirectUrl(): ?string {
88
-		return $this->redirectUrl;
89
-	}
90
-
91
-	public function getTimeZone(): string {
92
-		return $this->timeZone;
93
-	}
94
-
95
-	public function getTimeZoneOffset(): string {
96
-		return $this->timeZoneOffset;
97
-	}
98
-
99
-	/**
100
-	 * @param IUser|false|null $user
101
-	 */
102
-	public function setUser($user) {
103
-		$this->user = $user;
104
-	}
105
-
106
-	/**
107
-	 * @return false|IUser|null
108
-	 */
109
-	public function getUser() {
110
-		return $this->user;
111
-	}
112
-
113
-	public function setRememberLogin(bool $rememberLogin): void {
114
-		$this->rememberLogin = $rememberLogin;
115
-	}
116
-
117
-	public function isRememberLogin(): bool {
118
-		return $this->rememberLogin;
119
-	}
33
+    /** @var IRequest */
34
+    private $request;
35
+
36
+    /** @var string */
37
+    private $username;
38
+
39
+    /** @var string */
40
+    private $password;
41
+
42
+    /** @var string */
43
+    private $redirectUrl;
44
+
45
+    /** @var string */
46
+    private $timeZone;
47
+
48
+    /** @var string */
49
+    private $timeZoneOffset;
50
+
51
+    /** @var IUser|false|null */
52
+    private $user = null;
53
+
54
+    /** @var bool */
55
+    private $rememberLogin = true;
56
+
57
+    public function __construct(IRequest $request,
58
+                                string $username,
59
+                                string $password,
60
+                                string $redirectUrl = null,
61
+                                string $timeZone = '',
62
+                                string $timeZoneOffset = '') {
63
+        $this->request = $request;
64
+        $this->username = $username;
65
+        $this->password = $password;
66
+        $this->redirectUrl = $redirectUrl;
67
+        $this->timeZone = $timeZone;
68
+        $this->timeZoneOffset = $timeZoneOffset;
69
+    }
70
+
71
+    public function getRequest(): IRequest {
72
+        return $this->request;
73
+    }
74
+
75
+    public function setUsername(string $username): void {
76
+        $this->username = $username;
77
+    }
78
+
79
+    public function getUsername(): string {
80
+        return $this->username;
81
+    }
82
+
83
+    public function getPassword(): string {
84
+        return $this->password;
85
+    }
86
+
87
+    public function getRedirectUrl(): ?string {
88
+        return $this->redirectUrl;
89
+    }
90
+
91
+    public function getTimeZone(): string {
92
+        return $this->timeZone;
93
+    }
94
+
95
+    public function getTimeZoneOffset(): string {
96
+        return $this->timeZoneOffset;
97
+    }
98
+
99
+    /**
100
+     * @param IUser|false|null $user
101
+     */
102
+    public function setUser($user) {
103
+        $this->user = $user;
104
+    }
105
+
106
+    /**
107
+     * @return false|IUser|null
108
+     */
109
+    public function getUser() {
110
+        return $this->user;
111
+    }
112
+
113
+    public function setRememberLogin(bool $rememberLogin): void {
114
+        $this->rememberLogin = $rememberLogin;
115
+    }
116
+
117
+    public function isRememberLogin(): bool {
118
+        return $this->rememberLogin;
119
+    }
120 120
 
121 121
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/UpdateLastPasswordConfirmCommand.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@
 block discarded – undo
29 29
 
30 30
 class UpdateLastPasswordConfirmCommand extends ALoginCommand {
31 31
 
32
-	/** @var ISession */
33
-	private $session;
32
+    /** @var ISession */
33
+    private $session;
34 34
 
35
-	public function __construct(ISession $session) {
36
-		$this->session = $session;
37
-	}
35
+    public function __construct(ISession $session) {
36
+        $this->session = $session;
37
+    }
38 38
 
39
-	public function process(LoginData $loginData): LoginResult {
40
-		$this->session->set(
41
-			'last-password-confirm',
42
-			$loginData->getUser()->getLastLogin()
43
-		);
39
+    public function process(LoginData $loginData): LoginResult {
40
+        $this->session->set(
41
+            'last-password-confirm',
42
+            $loginData->getUser()->getLastLogin()
43
+        );
44 44
 
45
-		return $this->processNextOrFinishSuccessfully($loginData);
46
-	}
45
+        return $this->processNextOrFinishSuccessfully($loginData);
46
+    }
47 47
 
48 48
 }
Please login to merge, or discard this patch.
lib/private/Authentication/Login/PreLoginHookCommand.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,25 +30,25 @@
 block discarded – undo
30 30
 
31 31
 class PreLoginHookCommand extends ALoginCommand {
32 32
 
33
-	/** @var IUserManager */
34
-	private $userManager;
35
-
36
-	public function __construct(IUserManager $userManager) {
37
-		$this->userManager = $userManager;
38
-	}
39
-
40
-	public function process(LoginData $loginData): LoginResult {
41
-		if ($this->userManager instanceof PublicEmitter) {
42
-			$this->userManager->emit(
43
-				'\OC\User',
44
-				'preLogin',
45
-				[
46
-					$loginData->getUsername(),
47
-					$loginData->getPassword(),
48
-				]
49
-			);
50
-		}
51
-
52
-		return $this->processNextOrFinishSuccessfully($loginData);
53
-	}
33
+    /** @var IUserManager */
34
+    private $userManager;
35
+
36
+    public function __construct(IUserManager $userManager) {
37
+        $this->userManager = $userManager;
38
+    }
39
+
40
+    public function process(LoginData $loginData): LoginResult {
41
+        if ($this->userManager instanceof PublicEmitter) {
42
+            $this->userManager->emit(
43
+                '\OC\User',
44
+                'preLogin',
45
+                [
46
+                    $loginData->getUsername(),
47
+                    $loginData->getPassword(),
48
+                ]
49
+            );
50
+        }
51
+
52
+        return $this->processNextOrFinishSuccessfully($loginData);
53
+    }
54 54
 }
55 55
\ No newline at end of file
Please login to merge, or discard this patch.
lib/private/Authentication/Login/CreateSessionTokenCommand.php 2 patches
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,37 +31,37 @@
 block discarded – undo
31 31
 
32 32
 class CreateSessionTokenCommand extends ALoginCommand {
33 33
 
34
-	/** @var IConfig */
35
-	private $config;
34
+    /** @var IConfig */
35
+    private $config;
36 36
 
37
-	/** @var Session */
38
-	private $userSession;
37
+    /** @var Session */
38
+    private $userSession;
39 39
 
40
-	public function __construct(IConfig $config,
41
-								Session $userSession) {
42
-		$this->config = $config;
43
-		$this->userSession = $userSession;
44
-	}
40
+    public function __construct(IConfig $config,
41
+                                Session $userSession) {
42
+        $this->config = $config;
43
+        $this->userSession = $userSession;
44
+    }
45 45
 
46
-	public function process(LoginData $loginData): LoginResult {
47
-		$tokenType = IToken::REMEMBER;
48
-		if ((int)$this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15) === 0) {
49
-			$loginData->setRememberLogin(false);
50
-			$tokenType = IToken::DO_NOT_REMEMBER;
51
-		}
46
+    public function process(LoginData $loginData): LoginResult {
47
+        $tokenType = IToken::REMEMBER;
48
+        if ((int)$this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15) === 0) {
49
+            $loginData->setRememberLogin(false);
50
+            $tokenType = IToken::DO_NOT_REMEMBER;
51
+        }
52 52
 
53
-		$this->userSession->createSessionToken(
54
-			$loginData->getRequest(),
55
-			$loginData->getUser()->getUID(),
56
-			$loginData->getUsername(),
57
-			$loginData->getPassword(),
58
-			$tokenType
59
-		);
60
-		$this->userSession->updateTokens(
61
-			$loginData->getUser()->getUID(),
62
-			$loginData->getUsername()
63
-		);
53
+        $this->userSession->createSessionToken(
54
+            $loginData->getRequest(),
55
+            $loginData->getUser()->getUID(),
56
+            $loginData->getUsername(),
57
+            $loginData->getPassword(),
58
+            $tokenType
59
+        );
60
+        $this->userSession->updateTokens(
61
+            $loginData->getUser()->getUID(),
62
+            $loginData->getUsername()
63
+        );
64 64
 
65
-		return $this->processNextOrFinishSuccessfully($loginData);
66
-	}
65
+        return $this->processNextOrFinishSuccessfully($loginData);
66
+    }
67 67
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 
46 46
 	public function process(LoginData $loginData): LoginResult {
47 47
 		$tokenType = IToken::REMEMBER;
48
-		if ((int)$this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15) === 0) {
48
+		if ((int) $this->config->getSystemValue('remember_login_cookie_lifetime', 60 * 60 * 24 * 15) === 0) {
49 49
 			$loginData->setRememberLogin(false);
50 50
 			$tokenType = IToken::DO_NOT_REMEMBER;
51 51
 		}
Please login to merge, or discard this patch.