UidLoginCommand.php 799 B

1234567891011121314151617181920212223242526272829303132333435363738
  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\Manager;
  9. use OCP\IUser;
  10. class UidLoginCommand extends ALoginCommand {
  11. /** @var Manager */
  12. private $userManager;
  13. public function __construct(Manager $userManager) {
  14. $this->userManager = $userManager;
  15. }
  16. /**
  17. * @param LoginData $loginData
  18. *
  19. * @return LoginResult
  20. */
  21. public function process(LoginData $loginData): LoginResult {
  22. /* @var $loginResult IUser */
  23. $user = $this->userManager->checkPasswordNoLogging(
  24. $loginData->getUsername(),
  25. $loginData->getPassword()
  26. );
  27. $loginData->setUser($user);
  28. return $this->processNextOrFinishSuccessfully($loginData);
  29. }
  30. }