From 0f4b20cbb518ae384b4d409bc49ede39c78f50cc Mon Sep 17 00:00:00 2001 From: matdave Date: Wed, 28 Dec 2022 15:12:23 -0600 Subject: [PATCH] adjust how it checks user values --- core/components/twilio/src/Event/OnBeforeManagerPageInit.php | 4 ++-- core/components/twilio/src/Event/OnManagerPageInit.php | 4 ++-- core/components/twilio/src/Event/OnWebPagePrerender.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/components/twilio/src/Event/OnBeforeManagerPageInit.php b/core/components/twilio/src/Event/OnBeforeManagerPageInit.php index bfc2207..57eeff9 100644 --- a/core/components/twilio/src/Event/OnBeforeManagerPageInit.php +++ b/core/components/twilio/src/Event/OnBeforeManagerPageInit.php @@ -10,13 +10,13 @@ public function run() { // System Wide $enforceTotp = $this->getOption('twilio.totp_enforce', false); - // User Specific - $userTotp = $this->getOption('twilio.totp', false); $action = $this->getOption('action'); $user = $this->modx->user; if (!$user || $user->id === 0) { return false; } + // User Specific + $userTotp = $user->getOption('twilio.totp', $user->getSettings(), false); if ($enforceTotp && $userTotp && !$_SESSION['twilio_totp_verified'] && $action !== 'totp') { $this->modx->sendRedirect(MODX_MANAGER_URL . 'index.php?a=totp&namespace=twilio'); } diff --git a/core/components/twilio/src/Event/OnManagerPageInit.php b/core/components/twilio/src/Event/OnManagerPageInit.php index 4ef7d90..6e42695 100644 --- a/core/components/twilio/src/Event/OnManagerPageInit.php +++ b/core/components/twilio/src/Event/OnManagerPageInit.php @@ -8,13 +8,13 @@ public function run() { // System Wide $enforceTotp = $this->getOption('twilio.totp_enforce', false); - // User Specific - $userTotp = $this->getOption('twilio.totp', false); $action = $this->getOption('action'); $user = $this->modx->user; if (!$user || $user->id === 0) { return false; } + // User Specific + $userTotp = $user->getOption('twilio.totp', $user->getSettings(), false); if (($enforceTotp || $userTotp) && $action === 'security/profile') { $this->modx->regClientStartupScript($this->twilio->getOption('jsUrl') . 'mgr/twilio.js'); $profile = $user->getOne('Profile'); diff --git a/core/components/twilio/src/Event/OnWebPagePrerender.php b/core/components/twilio/src/Event/OnWebPagePrerender.php index 47e5efe..0071e50 100644 --- a/core/components/twilio/src/Event/OnWebPagePrerender.php +++ b/core/components/twilio/src/Event/OnWebPagePrerender.php @@ -8,13 +8,13 @@ public function run() { // System Wide $enforceTotp = $this->getOption('twilio.totp_enforce', false); - // User Specific - $userTotp = $this->getOption('twilio.totp', false); $totpChallenge = (int) $this->getOption('twilio.totp_challenge_page', 0); $user = $this->modx->user; if (!$user || $user->id === 0 || $this->modx->resource->id === $totpChallenge) { return; } + // User Specific + $userTotp = $user->getOption('twilio.totp', $user->getSettings(), false); if ($enforceTotp && $userTotp && !$_SESSION['twilio_totp_verified'] && $totpChallenge > 0) { if ($this->modx->getOption('twilio.totp_email_on_login', null, false)) { $this->sendEmail($user);