aboutsummaryrefslogtreecommitdiffstats
path: root/core/Controller/LostController.php
diff options
context:
space:
mode:
Diffstat (limited to 'core/Controller/LostController.php')
-rw-r--r--core/Controller/LostController.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php
index 001ab737c7e..f940a3cfeee 100644
--- a/core/Controller/LostController.php
+++ b/core/Controller/LostController.php
@@ -14,6 +14,7 @@ use OC\Core\Events\PasswordResetEvent;
use OC\Core\Exception\ResetPasswordException;
use OC\Security\RateLimiting\Exception\RateLimitExceededException;
use OC\Security\RateLimiting\Limiter;
+use OC\User\Session;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\AnonRateLimit;
use OCP\AppFramework\Http\Attribute\BruteForceProtection;
@@ -36,8 +37,11 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Mail\IMailer;
+use OCP\PreConditionNotMetException;
use OCP\Security\VerificationToken\InvalidTokenException;
use OCP\Security\VerificationToken\IVerificationToken;
+use OCP\Server;
+use OCP\Util;
use Psr\Log\LoggerInterface;
use function array_filter;
use function count;
@@ -52,8 +56,6 @@ use function reset;
*/
#[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)]
class LostController extends Controller {
- protected string $from;
-
public function __construct(
string $appName,
IRequest $request,
@@ -62,7 +64,7 @@ class LostController extends Controller {
private Defaults $defaults,
private IL10N $l10n,
private IConfig $config,
- string $defaultMailAddress,
+ protected string $from,
private IManager $encryptionManager,
private IMailer $mailer,
private LoggerInterface $logger,
@@ -73,7 +75,6 @@ class LostController extends Controller {
private Limiter $limiter,
) {
parent::__construct($appName, $request);
- $this->from = $defaultMailAddress;
}
/**
@@ -158,7 +159,7 @@ class LostController extends Controller {
return new JSONResponse($this->error($this->l10n->t('Unsupported email length (>255)')));
}
- \OCP\Util::emitHook(
+ Util::emitHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
['uid' => &$user]
@@ -217,7 +218,7 @@ class LostController extends Controller {
$this->twoFactorManager->clearTwoFactorPending($userId);
$this->config->deleteUserValue($userId, 'core', 'lostpassword');
- @\OC::$server->getUserSession()->unsetMagicInCookie();
+ @Server::get(Session::class)->unsetMagicInCookie();
} catch (HintException $e) {
$response = new JSONResponse($this->error($e->getHint()));
$response->throttle();
@@ -233,7 +234,7 @@ class LostController extends Controller {
/**
* @throws ResetPasswordException
- * @throws \OCP\PreConditionNotMetException
+ * @throws PreConditionNotMetException
*/
protected function sendEmail(string $input): void {
$user = $this->findUserByIdOrMail($input);