File tree Expand file tree Collapse file tree 4 files changed +13
-4
lines changed
core/components/twilio/src/Event Expand file tree Collapse file tree 4 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 33 "lowCaseName" : " twilio" ,
44 "description" : " Twilio for MODX Revolution 3.x" ,
55 "author" : " John Peca" ,
6- "version" : " 2.0.0 " ,
6+ "version" : " 2.0.1 " ,
77 "menus" : [
88 {
99 "text" : " twilio.users" ,
Original file line number Diff line number Diff line change @@ -8,13 +8,16 @@ class OnBeforeManagerPageInit extends Event
88{
99 public function run ()
1010 {
11+ // System Wide
1112 $ enforceTotp = $ this ->getOption ('twilio.totp_enforce ' , false );
13+ // User Specific
14+ $ userTotp = $ this ->getOption ('twilio.totp ' , false );
1215 $ action = $ this ->getOption ('action ' );
1316 $ user = $ this ->modx ->user ;
1417 if (!$ user || $ user ->id === 0 ) {
1518 return false ;
1619 }
17- if ($ enforceTotp && !$ _SESSION ['twilio_totp_verified ' ] && $ action !== 'totp ' ) {
20+ if ($ enforceTotp && $ userTotp && !$ _SESSION ['twilio_totp_verified ' ] && $ action !== 'totp ' ) {
1821 $ this ->modx ->sendRedirect (MODX_MANAGER_URL . 'index.php?a=totp&namespace=twilio ' );
1922 }
2023 }
Original file line number Diff line number Diff line change @@ -6,13 +6,16 @@ class OnManagerPageInit extends Event
66{
77 public function run ()
88 {
9+ // System Wide
910 $ enforceTotp = $ this ->getOption ('twilio.totp_enforce ' , false );
11+ // User Specific
12+ $ userTotp = $ this ->getOption ('twilio.totp ' , false );
1013 $ action = $ this ->getOption ('action ' );
1114 $ user = $ this ->modx ->user ;
1215 if (!$ user || $ user ->id === 0 ) {
1316 return false ;
1417 }
15- if ($ enforceTotp && $ action === 'security/profile ' ) {
18+ if (( $ enforceTotp || $ userTotp ) && $ action === 'security/profile ' ) {
1619 $ this ->modx ->regClientStartupScript ($ this ->twilio ->getOption ('jsUrl ' ) . 'mgr/twilio.js ' );
1720 $ profile = $ user ->getOne ('Profile ' );
1821 $ extended = $ profile ->get ('extended ' );
Original file line number Diff line number Diff line change @@ -6,13 +6,16 @@ class OnWebPagePrerender extends Event
66{
77 public function run ()
88 {
9+ // System Wide
910 $ enforceTotp = $ this ->getOption ('twilio.totp_enforce ' , false );
11+ // User Specific
12+ $ userTotp = $ this ->getOption ('twilio.totp ' , false );
1013 $ totpChallenge = (int ) $ this ->getOption ('twilio.totp_challenge_page ' , 0 );
1114 $ user = $ this ->modx ->user ;
1215 if (!$ user || $ user ->id === 0 || $ this ->modx ->resource ->id === $ totpChallenge ) {
1316 return ;
1417 }
15- if ($ enforceTotp && !$ _SESSION ['twilio_totp_verified ' ] && $ totpChallenge > 0 ) {
18+ if ($ enforceTotp && $ userTotp && !$ _SESSION ['twilio_totp_verified ' ] && $ totpChallenge > 0 ) {
1619 if ($ this ->modx ->getOption ('twilio.totp_email_on_login ' , null , false )) {
1720 $ this ->sendEmail ($ user );
1821 }
You can’t perform that action at this time.
0 commit comments