@@ -28,23 +28,23 @@ |
||
28 | 28 | |
29 | 29 | class CompleteLoginCommand extends ALoginCommand { |
30 | 30 | |
31 | - /** @var Session */ |
|
32 | - private $userSession; |
|
33 | - |
|
34 | - public function __construct(Session $userSession) { |
|
35 | - $this->userSession = $userSession; |
|
36 | - } |
|
37 | - |
|
38 | - public function process(LoginData $loginData): LoginResult { |
|
39 | - $this->userSession->completeLogin( |
|
40 | - $loginData->getUser(), |
|
41 | - [ |
|
42 | - 'loginName' => $loginData->getUsername(), |
|
43 | - 'password' => $loginData->getPassword(), |
|
44 | - ] |
|
45 | - ); |
|
46 | - |
|
47 | - return $this->processNextOrFinishSuccessfully($loginData); |
|
48 | - } |
|
31 | + /** @var Session */ |
|
32 | + private $userSession; |
|
33 | + |
|
34 | + public function __construct(Session $userSession) { |
|
35 | + $this->userSession = $userSession; |
|
36 | + } |
|
37 | + |
|
38 | + public function process(LoginData $loginData): LoginResult { |
|
39 | + $this->userSession->completeLogin( |
|
40 | + $loginData->getUser(), |
|
41 | + [ |
|
42 | + 'loginName' => $loginData->getUsername(), |
|
43 | + 'password' => $loginData->getPassword(), |
|
44 | + ] |
|
45 | + ); |
|
46 | + |
|
47 | + return $this->processNextOrFinishSuccessfully($loginData); |
|
48 | + } |
|
49 | 49 | |
50 | 50 | } |
@@ -27,85 +27,85 @@ |
||
27 | 27 | |
28 | 28 | class Chain { |
29 | 29 | |
30 | - /** @var PreLoginHookCommand */ |
|
31 | - private $preLoginHookCommand; |
|
32 | - |
|
33 | - /** @var UserDisabledCheckCommand */ |
|
34 | - private $userDisabledCheckCommand; |
|
35 | - |
|
36 | - /** @var UidLoginCommand */ |
|
37 | - private $uidLoginCommand; |
|
38 | - |
|
39 | - /** @var EmailLoginCommand */ |
|
40 | - private $emailLoginCommand; |
|
41 | - |
|
42 | - /** @var LoggedInCheckCommand */ |
|
43 | - private $loggedInCheckCommand; |
|
44 | - |
|
45 | - /** @var CompleteLoginCommand */ |
|
46 | - private $completeLoginCommand; |
|
47 | - |
|
48 | - /** @var CreateSessionTokenCommand */ |
|
49 | - private $createSessionTokenCommand; |
|
50 | - |
|
51 | - /** @var ClearLostPasswordTokensCommand */ |
|
52 | - private $clearLostPasswordTokensCommand; |
|
53 | - |
|
54 | - /** @var UpdateLastPasswordConfirmCommand */ |
|
55 | - private $updateLastPasswordConfirmCommand; |
|
56 | - |
|
57 | - /** @var SetUserTimezoneCommand */ |
|
58 | - private $setUserTimezoneCommand; |
|
59 | - |
|
60 | - /** @var TwoFactorCommand */ |
|
61 | - private $twoFactorCommand; |
|
62 | - |
|
63 | - /** @var FinishRememberedLoginCommand */ |
|
64 | - private $finishRememberedLoginCommand; |
|
65 | - |
|
66 | - public function __construct(PreLoginHookCommand $preLoginHookCommand, |
|
67 | - UserDisabledCheckCommand $userDisabledCheckCommand, |
|
68 | - UidLoginCommand $uidLoginCommand, |
|
69 | - EmailLoginCommand $emailLoginCommand, |
|
70 | - LoggedInCheckCommand $loggedInCheckCommand, |
|
71 | - CompleteLoginCommand $completeLoginCommand, |
|
72 | - CreateSessionTokenCommand $createSessionTokenCommand, |
|
73 | - ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
74 | - UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
75 | - SetUserTimezoneCommand $setUserTimezoneCommand, |
|
76 | - TwoFactorCommand $twoFactorCommand, |
|
77 | - FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
78 | - ) { |
|
79 | - $this->preLoginHookCommand = $preLoginHookCommand; |
|
80 | - $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
81 | - $this->uidLoginCommand = $uidLoginCommand; |
|
82 | - $this->emailLoginCommand = $emailLoginCommand; |
|
83 | - $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
84 | - $this->completeLoginCommand = $completeLoginCommand; |
|
85 | - $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
86 | - $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
87 | - $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
88 | - $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
89 | - $this->twoFactorCommand = $twoFactorCommand; |
|
90 | - $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
91 | - } |
|
92 | - |
|
93 | - public function process(LoginData $loginData): LoginResult { |
|
94 | - $chain = $this->preLoginHookCommand; |
|
95 | - $chain |
|
96 | - ->setNext($this->userDisabledCheckCommand) |
|
97 | - ->setNext($this->uidLoginCommand) |
|
98 | - ->setNext($this->emailLoginCommand) |
|
99 | - ->setNext($this->loggedInCheckCommand) |
|
100 | - ->setNext($this->completeLoginCommand) |
|
101 | - ->setNext($this->createSessionTokenCommand) |
|
102 | - ->setNext($this->clearLostPasswordTokensCommand) |
|
103 | - ->setNext($this->updateLastPasswordConfirmCommand) |
|
104 | - ->setNext($this->setUserTimezoneCommand) |
|
105 | - ->setNext($this->twoFactorCommand) |
|
106 | - ->setNext($this->finishRememberedLoginCommand); |
|
107 | - |
|
108 | - return $chain->process($loginData); |
|
109 | - } |
|
30 | + /** @var PreLoginHookCommand */ |
|
31 | + private $preLoginHookCommand; |
|
32 | + |
|
33 | + /** @var UserDisabledCheckCommand */ |
|
34 | + private $userDisabledCheckCommand; |
|
35 | + |
|
36 | + /** @var UidLoginCommand */ |
|
37 | + private $uidLoginCommand; |
|
38 | + |
|
39 | + /** @var EmailLoginCommand */ |
|
40 | + private $emailLoginCommand; |
|
41 | + |
|
42 | + /** @var LoggedInCheckCommand */ |
|
43 | + private $loggedInCheckCommand; |
|
44 | + |
|
45 | + /** @var CompleteLoginCommand */ |
|
46 | + private $completeLoginCommand; |
|
47 | + |
|
48 | + /** @var CreateSessionTokenCommand */ |
|
49 | + private $createSessionTokenCommand; |
|
50 | + |
|
51 | + /** @var ClearLostPasswordTokensCommand */ |
|
52 | + private $clearLostPasswordTokensCommand; |
|
53 | + |
|
54 | + /** @var UpdateLastPasswordConfirmCommand */ |
|
55 | + private $updateLastPasswordConfirmCommand; |
|
56 | + |
|
57 | + /** @var SetUserTimezoneCommand */ |
|
58 | + private $setUserTimezoneCommand; |
|
59 | + |
|
60 | + /** @var TwoFactorCommand */ |
|
61 | + private $twoFactorCommand; |
|
62 | + |
|
63 | + /** @var FinishRememberedLoginCommand */ |
|
64 | + private $finishRememberedLoginCommand; |
|
65 | + |
|
66 | + public function __construct(PreLoginHookCommand $preLoginHookCommand, |
|
67 | + UserDisabledCheckCommand $userDisabledCheckCommand, |
|
68 | + UidLoginCommand $uidLoginCommand, |
|
69 | + EmailLoginCommand $emailLoginCommand, |
|
70 | + LoggedInCheckCommand $loggedInCheckCommand, |
|
71 | + CompleteLoginCommand $completeLoginCommand, |
|
72 | + CreateSessionTokenCommand $createSessionTokenCommand, |
|
73 | + ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
74 | + UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
75 | + SetUserTimezoneCommand $setUserTimezoneCommand, |
|
76 | + TwoFactorCommand $twoFactorCommand, |
|
77 | + FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
78 | + ) { |
|
79 | + $this->preLoginHookCommand = $preLoginHookCommand; |
|
80 | + $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
81 | + $this->uidLoginCommand = $uidLoginCommand; |
|
82 | + $this->emailLoginCommand = $emailLoginCommand; |
|
83 | + $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
84 | + $this->completeLoginCommand = $completeLoginCommand; |
|
85 | + $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
86 | + $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
87 | + $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
88 | + $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
89 | + $this->twoFactorCommand = $twoFactorCommand; |
|
90 | + $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
91 | + } |
|
92 | + |
|
93 | + public function process(LoginData $loginData): LoginResult { |
|
94 | + $chain = $this->preLoginHookCommand; |
|
95 | + $chain |
|
96 | + ->setNext($this->userDisabledCheckCommand) |
|
97 | + ->setNext($this->uidLoginCommand) |
|
98 | + ->setNext($this->emailLoginCommand) |
|
99 | + ->setNext($this->loggedInCheckCommand) |
|
100 | + ->setNext($this->completeLoginCommand) |
|
101 | + ->setNext($this->createSessionTokenCommand) |
|
102 | + ->setNext($this->clearLostPasswordTokensCommand) |
|
103 | + ->setNext($this->updateLastPasswordConfirmCommand) |
|
104 | + ->setNext($this->setUserTimezoneCommand) |
|
105 | + ->setNext($this->twoFactorCommand) |
|
106 | + ->setNext($this->finishRememberedLoginCommand); |
|
107 | + |
|
108 | + return $chain->process($loginData); |
|
109 | + } |
|
110 | 110 | |
111 | 111 | } |
@@ -30,14 +30,14 @@ |
||
30 | 30 | */ |
31 | 31 | interface IMessageReporter extends IReporter { |
32 | 32 | |
33 | - /** |
|
34 | - * Report a (error) message |
|
35 | - * |
|
36 | - * @param string $message |
|
37 | - * @param array $context |
|
38 | - * |
|
39 | - * @since 17.0.0 |
|
40 | - */ |
|
41 | - public function reportMessage(string $message, array $context = []): void; |
|
33 | + /** |
|
34 | + * Report a (error) message |
|
35 | + * |
|
36 | + * @param string $message |
|
37 | + * @param array $context |
|
38 | + * |
|
39 | + * @since 17.0.0 |
|
40 | + */ |
|
41 | + public function reportMessage(string $message, array $context = []): void; |
|
42 | 42 | |
43 | 43 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | */ |
29 | 29 | interface ISupportedApps extends ISubscription { |
30 | 30 | |
31 | - /** |
|
32 | - * Fetches the list of app IDs that are supported by the subscription |
|
33 | - * |
|
34 | - * @since 17.0.0 |
|
35 | - */ |
|
36 | - public function getSupportedApps(): array; |
|
31 | + /** |
|
32 | + * Fetches the list of app IDs that are supported by the subscription |
|
33 | + * |
|
34 | + * @since 17.0.0 |
|
35 | + */ |
|
36 | + public function getSupportedApps(): array; |
|
37 | 37 | } |
@@ -31,13 +31,13 @@ |
||
31 | 31 | */ |
32 | 32 | interface IActivatableAtLogin extends IProvider { |
33 | 33 | |
34 | - /** |
|
35 | - * @param IUser $user |
|
36 | - * |
|
37 | - * @return ILoginSetupProvider |
|
38 | - * |
|
39 | - * @since 17.0.0 |
|
40 | - */ |
|
41 | - public function getLoginSetup(IUser $user): ILoginSetupProvider; |
|
34 | + /** |
|
35 | + * @param IUser $user |
|
36 | + * |
|
37 | + * @return ILoginSetupProvider |
|
38 | + * |
|
39 | + * @since 17.0.0 |
|
40 | + */ |
|
41 | + public function getLoginSetup(IUser $user): ILoginSetupProvider; |
|
42 | 42 | |
43 | 43 | } |
@@ -31,11 +31,11 @@ |
||
31 | 31 | */ |
32 | 32 | interface ILoginSetupProvider { |
33 | 33 | |
34 | - /** |
|
35 | - * @return Template |
|
36 | - * |
|
37 | - * @since 17.0.0 |
|
38 | - */ |
|
39 | - public function getBody(): Template; |
|
34 | + /** |
|
35 | + * @return Template |
|
36 | + * |
|
37 | + * @since 17.0.0 |
|
38 | + */ |
|
39 | + public function getBody(): Template; |
|
40 | 40 | |
41 | 41 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | use OC\Authentication\Token\IToken; |
27 | 27 | |
28 | 28 | class WipeTokenException extends InvalidTokenException { |
29 | - /** @var IToken */ |
|
30 | - private $token; |
|
29 | + /** @var IToken */ |
|
30 | + private $token; |
|
31 | 31 | |
32 | - public function __construct(IToken $token) { |
|
33 | - parent::__construct(); |
|
32 | + public function __construct(IToken $token) { |
|
33 | + parent::__construct(); |
|
34 | 34 | |
35 | - $this->token = $token; |
|
36 | - } |
|
35 | + $this->token = $token; |
|
36 | + } |
|
37 | 37 | |
38 | - public function getToken(): IToken { |
|
39 | - return $this->token; |
|
40 | - } |
|
38 | + public function getToken(): IToken { |
|
39 | + return $this->token; |
|
40 | + } |
|
41 | 41 | } |
@@ -35,64 +35,64 @@ |
||
35 | 35 | |
36 | 36 | class WipeController extends Controller { |
37 | 37 | |
38 | - /** @var RemoteWipe */ |
|
39 | - private $remoteWipe; |
|
38 | + /** @var RemoteWipe */ |
|
39 | + private $remoteWipe; |
|
40 | 40 | |
41 | - public function __construct(string $appName, |
|
42 | - IRequest $request, |
|
43 | - RemoteWipe $remoteWipe) { |
|
44 | - parent::__construct($appName, $request); |
|
41 | + public function __construct(string $appName, |
|
42 | + IRequest $request, |
|
43 | + RemoteWipe $remoteWipe) { |
|
44 | + parent::__construct($appName, $request); |
|
45 | 45 | |
46 | - $this->remoteWipe = $remoteWipe; |
|
47 | - } |
|
46 | + $this->remoteWipe = $remoteWipe; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * @NoAdminRequired |
|
51 | - * @NoCSRFRequired |
|
52 | - * @PublicPage |
|
53 | - * |
|
54 | - * @AnonRateThrottle(limit=10, period=300) |
|
55 | - * |
|
56 | - * @param string $token |
|
57 | - * |
|
58 | - * @return JSONResponse |
|
59 | - */ |
|
60 | - public function checkWipe(string $token): JSONResponse { |
|
61 | - try { |
|
62 | - if ($this->remoteWipe->start($token)) { |
|
63 | - return new JSONResponse([ |
|
64 | - 'wipe' => true |
|
65 | - ]); |
|
66 | - } |
|
49 | + /** |
|
50 | + * @NoAdminRequired |
|
51 | + * @NoCSRFRequired |
|
52 | + * @PublicPage |
|
53 | + * |
|
54 | + * @AnonRateThrottle(limit=10, period=300) |
|
55 | + * |
|
56 | + * @param string $token |
|
57 | + * |
|
58 | + * @return JSONResponse |
|
59 | + */ |
|
60 | + public function checkWipe(string $token): JSONResponse { |
|
61 | + try { |
|
62 | + if ($this->remoteWipe->start($token)) { |
|
63 | + return new JSONResponse([ |
|
64 | + 'wipe' => true |
|
65 | + ]); |
|
66 | + } |
|
67 | 67 | |
68 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
69 | - } catch (InvalidTokenException $e) { |
|
70 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
71 | - } |
|
72 | - } |
|
68 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
69 | + } catch (InvalidTokenException $e) { |
|
70 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | 74 | |
75 | - /** |
|
76 | - * @NoAdminRequired |
|
77 | - * @NoCSRFRequired |
|
78 | - * @PublicPage |
|
79 | - * |
|
80 | - * @AnonRateThrottle(limit=10, period=300) |
|
81 | - * |
|
82 | - * @param string $token |
|
83 | - * |
|
84 | - * @return JSONResponse |
|
85 | - */ |
|
86 | - public function wipeDone(string $token): JSONResponse { |
|
87 | - try { |
|
88 | - if ($this->remoteWipe->finish($token)) { |
|
89 | - return new JSONResponse([]); |
|
90 | - } |
|
75 | + /** |
|
76 | + * @NoAdminRequired |
|
77 | + * @NoCSRFRequired |
|
78 | + * @PublicPage |
|
79 | + * |
|
80 | + * @AnonRateThrottle(limit=10, period=300) |
|
81 | + * |
|
82 | + * @param string $token |
|
83 | + * |
|
84 | + * @return JSONResponse |
|
85 | + */ |
|
86 | + public function wipeDone(string $token): JSONResponse { |
|
87 | + try { |
|
88 | + if ($this->remoteWipe->finish($token)) { |
|
89 | + return new JSONResponse([]); |
|
90 | + } |
|
91 | 91 | |
92 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
93 | - } catch (InvalidTokenException $e) { |
|
94 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
95 | - } |
|
96 | - } |
|
92 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
93 | + } catch (InvalidTokenException $e) { |
|
94 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
95 | + } |
|
96 | + } |
|
97 | 97 | |
98 | 98 | } |
@@ -28,43 +28,43 @@ |
||
28 | 28 | |
29 | 29 | class LazyL10N implements IL10N { |
30 | 30 | |
31 | - /** @var IL10N */ |
|
32 | - private $l; |
|
31 | + /** @var IL10N */ |
|
32 | + private $l; |
|
33 | 33 | |
34 | - /** @var \Closure */ |
|
35 | - private $factory; |
|
34 | + /** @var \Closure */ |
|
35 | + private $factory; |
|
36 | 36 | |
37 | 37 | |
38 | - public function __construct(\Closure $factory) { |
|
39 | - $this->factory = $factory; |
|
40 | - } |
|
38 | + public function __construct(\Closure $factory) { |
|
39 | + $this->factory = $factory; |
|
40 | + } |
|
41 | 41 | |
42 | - private function getL(): IL10N { |
|
43 | - if ($this->l === null) { |
|
44 | - $this->l = ($this->factory)(); |
|
45 | - } |
|
42 | + private function getL(): IL10N { |
|
43 | + if ($this->l === null) { |
|
44 | + $this->l = ($this->factory)(); |
|
45 | + } |
|
46 | 46 | |
47 | - return $this->l; |
|
48 | - } |
|
47 | + return $this->l; |
|
48 | + } |
|
49 | 49 | |
50 | - public function t(string $text, $parameters = []): string { |
|
51 | - return $this->getL()->t($text, $parameters); |
|
52 | - } |
|
50 | + public function t(string $text, $parameters = []): string { |
|
51 | + return $this->getL()->t($text, $parameters); |
|
52 | + } |
|
53 | 53 | |
54 | - public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { |
|
55 | - return $this->getL()->n($text_singular, $text_plural, $count, $parameters); |
|
56 | - } |
|
54 | + public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { |
|
55 | + return $this->getL()->n($text_singular, $text_plural, $count, $parameters); |
|
56 | + } |
|
57 | 57 | |
58 | - public function l(string $type, $data, array $options = []) { |
|
59 | - return $this->getL()->l($type, $data, $options); |
|
60 | - } |
|
58 | + public function l(string $type, $data, array $options = []) { |
|
59 | + return $this->getL()->l($type, $data, $options); |
|
60 | + } |
|
61 | 61 | |
62 | - public function getLanguageCode(): string { |
|
63 | - return $this->getL()->getLanguageCode(); |
|
64 | - } |
|
62 | + public function getLanguageCode(): string { |
|
63 | + return $this->getL()->getLanguageCode(); |
|
64 | + } |
|
65 | 65 | |
66 | - public function getLocaleCode(): string { |
|
67 | - return $this->getL()->getLocaleCode(); |
|
68 | - } |
|
66 | + public function getLocaleCode(): string { |
|
67 | + return $this->getL()->getLocaleCode(); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | } |