aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-03-15 15:05:33 +0100
committerGitHub <noreply@github.com>2024-03-15 15:05:33 +0100
commit27defd7e51a29370e513679ff0bd30b3cc49834c (patch)
tree9fc06b1463de7619f4ec68a5eeae534f96439cc3 /lib
parent7ea50446593771e79ab2af60891acc00ba97c293 (diff)
parent0047789580ae4d2398979dde9d883283984d37e4 (diff)
downloadnextcloud-server-27defd7e51a29370e513679ff0bd30b3cc49834c.tar.gz
nextcloud-server-27defd7e51a29370e513679ff0bd30b3cc49834c.zip
Merge pull request #40127 from summersab/refactor/OC-Server-getTwoFactorAuthManager
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/Session.php3
-rw-r--r--lib/private/legacy/OC_JSON.php5
-rw-r--r--lib/private/legacy/OC_Util.php3
3 files changed, 8 insertions, 3 deletions
diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php
index ab6ec9f38d3..f2c0010b6be 100644
--- a/lib/private/User/Session.php
+++ b/lib/private/User/Session.php
@@ -43,6 +43,7 @@ use OC\Authentication\Exceptions\PasswordlessTokenException;
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\Token\IProvider;
use OC\Authentication\Token\IToken;
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Hooks\Emitter;
use OC\Hooks\PublicEmitter;
use OC_User;
@@ -524,7 +525,7 @@ class Session implements IUserSession, Emitter {
$user = $users[0];
}
// DI not possible due to cyclic dependencies :'-/
- return OC::$server->getTwoFactorAuthManager()->isTwoFactorAuthenticated($user);
+ return OC::$server->get(TwoFactorAuthManager::class)->isTwoFactorAuthenticated($user);
}
/**
diff --git a/lib/private/legacy/OC_JSON.php b/lib/private/legacy/OC_JSON.php
index b6791fe4b85..5188a92fe1d 100644
--- a/lib/private/legacy/OC_JSON.php
+++ b/lib/private/legacy/OC_JSON.php
@@ -27,6 +27,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
+
class OC_JSON {
/**
* Check if the app is enabled, send json error msg if not
@@ -48,7 +51,7 @@ class OC_JSON {
* @suppress PhanDeprecatedFunction
*/
public static function checkLoggedIn() {
- $twoFactorAuthManger = \OC::$server->getTwoFactorAuthManager();
+ $twoFactorAuthManger = \OC::$server->get(TwoFactorAuthManager::class);
if (!\OC::$server->getUserSession()->isLoggedIn()
|| $twoFactorAuthManger->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
$l = \OC::$server->getL10N('lib');
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 42a0d9450b5..09d0719ff2b 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -65,6 +65,7 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
+use OC\Authentication\TwoFactorAuth\Manager as TwoFactorAuthManager;
use OC\Files\SetupManager;
use OCP\Files\Template\ITemplateManager;
use OCP\IConfig;
@@ -785,7 +786,7 @@ class OC_Util {
exit();
}
// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
- if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
+ if (\OC::$server->get(TwoFactorAuthManager::class)->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
exit();
}