Skip to content

Commit 0f4b20c

Browse files
committed
adjust how it checks user values
1 parent ce7a4aa commit 0f4b20c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

core/components/twilio/src/Event/OnBeforeManagerPageInit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ public function run()
1010
{
1111
// System Wide
1212
$enforceTotp = $this->getOption('twilio.totp_enforce', false);
13-
// User Specific
14-
$userTotp = $this->getOption('twilio.totp', false);
1513
$action = $this->getOption('action');
1614
$user = $this->modx->user;
1715
if (!$user || $user->id === 0) {
1816
return false;
1917
}
18+
// User Specific
19+
$userTotp = $user->getOption('twilio.totp', $user->getSettings(), false);
2020
if ($enforceTotp && $userTotp && !$_SESSION['twilio_totp_verified'] && $action !== 'totp') {
2121
$this->modx->sendRedirect(MODX_MANAGER_URL . 'index.php?a=totp&namespace=twilio');
2222
}

core/components/twilio/src/Event/OnManagerPageInit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ public function run()
88
{
99
// System Wide
1010
$enforceTotp = $this->getOption('twilio.totp_enforce', false);
11-
// User Specific
12-
$userTotp = $this->getOption('twilio.totp', false);
1311
$action = $this->getOption('action');
1412
$user = $this->modx->user;
1513
if (!$user || $user->id === 0) {
1614
return false;
1715
}
16+
// User Specific
17+
$userTotp = $user->getOption('twilio.totp', $user->getSettings(), false);
1818
if (($enforceTotp || $userTotp) && $action === 'security/profile') {
1919
$this->modx->regClientStartupScript($this->twilio->getOption('jsUrl') . 'mgr/twilio.js');
2020
$profile = $user->getOne('Profile');

core/components/twilio/src/Event/OnWebPagePrerender.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ public function run()
88
{
99
// System Wide
1010
$enforceTotp = $this->getOption('twilio.totp_enforce', false);
11-
// User Specific
12-
$userTotp = $this->getOption('twilio.totp', false);
1311
$totpChallenge = (int) $this->getOption('twilio.totp_challenge_page', 0);
1412
$user = $this->modx->user;
1513
if (!$user || $user->id === 0 || $this->modx->resource->id === $totpChallenge) {
1614
return;
1715
}
16+
// User Specific
17+
$userTotp = $user->getOption('twilio.totp', $user->getSettings(), false);
1818
if ($enforceTotp && $userTotp && !$_SESSION['twilio_totp_verified'] && $totpChallenge > 0) {
1919
if ($this->modx->getOption('twilio.totp_email_on_login', null, false)) {
2020
$this->sendEmail($user);

0 commit comments

Comments
 (0)