aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/legacy
diff options
context:
space:
mode:
authorAndrew Summers <18727110+summersab@users.noreply.github.com>2023-08-29 17:18:12 -0500
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-03-15 13:12:51 +0100
commit0047789580ae4d2398979dde9d883283984d37e4 (patch)
tree1f4b2e5c77104afdc5a303995138576a8d577f12 /lib/private/legacy
parentdf1cd1ba7e6e1f6e66a2b3229b5c082f1b81162e (diff)
downloadnextcloud-server-0047789580ae4d2398979dde9d883283984d37e4.tar.gz
nextcloud-server-0047789580ae4d2398979dde9d883283984d37e4.zip
Refactor `OC\Server::getTwoFactorAuthManager`
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r--lib/private/legacy/OC_JSON.php5
-rw-r--r--lib/private/legacy/OC_Util.php3
2 files changed, 6 insertions, 2 deletions
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();
}