@@ -28,15 +28,15 @@ |
||
28 | 28 | $route = isset($_GET['download']) ? 'files_sharing.sharecontroller.downloadShare' : 'files_sharing.sharecontroller.showShare'; |
29 | 29 | |
30 | 30 | if ($token !== '') { |
31 | - $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | - if ($protocol == 'HTTP/1.0') { |
|
33 | - http_response_code(302); |
|
34 | - } else { |
|
35 | - http_response_code(307); |
|
36 | - } |
|
37 | - header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
31 | + $protocol = \OC::$server->getRequest()->getHttpProtocol(); |
|
32 | + if ($protocol == 'HTTP/1.0') { |
|
33 | + http_response_code(302); |
|
34 | + } else { |
|
35 | + http_response_code(307); |
|
36 | + } |
|
37 | + header('Location: ' . $urlGenerator->linkToRoute($route, ['token' => $token])); |
|
38 | 38 | } else { |
39 | - http_response_code(404); |
|
40 | - $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | - print_unescaped($tmpl->fetchPage()); |
|
39 | + http_response_code(404); |
|
40 | + $tmpl = new OCP\Template('', '404', 'guest'); |
|
41 | + print_unescaped($tmpl->fetchPage()); |
|
42 | 42 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); |
36 | 36 | $configuration = $connection->getConfiguration(); |
37 | 37 | if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') { |
38 | - // hide password |
|
39 | - $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
38 | + // hide password |
|
39 | + $configuration['ldap_agent_password'] = '**PASSWORD SET**'; |
|
40 | 40 | } |
41 | 41 | \OC_JSON::success(['configuration' => $configuration]); |
@@ -29,40 +29,40 @@ |
||
29 | 29 | * @deprecated 18.0.0 |
30 | 30 | */ |
31 | 31 | class TemplateManager { |
32 | - protected $templates = []; |
|
32 | + protected $templates = []; |
|
33 | 33 | |
34 | - public function registerTemplate($mimetype, $path) { |
|
35 | - $this->templates[$mimetype] = $path; |
|
36 | - } |
|
34 | + public function registerTemplate($mimetype, $path) { |
|
35 | + $this->templates[$mimetype] = $path; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * get the path of the template for a mimetype |
|
40 | - * |
|
41 | - * @deprecated 18.0.0 |
|
42 | - * @param string $mimetype |
|
43 | - * @return string|null |
|
44 | - */ |
|
45 | - public function getTemplatePath($mimetype) { |
|
46 | - if (isset($this->templates[$mimetype])) { |
|
47 | - return $this->templates[$mimetype]; |
|
48 | - } else { |
|
49 | - return null; |
|
50 | - } |
|
51 | - } |
|
38 | + /** |
|
39 | + * get the path of the template for a mimetype |
|
40 | + * |
|
41 | + * @deprecated 18.0.0 |
|
42 | + * @param string $mimetype |
|
43 | + * @return string|null |
|
44 | + */ |
|
45 | + public function getTemplatePath($mimetype) { |
|
46 | + if (isset($this->templates[$mimetype])) { |
|
47 | + return $this->templates[$mimetype]; |
|
48 | + } else { |
|
49 | + return null; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * get the template content for a mimetype |
|
55 | - * |
|
56 | - * @deprecated 18.0.0 |
|
57 | - * @param string $mimetype |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getTemplate($mimetype) { |
|
61 | - $path = $this->getTemplatePath($mimetype); |
|
62 | - if ($path) { |
|
63 | - return file_get_contents($path); |
|
64 | - } else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
53 | + /** |
|
54 | + * get the template content for a mimetype |
|
55 | + * |
|
56 | + * @deprecated 18.0.0 |
|
57 | + * @param string $mimetype |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function getTemplate($mimetype) { |
|
61 | + $path = $this->getTemplatePath($mimetype); |
|
62 | + if ($path) { |
|
63 | + return file_get_contents($path); |
|
64 | + } else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | use OC\DB\ConnectionFactory; |
27 | 27 | |
28 | 28 | class Sqlite extends AbstractDatabase { |
29 | - public $dbprettyname = 'Sqlite'; |
|
29 | + public $dbprettyname = 'Sqlite'; |
|
30 | 30 | |
31 | - public function validate($config) { |
|
32 | - return []; |
|
33 | - } |
|
31 | + public function validate($config) { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function initialize($config) { |
|
36 | - /* |
|
35 | + public function initialize($config) { |
|
36 | + /* |
|
37 | 37 | * Web: When using web based installer its not possible to set dbname |
38 | 38 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
39 | 39 | * is written to config.php. |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * in connection factory configuration is obtained from config.php. |
45 | 45 | */ |
46 | 46 | |
47 | - $this->dbName = empty($config['dbname']) |
|
48 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | - : $config['dbname']; |
|
47 | + $this->dbName = empty($config['dbname']) |
|
48 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | + : $config['dbname']; |
|
50 | 50 | |
51 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | - : $config['dbtableprefix']; |
|
51 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | + : $config['dbtableprefix']; |
|
54 | 54 | |
55 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | - $this->config->setValue('dbname', $this->dbName); |
|
57 | - } |
|
55 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | + $this->config->setValue('dbname', $this->dbName); |
|
57 | + } |
|
58 | 58 | |
59 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | - } |
|
62 | - } |
|
59 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - public function setupDatabase($username) { |
|
65 | - $datadir = $this->config->getValue( |
|
66 | - 'datadirectory', |
|
67 | - \OC::$SERVERROOT . '/data' |
|
68 | - ); |
|
64 | + public function setupDatabase($username) { |
|
65 | + $datadir = $this->config->getValue( |
|
66 | + 'datadirectory', |
|
67 | + \OC::$SERVERROOT . '/data' |
|
68 | + ); |
|
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | - if (file_exists($sqliteFile)) { |
|
72 | - unlink($sqliteFile); |
|
73 | - } |
|
74 | - } |
|
70 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | + if (file_exists($sqliteFile)) { |
|
72 | + unlink($sqliteFile); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -31,67 +31,67 @@ |
||
31 | 31 | use OCP\Files\FileInfo; |
32 | 32 | |
33 | 33 | abstract class AbstractTrash implements ITrash { |
34 | - /** @var ITrashItem */ |
|
35 | - protected $data; |
|
34 | + /** @var ITrashItem */ |
|
35 | + protected $data; |
|
36 | 36 | |
37 | - /** @var ITrashManager */ |
|
38 | - protected $trashManager; |
|
37 | + /** @var ITrashManager */ |
|
38 | + protected $trashManager; |
|
39 | 39 | |
40 | - public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
41 | - $this->trashManager = $trashManager; |
|
42 | - $this->data = $data; |
|
43 | - } |
|
40 | + public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
41 | + $this->trashManager = $trashManager; |
|
42 | + $this->data = $data; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getFilename(): string { |
|
46 | - return $this->data->getName(); |
|
47 | - } |
|
45 | + public function getFilename(): string { |
|
46 | + return $this->data->getName(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function getDeletionTime(): int { |
|
50 | - return $this->data->getDeletedTime(); |
|
51 | - } |
|
49 | + public function getDeletionTime(): int { |
|
50 | + return $this->data->getDeletedTime(); |
|
51 | + } |
|
52 | 52 | |
53 | - public function getFileId(): int { |
|
54 | - return $this->data->getId(); |
|
55 | - } |
|
53 | + public function getFileId(): int { |
|
54 | + return $this->data->getId(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function getFileInfo(): FileInfo { |
|
58 | - return $this->data; |
|
59 | - } |
|
57 | + public function getFileInfo(): FileInfo { |
|
58 | + return $this->data; |
|
59 | + } |
|
60 | 60 | |
61 | - public function getSize(): int { |
|
62 | - return $this->data->getSize(); |
|
63 | - } |
|
61 | + public function getSize(): int { |
|
62 | + return $this->data->getSize(); |
|
63 | + } |
|
64 | 64 | |
65 | - public function getLastModified(): int { |
|
66 | - return $this->data->getMtime(); |
|
67 | - } |
|
65 | + public function getLastModified(): int { |
|
66 | + return $this->data->getMtime(); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getContentType(): string { |
|
70 | - return $this->data->getMimetype(); |
|
71 | - } |
|
69 | + public function getContentType(): string { |
|
70 | + return $this->data->getMimetype(); |
|
71 | + } |
|
72 | 72 | |
73 | - public function getETag(): string { |
|
74 | - return $this->data->getEtag(); |
|
75 | - } |
|
73 | + public function getETag(): string { |
|
74 | + return $this->data->getEtag(); |
|
75 | + } |
|
76 | 76 | |
77 | - public function getName(): string { |
|
78 | - return $this->data->getName(); |
|
79 | - } |
|
77 | + public function getName(): string { |
|
78 | + return $this->data->getName(); |
|
79 | + } |
|
80 | 80 | |
81 | - public function getOriginalLocation(): string { |
|
82 | - return $this->data->getOriginalLocation(); |
|
83 | - } |
|
81 | + public function getOriginalLocation(): string { |
|
82 | + return $this->data->getOriginalLocation(); |
|
83 | + } |
|
84 | 84 | |
85 | - public function getTitle(): string { |
|
86 | - return $this->data->getTitle(); |
|
87 | - } |
|
85 | + public function getTitle(): string { |
|
86 | + return $this->data->getTitle(); |
|
87 | + } |
|
88 | 88 | |
89 | - public function delete() { |
|
90 | - $this->trashManager->removeItem($this->data); |
|
91 | - } |
|
89 | + public function delete() { |
|
90 | + $this->trashManager->removeItem($this->data); |
|
91 | + } |
|
92 | 92 | |
93 | - public function restore(): bool { |
|
94 | - $this->trashManager->restoreItem($this->data); |
|
95 | - return true; |
|
96 | - } |
|
93 | + public function restore(): bool { |
|
94 | + $this->trashManager->restoreItem($this->data); |
|
95 | + return true; |
|
96 | + } |
|
97 | 97 | } |
@@ -33,48 +33,48 @@ |
||
33 | 33 | |
34 | 34 | class WebAuthn implements ISettings { |
35 | 35 | |
36 | - /** @var PublicKeyCredentialMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var PublicKeyCredentialMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $uid; |
|
39 | + /** @var string */ |
|
40 | + private $uid; |
|
41 | 41 | |
42 | - /** @var IInitialStateService */ |
|
43 | - private $initialStateService; |
|
42 | + /** @var IInitialStateService */ |
|
43 | + private $initialStateService; |
|
44 | 44 | |
45 | - /** @var Manager */ |
|
46 | - private $manager; |
|
45 | + /** @var Manager */ |
|
46 | + private $manager; |
|
47 | 47 | |
48 | - public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | - string $UserId, |
|
50 | - IInitialStateService $initialStateService, |
|
51 | - Manager $manager) { |
|
52 | - $this->mapper = $mapper; |
|
53 | - $this->uid = $UserId; |
|
54 | - $this->initialStateService = $initialStateService; |
|
55 | - $this->manager = $manager; |
|
56 | - } |
|
48 | + public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | + string $UserId, |
|
50 | + IInitialStateService $initialStateService, |
|
51 | + Manager $manager) { |
|
52 | + $this->mapper = $mapper; |
|
53 | + $this->uid = $UserId; |
|
54 | + $this->initialStateService = $initialStateService; |
|
55 | + $this->manager = $manager; |
|
56 | + } |
|
57 | 57 | |
58 | - public function getForm() { |
|
59 | - $this->initialStateService->provideInitialState( |
|
60 | - Application::APP_ID, |
|
61 | - 'webauthn-devices', |
|
62 | - $this->mapper->findAllForUid($this->uid) |
|
63 | - ); |
|
58 | + public function getForm() { |
|
59 | + $this->initialStateService->provideInitialState( |
|
60 | + Application::APP_ID, |
|
61 | + 'webauthn-devices', |
|
62 | + $this->mapper->findAllForUid($this->uid) |
|
63 | + ); |
|
64 | 64 | |
65 | - return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | - ]); |
|
67 | - } |
|
65 | + return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | + ]); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getSection(): ?string { |
|
70 | - if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | - return null; |
|
72 | - } |
|
69 | + public function getSection(): ?string { |
|
70 | + if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | + return null; |
|
72 | + } |
|
73 | 73 | |
74 | - return 'security'; |
|
75 | - } |
|
74 | + return 'security'; |
|
75 | + } |
|
76 | 76 | |
77 | - public function getPriority(): int { |
|
78 | - return 20; |
|
79 | - } |
|
77 | + public function getPriority(): int { |
|
78 | + return 20; |
|
79 | + } |
|
80 | 80 | } |
@@ -25,72 +25,72 @@ |
||
25 | 25 | namespace OC\Authentication\Login; |
26 | 26 | |
27 | 27 | class WebAuthnChain { |
28 | - /** @var UserDisabledCheckCommand */ |
|
29 | - private $userDisabledCheckCommand; |
|
28 | + /** @var UserDisabledCheckCommand */ |
|
29 | + private $userDisabledCheckCommand; |
|
30 | 30 | |
31 | - /** @var LoggedInCheckCommand */ |
|
32 | - private $loggedInCheckCommand; |
|
31 | + /** @var LoggedInCheckCommand */ |
|
32 | + private $loggedInCheckCommand; |
|
33 | 33 | |
34 | - /** @var CompleteLoginCommand */ |
|
35 | - private $completeLoginCommand; |
|
34 | + /** @var CompleteLoginCommand */ |
|
35 | + private $completeLoginCommand; |
|
36 | 36 | |
37 | - /** @var CreateSessionTokenCommand */ |
|
38 | - private $createSessionTokenCommand; |
|
37 | + /** @var CreateSessionTokenCommand */ |
|
38 | + private $createSessionTokenCommand; |
|
39 | 39 | |
40 | - /** @var ClearLostPasswordTokensCommand */ |
|
41 | - private $clearLostPasswordTokensCommand; |
|
40 | + /** @var ClearLostPasswordTokensCommand */ |
|
41 | + private $clearLostPasswordTokensCommand; |
|
42 | 42 | |
43 | - /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | - private $updateLastPasswordConfirmCommand; |
|
43 | + /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | + private $updateLastPasswordConfirmCommand; |
|
45 | 45 | |
46 | - /** @var SetUserTimezoneCommand */ |
|
47 | - private $setUserTimezoneCommand; |
|
46 | + /** @var SetUserTimezoneCommand */ |
|
47 | + private $setUserTimezoneCommand; |
|
48 | 48 | |
49 | - /** @var TwoFactorCommand */ |
|
50 | - private $twoFactorCommand; |
|
49 | + /** @var TwoFactorCommand */ |
|
50 | + private $twoFactorCommand; |
|
51 | 51 | |
52 | - /** @var FinishRememberedLoginCommand */ |
|
53 | - private $finishRememberedLoginCommand; |
|
52 | + /** @var FinishRememberedLoginCommand */ |
|
53 | + private $finishRememberedLoginCommand; |
|
54 | 54 | |
55 | - /** @var WebAuthnLoginCommand */ |
|
56 | - private $webAuthnLoginCommand; |
|
55 | + /** @var WebAuthnLoginCommand */ |
|
56 | + private $webAuthnLoginCommand; |
|
57 | 57 | |
58 | - public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | - WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | - LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | - CompleteLoginCommand $completeLoginCommand, |
|
62 | - CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | - ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | - UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | - SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | - TwoFactorCommand $twoFactorCommand, |
|
67 | - FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | - ) { |
|
69 | - $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | - $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | - $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | - $this->completeLoginCommand = $completeLoginCommand; |
|
73 | - $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | - $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | - $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | - $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | - $this->twoFactorCommand = $twoFactorCommand; |
|
78 | - $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | - } |
|
58 | + public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | + WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | + LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | + CompleteLoginCommand $completeLoginCommand, |
|
62 | + CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | + ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | + UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | + SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | + TwoFactorCommand $twoFactorCommand, |
|
67 | + FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | + ) { |
|
69 | + $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | + $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | + $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | + $this->completeLoginCommand = $completeLoginCommand; |
|
73 | + $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | + $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | + $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | + $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | + $this->twoFactorCommand = $twoFactorCommand; |
|
78 | + $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | + } |
|
80 | 80 | |
81 | - public function process(LoginData $loginData): LoginResult { |
|
82 | - $chain = $this->userDisabledCheckCommand; |
|
83 | - $chain |
|
84 | - ->setNext($this->webAuthnLoginCommand) |
|
85 | - ->setNext($this->loggedInCheckCommand) |
|
86 | - ->setNext($this->completeLoginCommand) |
|
87 | - ->setNext($this->createSessionTokenCommand) |
|
88 | - ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | - ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | - ->setNext($this->setUserTimezoneCommand) |
|
91 | - ->setNext($this->twoFactorCommand) |
|
92 | - ->setNext($this->finishRememberedLoginCommand); |
|
81 | + public function process(LoginData $loginData): LoginResult { |
|
82 | + $chain = $this->userDisabledCheckCommand; |
|
83 | + $chain |
|
84 | + ->setNext($this->webAuthnLoginCommand) |
|
85 | + ->setNext($this->loggedInCheckCommand) |
|
86 | + ->setNext($this->completeLoginCommand) |
|
87 | + ->setNext($this->createSessionTokenCommand) |
|
88 | + ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | + ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | + ->setNext($this->setUserTimezoneCommand) |
|
91 | + ->setNext($this->twoFactorCommand) |
|
92 | + ->setNext($this->finishRememberedLoginCommand); |
|
93 | 93 | |
94 | - return $chain->process($loginData); |
|
95 | - } |
|
94 | + return $chain->process($loginData); |
|
95 | + } |
|
96 | 96 | } |
@@ -28,21 +28,21 @@ |
||
28 | 28 | |
29 | 29 | class WebAuthnLoginCommand extends ALoginCommand { |
30 | 30 | |
31 | - /** @var IUserManager */ |
|
32 | - private $userManager; |
|
33 | - |
|
34 | - public function __construct(IUserManager $userManager) { |
|
35 | - $this->userManager = $userManager; |
|
36 | - } |
|
37 | - |
|
38 | - public function process(LoginData $loginData): LoginResult { |
|
39 | - $user = $this->userManager->get($loginData->getUsername()); |
|
40 | - $loginData->setUser($user); |
|
41 | - if ($user === null) { |
|
42 | - $loginData->setUser(false); |
|
43 | - } |
|
44 | - |
|
45 | - return $this->processNextOrFinishSuccessfully($loginData); |
|
46 | - } |
|
31 | + /** @var IUserManager */ |
|
32 | + private $userManager; |
|
33 | + |
|
34 | + public function __construct(IUserManager $userManager) { |
|
35 | + $this->userManager = $userManager; |
|
36 | + } |
|
37 | + |
|
38 | + public function process(LoginData $loginData): LoginResult { |
|
39 | + $user = $this->userManager->get($loginData->getUsername()); |
|
40 | + $loginData->setUser($user); |
|
41 | + if ($user === null) { |
|
42 | + $loginData->setUser(false); |
|
43 | + } |
|
44 | + |
|
45 | + return $this->processNextOrFinishSuccessfully($loginData); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -30,92 +30,92 @@ |
||
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 | } |