2019-05-03 09:09:19 -04:00
|
|
|
<?php
|
2021-06-04 15:52:51 -04:00
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2019-05-03 09:09:19 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-05-03 09:09:19 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Authentication\Login;
|
|
|
|
|
|
|
|
|
|
use OC\Hooks\PublicEmitter;
|
|
|
|
|
use OCP\IUserManager;
|
|
|
|
|
|
|
|
|
|
class PreLoginHookCommand extends ALoginCommand {
|
2025-11-17 09:32:54 -05:00
|
|
|
public function __construct(
|
|
|
|
|
private IUserManager $userManager,
|
|
|
|
|
) {
|
2019-05-03 09:09:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function process(LoginData $loginData): LoginResult {
|
|
|
|
|
if ($this->userManager instanceof PublicEmitter) {
|
|
|
|
|
$this->userManager->emit(
|
|
|
|
|
'\OC\User',
|
|
|
|
|
'preLogin',
|
|
|
|
|
[
|
|
|
|
|
$loginData->getUsername(),
|
|
|
|
|
$loginData->getPassword(),
|
|
|
|
|
]
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->processNextOrFinishSuccessfully($loginData);
|
|
|
|
|
}
|
2019-11-22 14:52:10 -05:00
|
|
|
}
|