Skip to content

Commit

Permalink
Merge pull request #40120 from summersab/refactor/OC-Server-getCsrfTo…
Browse files Browse the repository at this point in the history
…kenManager
  • Loading branch information
skjnldsv authored May 31, 2024
2 parents 0687853 + 5c3619c commit 0fec532
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Hooks\Emitter;
use OC\Hooks\PublicEmitter;
use OC\Security\CSRF\CsrfTokenManager;
use OC_User;
use OC_Util;
use OCA\DAV\Connector\Sabre\Auth;
Expand Down Expand Up @@ -531,7 +532,7 @@ protected function prepareUserLogin($firstTimeLogin, $refreshCsrfToken = true) {
if ($refreshCsrfToken) {
// TODO: mock/inject/use non-static
// Refresh the token
\OC::$server->getCsrfTokenManager()->refreshToken();
\OC::$server->get(CsrfTokenManager::class)->refreshToken();
}

if ($firstTimeLogin) {
Expand Down
3 changes: 2 additions & 1 deletion lib/public/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use bantu\IniGetWrapper\IniGetWrapper;
use OC\AppScriptDependency;
use OC\AppScriptSort;
use OC\Security\CSRF\CsrfTokenManager;
use OCP\L10N\IFactory;
use OCP\Mail\IMailer;
use OCP\Share\IManager;
Expand Down Expand Up @@ -394,7 +395,7 @@ public static function emitHook($signalclass, $signalname, $params = []) {
*/
public static function callRegister() {
if (self::$token === '') {
self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue();
self::$token = \OC::$server->get(CsrfTokenManager::class)->getToken()->getEncryptedValue();
}
return self::$token;
}
Expand Down

0 comments on commit 0fec532

Please sign in to comment.