FinishRememberedLoginCommand.php 818 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Authentication\Login;
  8. use OC\User\Session;
  9. use OCP\IConfig;
  10. class FinishRememberedLoginCommand extends ALoginCommand {
  11. /** @var Session */
  12. private $userSession;
  13. /** @var IConfig */
  14. private $config;
  15. public function __construct(Session $userSession, IConfig $config) {
  16. $this->userSession = $userSession;
  17. $this->config = $config;
  18. }
  19. public function process(LoginData $loginData): LoginResult {
  20. if ($loginData->isRememberLogin() && !$this->config->getSystemValueBool('auto_logout', false)) {
  21. $this->userSession->createRememberMeToken($loginData->getUser());
  22. }
  23. return $this->processNextOrFinishSuccessfully($loginData);
  24. }
  25. }