Google Authenticator – WordPress Two Factor Authentication (2FA) - Version 5.0.8

Version Description

  • Google Authenticator (2FA) : Changes for 2FA Free plugin for 1 user forever.
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Google Authenticator – WordPress Two Factor Authentication (2FA)
Version 5.0.8
Comparing to
See all releases

Code changes from version 5.0.7 to 5.0.8

class-customer-setup.php CHANGED
@@ -198,7 +198,7 @@ class Customer_Setup {
198
  $currentTimeInMillis = self::get_timestamp();
199
 
200
  /* Creating the Hash using SHA-512 algorithm */
201
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
202
  $hashValue = hash( "sha512", $stringToHash );
203
 
204
  $customerKeyHeader = "Customer-Key: " . $customerKey;
@@ -306,7 +306,7 @@ class Customer_Setup {
306
  $currentTimeInMillis = self::get_timestamp();
307
 
308
 
309
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
310
  $hashValue = hash( "sha512", $stringToHash );
311
 
312
  $customerKeyHeader = "Customer-Key: " . $customerKey;
@@ -380,7 +380,7 @@ class Customer_Setup {
380
  $currentTimeInMillis = self::get_timestamp();
381
 
382
  /* Creating the Hash using SHA-512 algorithm */
383
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
384
  $hashValue = hash( "sha512", $stringToHash );
385
 
386
  $customerKeyHeader = "Customer-Key: " . $customerKey;
@@ -459,7 +459,24 @@ class Customer_Setup {
459
  $ch = curl_init( $url );
460
  global $user;
461
  $user = wp_get_current_user();
462
- $query = '[WordPress 2 Factor Authentication Plugin]: ' . $query;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
463
  $fields = array(
464
  'firstName' => $user->user_firstname,
465
  'lastName' => $user->user_lastname,
198
  $currentTimeInMillis = self::get_timestamp();
199
 
200
  /* Creating the Hash using SHA-512 algorithm */
201
+ $stringToHash = $customerKey . number_format( $currentTimeInMillis, 0, '', '' ) . $apiKey;
202
  $hashValue = hash( "sha512", $stringToHash );
203
 
204
  $customerKeyHeader = "Customer-Key: " . $customerKey;
306
  $currentTimeInMillis = self::get_timestamp();
307
 
308
 
309
+ $stringToHash = $customerKey . number_format( $currentTimeInMillis, 0, '', '' ) . $apiKey;
310
  $hashValue = hash( "sha512", $stringToHash );
311
 
312
  $customerKeyHeader = "Customer-Key: " . $customerKey;
380
  $currentTimeInMillis = self::get_timestamp();
381
 
382
  /* Creating the Hash using SHA-512 algorithm */
383
+ $stringToHash = $customerKey . number_format( $currentTimeInMillis, 0, '', '' ) . $apiKey;
384
  $hashValue = hash( "sha512", $stringToHash );
385
 
386
  $customerKeyHeader = "Customer-Key: " . $customerKey;
459
  $ch = curl_init( $url );
460
  global $user;
461
  $user = wp_get_current_user();
462
+ $is_nc_with_unlimited_users = get_option( 'mo2f_is_NC' ) && !get_option( 'mo2f_is_NNC' );
463
+ $is_nc_with_1_user = get_option( 'mo2f_is_NC' ) && get_option( 'mo2f_is_NNC' );
464
+ $is_ec_with_1_user = !get_option( 'mo2f_is_NC' ) ;
465
+
466
+
467
+ $customer_feature="";
468
+
469
+ if($is_ec_with_1_user){
470
+ $customer_feature="Existing Customer with 1 user";
471
+ }
472
+ else if($is_nc_with_unlimited_users){
473
+ $customer_feature="New customer with Unlimited users";
474
+ }
475
+ else if($is_nc_with_1_user){
476
+ $customer_feature="New customer with only one user";
477
+ }
478
+
479
+ $query = '[WordPress 2 Factor Authentication Plugin: '.$customer_feature.' using V 5.0.8]: ' . $query;
480
  $fields = array(
481
  'firstName' => $user->user_firstname,
482
  'lastName' => $user->user_lastname,
class-rba-attributes.php CHANGED
@@ -58,7 +58,7 @@ class Miniorange_Rba_Attributes {
58
  $currentTimeInMillis = self::get_timestamp();
59
 
60
  /* Creating the Hash using SHA-512 algorithm */
61
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
62
  $hashValue = hash( "sha512", $stringToHash );
63
 
64
  $customerKeyHeader = "Customer-Key: " . $customerKey;
58
  $currentTimeInMillis = self::get_timestamp();
59
 
60
  /* Creating the Hash using SHA-512 algorithm */
61
+ $stringToHash = $customerKey . number_format( $currentTimeInMillis, 0, '', '' ) . $apiKey;
62
  $hashValue = hash( "sha512", $stringToHash );
63
 
64
  $customerKeyHeader = "Customer-Key: " . $customerKey;
class-two-factor-setup.php CHANGED
@@ -61,7 +61,7 @@ class Two_Factor_Setup {
61
  $currentTimeInMillis = self::get_timestamp();
62
 
63
  /* Creating the Hash using SHA-512 algorithm */
64
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;;
65
  $hashValue = hash( "sha512", $stringToHash );
66
 
67
  $customerKeyHeader = "Customer-Key: " . $customerKey;
61
  $currentTimeInMillis = self::get_timestamp();
62
 
63
  /* Creating the Hash using SHA-512 algorithm */
64
+ $stringToHash = $customerKey . number_format( $currentTimeInMillis, 0, '', '' ) . $apiKey;;
65
  $hashValue = hash( "sha512", $stringToHash );
66
 
67
  $customerKeyHeader = "Customer-Key: " . $customerKey;
database/database_functions.php CHANGED
@@ -83,13 +83,22 @@ class Mo2fDB {
83
  return;
84
  }
85
 
 
 
 
 
 
 
 
 
 
86
  function check_if_user_column_exists($user_id){
87
  global $wpdb;
88
  $value = $wpdb->query(
89
  "SELECT * FROM " . $this->userDetailsTable . "
90
  WHERE user_id = " . $user_id
91
  );
92
-
93
  return $value;
94
 
95
  }
83
  return;
84
  }
85
 
86
+ function check_if_table_exists( ) {
87
+ global $wpdb;
88
+ $does_table_exist= $wpdb->query(
89
+ "SHOW TABLES LIKE '" . $this->userDetailsTable . "';"
90
+ );
91
+
92
+ return $does_table_exist;
93
+ }
94
+
95
  function check_if_user_column_exists($user_id){
96
  global $wpdb;
97
  $value = $wpdb->query(
98
  "SELECT * FROM " . $this->userDetailsTable . "
99
  WHERE user_id = " . $user_id
100
  );
101
+
102
  return $value;
103
 
104
  }
miniorange_2_factor_configuration.php CHANGED
@@ -359,7 +359,7 @@ function mo2f_rba_description() {
359
  class="mo2f_pointer"><?php echo __( 'Description', 'miniorange-2-factor-authentication' ); ?> </h3>
360
  <p id="rba_description" style="margin:2% 2% 2% 4%">
361
  <?php echo __( 'This Add-On helps you in remembering the device, in which case you will not be prompted for the 2-factor authentication
362
- if you login from the remembered device again. You can also decide the nu,ber of devices that can be remembered. Users can also be restricted access to the site based on the IP address they are logging in from.', 'miniorange-2-factor-authentication' ); ?>
363
  </p>
364
  <br>
365
  <div id="mo2f_hide_rba_content">
359
  class="mo2f_pointer"><?php echo __( 'Description', 'miniorange-2-factor-authentication' ); ?> </h3>
360
  <p id="rba_description" style="margin:2% 2% 2% 4%">
361
  <?php echo __( 'This Add-On helps you in remembering the device, in which case you will not be prompted for the 2-factor authentication
362
+ if you login from the remembered device again. You can also decide the number of devices that can be remembered. Users can also be restricted access to the site based on the IP address they are logging in from.', 'miniorange-2-factor-authentication' ); ?>
363
  </p>
364
  <br>
365
  <div id="mo2f_hide_rba_content">
miniorange_2_factor_mobile_configuration.php CHANGED
@@ -321,7 +321,7 @@ function mo2f_show_instruction_to_allusers( $user, $mo2f_second_factor ) {
321
 
322
  </table>
323
  <br>
324
- <?php if ( get_option( 'mo2f_is_NC' ) && current_user_can( 'manage_options' ) && get_option( 'mo2f_miniorange_admin' ) == $user->ID ) { ?>
325
  <button type="button" class="button button-primary button-large" style="float:right;" data-toggle="modal"
326
  data-target="#deactivateAccount"><?php echo mo2f_lt( 'Deactivate plugin' ); ?></button>
327
 
@@ -530,7 +530,7 @@ function mo2f_select_2_factor_method( $user, $mo2f_second_factor ) {
530
  ?>
531
  <div class="mo2f_setup_2_factor_tab">
532
  <?php echo mo2f_check_if_registered_with_miniorange( $user ) . '<br>'; ?>
533
- <?php if ( $is_NC ) {
534
  if ( $can_display_admin_features ) { ?>
535
  <div style="float:right;">
536
  <form name="f" method="post" action="" id="mo2f_enable_2FA_for_users_form">
@@ -564,8 +564,13 @@ function mo2f_select_2_factor_method( $user, $mo2f_second_factor ) {
564
  </div>
565
  <?php }
566
  } ?>
567
-
568
-
 
 
 
 
 
569
  <div style="text-align: center;">
570
 
571
  <p style="font-size:20px;color:darkorange;padding:10px;"><?php echo mo2f_lt( 'Selected Method - ' ); ?><?php echo $selectedMethod; ?></p>
@@ -685,6 +690,11 @@ function mo2f_select_2_factor_method( $user, $mo2f_second_factor ) {
685
  <input type="hidden" name="option" value="mo_2factor_test_authentication_method"/>
686
  <input type="hidden" name="mo2f_configured_2FA_method_test" id="mo2f_configured_2FA_method_test"/>
687
  </form>
 
 
 
 
 
688
  </div>
689
  </div>
690
  <script>
@@ -702,6 +712,12 @@ function mo2f_select_2_factor_method( $user, $mo2f_second_factor ) {
702
  jQuery('#mo2f_2factor_test_authentication_method_form').submit();
703
  }
704
 
 
 
 
 
 
 
705
  jQuery("#mo2f_standard_plan_auth_methods").hide();
706
 
707
  function show_standard_plan_auth_methods() {
@@ -793,12 +809,12 @@ function mo2f_create_2fa_form( $user, $category, $auth_methods ) {
793
 
794
  $form .= '<td>
795
  <div class="mo2f_thumbnail" style="height:' . $thumbnail_height . 'px;border-color:' . $border_color . ';">
796
- <div class="container"><div class="row">
797
- <div class="col-2">
798
- <img src="' . plugins_url( "includes/images/authmethods/" . $auth_method_abr . ".png", __FILE__ ) . '" class="mo2f_auth_methods_thumbnail" />
799
 
800
  </div>
801
- <div class="col" style="padding:20px !important;font-size:14px; !important"><b>' . $auth_method .
802
  '</b><br>
803
  <p style="padding:5px; padding-left:0px;"> ' . $two_factor_methods_descriptions[ $auth_method ] . '</p>
804
  </div>
@@ -888,7 +904,7 @@ function show_2_factor_pricing_page( $user ) {
888
  );
889
 
890
  $two_factor_methods_EC = array_slice( $two_factor_methods, 0, 7 );
891
-
892
  $mo2f_feature_set_with_plans_NC = array(
893
  "Authentication Methods" => array(
894
  array_slice( $two_factor_methods, 0, 5 ),
@@ -896,7 +912,7 @@ function show_2_factor_pricing_page( $user ) {
896
  array_slice( $two_factor_methods, 0, 11 )
897
  ),
898
  "No. of Users" => array(
899
- "Unlimited",
900
  "User Based Pricing",
901
  "User Based Pricing"
902
  ),
@@ -1018,7 +1034,6 @@ function show_2_factor_pricing_page( $user ) {
1018
  <?php echo mo2f_yearly_standard_pricing(); ?>
1019
 
1020
  <?php echo mo2f_sms_cost(); ?>
1021
- <?php echo mo2f_email_cost(); ?>
1022
 
1023
  <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><button
1024
  class="button button-primary button-large"
@@ -1033,7 +1048,6 @@ function show_2_factor_pricing_page( $user ) {
1033
  2FA for Large Scale Web businesses with enterprise-grade support</p><span>
1034
  <?php echo mo2f_yearly_premium_pricing(); ?>
1035
  <?php echo mo2f_sms_cost(); ?>
1036
- <?php echo mo2f_email_cost(); ?>
1037
  <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><button
1038
  class="button button-primary button-large"
1039
  onclick="mo2f_upgradeform('wp_2fa_premium_plan')" <?php echo $is_customer_registered ? "" : " disabled " ?>>Upgrade</button></h4>
@@ -1147,8 +1161,8 @@ function show_2_factor_pricing_page( $user ) {
1147
 
1148
  <hr><br>
1149
  <?php } ?>
1150
- <b>**** SMS and Email Charges</b>
1151
- <p><?php echo mo2f_lt( 'If you wish to choose Email Verification / OTP Over SMS / OTP Over SMS and Email / OTP Over Email as your authentication method,
1152
  SMS transaction prices & SMS delivery charges apply and they depend on country. SMS validity is for lifetime.' ); ?></p>
1153
  <hr>
1154
  <br>
@@ -1255,23 +1269,6 @@ function mo2f_sms_cost() {
1255
  <?php
1256
  }
1257
 
1258
- function mo2f_email_cost() {
1259
- ?>
1260
- <p class="mo2f_pricing_text" id="mo2f_email_cost"
1261
- title="<?php echo mo2f_lt( '(Only applicable if OTP over Email/Email Verification is your preferred authentication method.)' ); ?>*"><?php echo mo2f_lt( 'Email Cost' ); ?>
1262
- ****<br/>
1263
- <select id="mo2f_email" class="form-control" style="border-radius:5px;width:200px;">
1264
- <option><?php echo mo2f_lt( '$5 per 100 Email' ); ?></option>
1265
- <option><?php echo mo2f_lt( '$15 per 100 Email' ); ?></option>
1266
- <option><?php echo mo2f_lt( '$22 per 1k Email' ); ?></option>
1267
- <option><?php echo mo2f_lt( '$30 per 5k Email' ); ?></option>
1268
- <option><?php echo mo2f_lt( '$40 per 10k Email' ); ?></option>
1269
- <option><?php echo mo2f_lt( '$90 per 50k Email' ); ?></option>
1270
- </select>
1271
- </p>
1272
- <?php
1273
- }
1274
-
1275
  function mo2f_yearly_standard_pricing() {
1276
  ?>
1277
 
@@ -1279,7 +1276,8 @@ function mo2f_yearly_standard_pricing() {
1279
  id="mo2f_yearly_sub"><?php echo __( 'Yearly Subscription Fees', 'miniorange-2-factor-authentication' ); ?>
1280
 
1281
  <select id="mo2f_yearly" class="form-control" style="border-radius:5px;width:200px;">
1282
- <option> <?php echo mo2f_lt( '1 - 50 users - $30 per year' ); ?> </option>
 
1283
  <option> <?php echo mo2f_lt( '50 - 100 users - $49 per year' ); ?> </option>
1284
  <option> <?php echo mo2f_lt( '100 - 500 users - $99 per year' ); ?> </option>
1285
  <option> <?php echo mo2f_lt( '500 - 1000 users - $199 per year' ); ?> </option>
@@ -1298,7 +1296,8 @@ function mo2f_yearly_premium_pricing() {
1298
  id="mo2f_yearly_sub"><?php echo __( 'Yearly Subscription Fees', 'miniorange-2-factor-authentication' ); ?>
1299
 
1300
  <select id="mo2f_yearly" class="form-control" style="border-radius:5px;width:200px;">
1301
- <option> <?php echo mo2f_lt( '1 - 50 users - $99 per year' ); ?> </option>
 
1302
  <option> <?php echo mo2f_lt( '50 - 100 users - $199 per year' ); ?> </option>
1303
  <option> <?php echo mo2f_lt( '100 - 500 users - $349 per year' ); ?> </option>
1304
  <option> <?php echo mo2f_lt( '500 - 1000 users - $499 per year' ); ?> </option>
321
 
322
  </table>
323
  <br>
324
+ <?php if ( get_option( 'mo2f_is_NC' ) && !get_option( 'mo2f_is_NNC' ) && current_user_can( 'manage_options' ) && get_option( 'mo2f_miniorange_admin' ) == $user->ID ) { ?>
325
  <button type="button" class="button button-primary button-large" style="float:right;" data-toggle="modal"
326
  data-target="#deactivateAccount"><?php echo mo2f_lt( 'Deactivate plugin' ); ?></button>
327
 
530
  ?>
531
  <div class="mo2f_setup_2_factor_tab">
532
  <?php echo mo2f_check_if_registered_with_miniorange( $user ) . '<br>'; ?>
533
+ <?php if ( $is_NC && !get_option( 'mo2f_is_NNC' )) {
534
  if ( $can_display_admin_features ) { ?>
535
  <div style="float:right;">
536
  <form name="f" method="post" action="" id="mo2f_enable_2FA_for_users_form">
564
  </div>
565
  <?php }
566
  } ?>
567
+ <br><br>
568
+ <?php if ( $is_NC ) { ?>
569
+ <button style="float:right;" class="button button-primary button-large"
570
+ onclick="resumeFlowDrivenSetup();"
571
+ <?php echo $is_customer_registered ? "" : " disabled "; ?>>Resume Flow Driven Setup
572
+ </button>
573
+ <?php } ?>
574
  <div style="text-align: center;">
575
 
576
  <p style="font-size:20px;color:darkorange;padding:10px;"><?php echo mo2f_lt( 'Selected Method - ' ); ?><?php echo $selectedMethod; ?></p>
690
  <input type="hidden" name="option" value="mo_2factor_test_authentication_method"/>
691
  <input type="hidden" name="mo2f_configured_2FA_method_test" id="mo2f_configured_2FA_method_test"/>
692
  </form>
693
+
694
+ <form name="f" method="post" action="" id="mo2f_2factor_resume_flow_driven_setup_form">
695
+ <input type="hidden" name="option" value="mo_2factor_resume_flow_driven_setup"/>
696
+ </form>
697
+
698
  </div>
699
  </div>
700
  <script>
712
  jQuery('#mo2f_2factor_test_authentication_method_form').submit();
713
  }
714
 
715
+ function resumeFlowDrivenSetup() {
716
+ jQuery('#mo2f_2factor_resume_flow_driven_setup_form').submit();
717
+ }
718
+
719
+
720
+
721
  jQuery("#mo2f_standard_plan_auth_methods").hide();
722
 
723
  function show_standard_plan_auth_methods() {
809
 
810
  $form .= '<td>
811
  <div class="mo2f_thumbnail" style="height:' . $thumbnail_height . 'px;border-color:' . $border_color . ';">
812
+ <div><div>
813
+ <div style="width: 80px; float:left;">
814
+ <img src="' . plugins_url( "includes/images/authmethods/" . $auth_method_abr . ".png", __FILE__ ) . '" style="width: 50px;height: 50px !important; padding: 20px; line-height: 80px;" />
815
 
816
  </div>
817
+ <div style="width:190px; padding:20px;font-size:14px;overflow: hidden;"><b>' . $auth_method .
818
  '</b><br>
819
  <p style="padding:5px; padding-left:0px;"> ' . $two_factor_methods_descriptions[ $auth_method ] . '</p>
820
  </div>
904
  );
905
 
906
  $two_factor_methods_EC = array_slice( $two_factor_methods, 0, 7 );
907
+ $user_plan = get_option( 'mo2f_is_NC' ) && !get_option( 'mo2f_is_NNC' ) ? "Unlimited" : "1";
908
  $mo2f_feature_set_with_plans_NC = array(
909
  "Authentication Methods" => array(
910
  array_slice( $two_factor_methods, 0, 5 ),
912
  array_slice( $two_factor_methods, 0, 11 )
913
  ),
914
  "No. of Users" => array(
915
+ $user_plan,
916
  "User Based Pricing",
917
  "User Based Pricing"
918
  ),
1034
  <?php echo mo2f_yearly_standard_pricing(); ?>
1035
 
1036
  <?php echo mo2f_sms_cost(); ?>
 
1037
 
1038
  <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><button
1039
  class="button button-primary button-large"
1048
  2FA for Large Scale Web businesses with enterprise-grade support</p><span>
1049
  <?php echo mo2f_yearly_premium_pricing(); ?>
1050
  <?php echo mo2f_sms_cost(); ?>
 
1051
  <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><button
1052
  class="button button-primary button-large"
1053
  onclick="mo2f_upgradeform('wp_2fa_premium_plan')" <?php echo $is_customer_registered ? "" : " disabled " ?>>Upgrade</button></h4>
1161
 
1162
  <hr><br>
1163
  <?php } ?>
1164
+ <b>**** SMS Charges</b>
1165
+ <p><?php echo mo2f_lt( 'If you wish to choose OTP Over SMS / OTP Over SMS and Email as your authentication method,
1166
  SMS transaction prices & SMS delivery charges apply and they depend on country. SMS validity is for lifetime.' ); ?></p>
1167
  <hr>
1168
  <br>
1269
  <?php
1270
  }
1271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1272
  function mo2f_yearly_standard_pricing() {
1273
  ?>
1274
 
1276
  id="mo2f_yearly_sub"><?php echo __( 'Yearly Subscription Fees', 'miniorange-2-factor-authentication' ); ?>
1277
 
1278
  <select id="mo2f_yearly" class="form-control" style="border-radius:5px;width:200px;">
1279
+ <option> <?php echo mo2f_lt( '1 - 5 users - $20 per year' ); ?> </option>
1280
+ <option> <?php echo mo2f_lt( '5 - 50 users - $30 per year' ); ?> </option>
1281
  <option> <?php echo mo2f_lt( '50 - 100 users - $49 per year' ); ?> </option>
1282
  <option> <?php echo mo2f_lt( '100 - 500 users - $99 per year' ); ?> </option>
1283
  <option> <?php echo mo2f_lt( '500 - 1000 users - $199 per year' ); ?> </option>
1296
  id="mo2f_yearly_sub"><?php echo __( 'Yearly Subscription Fees', 'miniorange-2-factor-authentication' ); ?>
1297
 
1298
  <select id="mo2f_yearly" class="form-control" style="border-radius:5px;width:200px;">
1299
+ <option> <?php echo mo2f_lt( '1 - 5 users - $30 per year' ); ?> </option>
1300
+ <option> <?php echo mo2f_lt( '5 - 50 users - $99 per year' ); ?> </option>
1301
  <option> <?php echo mo2f_lt( '50 - 100 users - $199 per year' ); ?> </option>
1302
  <option> <?php echo mo2f_lt( '100 - 500 users - $349 per year' ); ?> </option>
1303
  <option> <?php echo mo2f_lt( '500 - 1000 users - $499 per year' ); ?> </option>
miniorange_2_factor_settings.php CHANGED
@@ -2,8 +2,8 @@
2
  /**
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
- * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for Unlimited Users in the free version of the plugin.
6
- * Version: 5.0.7
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
@@ -167,6 +167,10 @@ class Miniorange_Authentication {
167
 
168
  function mo2f_update_db_check() {
169
 
 
 
 
 
170
 
171
  if ( ! get_option( 'mo2f_existing_user_values_updated' ) ) {
172
 
@@ -175,76 +179,80 @@ class Miniorange_Authentication {
175
  }
176
 
177
  global $Mo2fdbQueries;
178
- $user_id = get_site_option( 'mo2f_miniorange_admin' );
179
- if ( $user_id && ! get_option( 'mo2f_is_NC' ) ) {
180
- $Mo2fdbQueries->generate_tables();
181
- $Mo2fdbQueries->insert_user( $user_id, array( 'user_id' => $user_id ) );
182
 
183
- add_option( 'mo2f_phone', get_option( 'user_phone' ) );
184
- add_option( 'mo2f_enable_login_with_2nd_factor', get_option( 'mo2f_show_loginwith_phone' ) );
185
- add_option( 'mo2f_remember_device', get_option( 'mo2f_deviceid_enabled' ) );
186
- add_option( 'mo2f_transactionId', get_option( 'mo2f-login-transactionId' ) );
187
- add_option( 'mo2f_is_NC', 0 );
188
- $phone = get_user_meta( $user_id, 'mo2f_user_phone', true );
189
- $user_phone = $phone ? $phone : get_user_meta( $user_id, 'mo2f_phone', true );
190
-
191
- $Mo2fdbQueries->update_user_details( $user_id,
192
- array(
193
- 'mo2f_GoogleAuthenticator_config_status' => get_user_meta( $user_id, 'mo2f_google_authentication_status', true ),
194
- 'mo2f_SecurityQuestions_config_status' => get_user_meta( $user_id, 'mo2f_kba_registration_status', true ),
195
- 'mo2f_EmailVerification_config_status' => true,
196
- 'mo2f_AuthyAuthenticator_config_status' => get_user_meta( $user_id, 'mo2f_authy_authentication_status', true ),
197
- 'mo2f_user_email' => get_user_meta( $user_id, 'mo_2factor_map_id_with_email', true ),
198
- 'mo2f_user_phone' => $user_phone,
199
- 'user_registration_with_miniorange' => get_user_meta( $user_id, 'mo_2factor_user_registration_with_miniorange', true ),
200
- 'mobile_registration_status' => get_user_meta( $user_id, 'mo2f_mobile_registration_status', true ),
201
- 'mo2f_configured_2FA_method' => get_user_meta( $user_id, 'mo2f_selected_2factor_method', true ),
202
- 'mo_2factor_user_registration_status' => get_user_meta( $user_id, 'mo_2factor_user_registration_status', true )
203
- ) );
204
-
205
- if ( get_user_meta( $user_id, 'mo2f_mobile_registration_status', true ) ) {
206
- $Mo2fdbQueries->update_user_details( $user_id,
207
- array(
208
- 'mo2f_miniOrangeSoftToken_config_status' => true,
209
- 'mo2f_miniOrangeQRCodeAuthentication_config_status' => true,
210
- 'mo2f_miniOrangePushNotification_config_status' => true
211
- ) );
212
- }
213
 
214
- if ( get_user_meta( $user_id, 'mo2f_otp_registration_status', true ) ) {
215
  $Mo2fdbQueries->update_user_details( $user_id,
216
  array(
217
- 'mo2f_OTPOverSMS_config_status' => true
 
 
 
 
 
 
 
 
 
218
  ) );
219
- }
220
 
221
- $mo2f_external_app_type = get_user_meta( $user_id, 'mo2f_external_app_type', true ) == 'AUTHY 2-FACTOR AUTHENTICATION' ?
222
- 'Authy Authenticator' : 'Google Authenticator';
 
 
 
 
 
 
223
 
224
- update_user_meta( $user_id, 'mo2f_external_app_type', $mo2f_external_app_type );
225
- update_user_meta( $user_id, 'skipped_flow_driven_setup', false );
226
- update_user_meta( $user_id, 'current_modal', 0 );
 
 
 
227
 
228
- delete_option( 'mo2f_show_loginwith_phone' );
229
- delete_option( 'mo2f_deviceid_enabled' );
230
- delete_option( 'mo2f-login-transactionId' );
231
- delete_user_meta( $user_id, 'mo2f_google_authentication_status' );
232
- delete_user_meta( $user_id, 'mo2f_kba_registration_status' );
233
- delete_user_meta( $user_id, 'mo2f_email_verification_status' );
234
- delete_user_meta( $user_id, 'mo2f_authy_authentication_status' );
235
- delete_user_meta( $user_id, 'mo_2factor_map_id_with_email' );
236
- delete_user_meta( $user_id, 'mo_2factor_user_registration_with_miniorange' );
237
- delete_user_meta( $user_id, 'mo2f_mobile_registration_status' );
238
- delete_user_meta( $user_id, 'mo2f_otp_registration_status' );
239
- delete_user_meta( $user_id, 'mo2f_selected_2factor_method' );
240
- delete_user_meta( $user_id, 'mo2f_configure_test_option' );
241
- delete_user_meta( $user_id, 'mo_2factor_user_registration_status' );
242
 
243
- update_option( 'mo2f_existing_user_values_updated', 1 );
 
 
244
 
245
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
 
247
 
 
 
248
  }
249
  }
250
 
@@ -378,7 +386,7 @@ class Miniorange_Authentication {
378
  ? true : false;
379
 
380
 
381
- if ( get_option( 'mo2f_is_NC' ) ) {
382
  if ( ! $can_current_user_manage_options && get_option( 'mo2fa_' . $miniorange_role ) &&
383
  $admin_registration_status && ! $is_customer_admin && $is_plugin_activated && $is_2fa_enabled_for_users ) {
384
  $user_register = new Miniorange_User_Register();
@@ -422,20 +430,20 @@ class Miniorange_Authentication {
422
  }
423
 
424
  function mo_2_factor_enable_frontend_style() {
425
- wp_enqueue_style( 'mo2f_frontend_login_style', plugins_url( 'includes/css/front_end_login.css?version=5.0.7', __FILE__ ) );
426
- wp_enqueue_style( 'bootstrap_style', plugins_url( 'includes/css/bootstrap.min.css?version=5.0.7', __FILE__ ) );
427
- wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url( 'includes/css/phone.css?version=5.0.7', __FILE__ ) );
428
  wp_enqueue_style( 'mo_2_factor_wpb-fa', plugins_url( 'includes/css/font-awesome.min.css', __FILE__ ) );
429
- wp_enqueue_style( 'mo2f_login_popup_style', plugins_url( 'includes/css/mo2f_login_popup_ui.css?version=5.0.7', __FILE__ ) );
430
  }
431
 
432
  function plugin_settings_style($mo2fa_hook_page) {
433
  if ( 'toplevel_page_miniOrange_2_factor_settings' != $mo2fa_hook_page ) {
434
  return;
435
  }
436
- wp_enqueue_style( 'mo_2_factor_admin_settings_style', plugins_url( 'includes/css/style_settings.css?version=5.0.7', __FILE__ ) );
437
- wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url( 'includes/css/phone.css?version=5.0.7', __FILE__ ) );
438
- wp_enqueue_style( 'bootstrap_style', plugins_url( 'includes/css/bootstrap.min.css?version=5.0.7', __FILE__ ) );
439
  wp_enqueue_style( 'mo_2_factor_wpb-fa', plugins_url( 'includes/css/font-awesome.min.css', __FILE__ ) );
440
  }
441
 
@@ -458,7 +466,7 @@ class Miniorange_Authentication {
458
  $user = wp_get_current_user();
459
  $user_id = $user->ID;
460
  global $is_flow_driven_setup;
461
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
462
 
463
  if ( ! session_id() || session_id() == '' || ! isset( $_SESSION ) ) {
464
  session_start();
@@ -485,6 +493,7 @@ class Miniorange_Authentication {
485
  $company = '';
486
  $firstName = '';
487
  $lastName = '';
 
488
  if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['email'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['password'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['confirmPassword'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['company'] ) ) {
489
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "INVALID_ENTRY" ) );
490
  $this->mo_auth_show_error_message();
@@ -939,9 +948,10 @@ class Miniorange_Authentication {
939
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
940
  } else if ( $current_modal == 3 ) {
941
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_test' );
 
 
942
  }
943
 
944
- update_user_meta( $user->ID, 'current_modal', 0 );
945
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 1 );
946
 
947
  update_option( 'mo2f_message', "" );
@@ -1029,9 +1039,10 @@ class Miniorange_Authentication {
1029
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
1030
  } else if ( $current_modal == 3 ) {
1031
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_test' );
 
 
1032
  }
1033
 
1034
- update_user_meta( $user->ID, 'current_modal', 0 );
1035
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 1 );
1036
 
1037
  update_option( 'mo2f_message', "" );
@@ -1992,11 +2003,18 @@ class Miniorange_Authentication {
1992
  update_option( 'mo2f_enable_2fa', isset( $_POST['mo2f_enable_2fa'] ) ? $_POST['mo2f_enable_2fa'] : 0 );
1993
  }
1994
 
 
 
 
 
 
1995
  if ( isset( $_POST['option'] ) && $_POST['option'] == 'mo_2factor_test_authentication_method' ) {
1996
 
1997
- if ( $is_flow_driven_setup ) {
1998
- update_user_meta( $user->ID, 'current_modal', 5 );
1999
- }
 
 
2000
 
2001
  $selected_2FA_method = $_POST['mo2f_configured_2FA_method_test'];
2002
  $selected_2FA_method_server = MO2f_Utility::mo2f_decode_2_factor( $selected_2FA_method, "server" );
@@ -2127,9 +2145,7 @@ class Miniorange_Authentication {
2127
  $this->miniorange_email_verification_call( $user );
2128
  }
2129
 
2130
- if ( ! $is_flow_driven_setup ) {
2131
- update_user_meta( $user->ID, 'test_2FA', 1 );
2132
- }
2133
 
2134
  update_user_meta( $user->ID, 'mo2f_2FA_method_to_test', $selected_2FA_method );
2135
 
@@ -2158,8 +2174,10 @@ class Miniorange_Authentication {
2158
  function mo_auth_deactivate() {
2159
  global $Mo2fdbQueries;
2160
  $mo2f_register_with_another_email = get_option( 'mo2f_register_with_another_email' );
 
 
2161
 
2162
- if ( $mo2f_register_with_another_email ) {
2163
  update_option( 'mo2f_register_with_another_email', 0 );
2164
  $users = get_users( array() );
2165
  $this->mo2f_delete_user_details( $users );
@@ -2357,6 +2375,8 @@ class Miniorange_Authentication {
2357
  $email = get_option( 'mo2f_email' );
2358
 
2359
  update_option( 'mo2f_is_NC', 1 );
 
 
2360
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 0 );
2361
  update_user_meta( $user->ID, 'current_modal', 0 );
2362
 
@@ -2459,7 +2479,7 @@ class Miniorange_Authentication {
2459
  }
2460
 
2461
  function mo2f_get_qr_code_for_mobile( $email, $id ) {
2462
- $is_flow_driven_setup = ! ( get_user_meta( $id, 'current_modal', true ) ) ? 0 : 1;
2463
 
2464
  $registerMobile = new Two_Factor_Setup();
2465
  $content = $registerMobile->register_mobile( $email );
@@ -2566,6 +2586,7 @@ class Miniorange_Authentication {
2566
  update_option( 'mo2f_is_NC', 0 );
2567
  } else {
2568
  update_option( 'mo2f_is_NC', 1 );
 
2569
  }
2570
 
2571
  global $Mo2fdbQueries;
2
  /**
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
+ * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 1 User in the free version of the plugin.
6
+ * Version: 5.0.8
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
167
 
168
  function mo2f_update_db_check() {
169
 
170
+ $user_id = get_site_option( 'mo2f_miniorange_admin' );
171
+
172
+ if( ! get_option( 'mo2f_is_NC' ) )
173
+ update_user_meta( $user_id, 'skipped_flow_driven_setup', true );
174
 
175
  if ( ! get_option( 'mo2f_existing_user_values_updated' ) ) {
176
 
179
  }
180
 
181
  global $Mo2fdbQueries;
182
+ $check_if_user_column_exists = false;
 
 
 
183
 
184
+ if ( $user_id && ! get_option( 'mo2f_is_NC' ) ) {
185
+ $does_table_exist = $Mo2fdbQueries->check_if_table_exists();
186
+ if($does_table_exist)
187
+ $check_if_user_column_exists = $Mo2fdbQueries->check_if_user_column_exists( $user_id );
188
+ if ( ! $check_if_user_column_exists ) {
189
+ $Mo2fdbQueries->generate_tables();
190
+ $Mo2fdbQueries->insert_user( $user_id, array( 'user_id' => $user_id ) );
191
+
192
+ add_option( 'mo2f_phone', get_option( 'user_phone' ) );
193
+ add_option( 'mo2f_enable_login_with_2nd_factor', get_option( 'mo2f_show_loginwith_phone' ) );
194
+ add_option( 'mo2f_remember_device', get_option( 'mo2f_deviceid_enabled' ) );
195
+ add_option( 'mo2f_transactionId', get_option( 'mo2f-login-transactionId' ) );
196
+ add_option( 'mo2f_is_NC', 0 );
197
+ $phone = get_user_meta( $user_id, 'mo2f_user_phone', true );
198
+ $user_phone = $phone ? $phone : get_user_meta( $user_id, 'mo2f_phone', true );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
 
200
  $Mo2fdbQueries->update_user_details( $user_id,
201
  array(
202
+ 'mo2f_GoogleAuthenticator_config_status' => get_user_meta( $user_id, 'mo2f_google_authentication_status', true ),
203
+ 'mo2f_SecurityQuestions_config_status' => get_user_meta( $user_id, 'mo2f_kba_registration_status', true ),
204
+ 'mo2f_EmailVerification_config_status' => true,
205
+ 'mo2f_AuthyAuthenticator_config_status' => get_user_meta( $user_id, 'mo2f_authy_authentication_status', true ),
206
+ 'mo2f_user_email' => get_user_meta( $user_id, 'mo_2factor_map_id_with_email', true ),
207
+ 'mo2f_user_phone' => $user_phone,
208
+ 'user_registration_with_miniorange' => get_user_meta( $user_id, 'mo_2factor_user_registration_with_miniorange', true ),
209
+ 'mobile_registration_status' => get_user_meta( $user_id, 'mo2f_mobile_registration_status', true ),
210
+ 'mo2f_configured_2FA_method' => get_user_meta( $user_id, 'mo2f_selected_2factor_method', true ),
211
+ 'mo_2factor_user_registration_status' => get_user_meta( $user_id, 'mo_2factor_user_registration_status', true )
212
  ) );
 
213
 
214
+ if ( get_user_meta( $user_id, 'mo2f_mobile_registration_status', true ) ) {
215
+ $Mo2fdbQueries->update_user_details( $user_id,
216
+ array(
217
+ 'mo2f_miniOrangeSoftToken_config_status' => true,
218
+ 'mo2f_miniOrangeQRCodeAuthentication_config_status' => true,
219
+ 'mo2f_miniOrangePushNotification_config_status' => true
220
+ ) );
221
+ }
222
 
223
+ if ( get_user_meta( $user_id, 'mo2f_otp_registration_status', true ) ) {
224
+ $Mo2fdbQueries->update_user_details( $user_id,
225
+ array(
226
+ 'mo2f_OTPOverSMS_config_status' => true
227
+ ) );
228
+ }
229
 
230
+ $mo2f_external_app_type = get_user_meta( $user_id, 'mo2f_external_app_type', true ) == 'AUTHY 2-FACTOR AUTHENTICATION' ?
231
+ 'Authy Authenticator' : 'Google Authenticator';
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
+ update_user_meta( $user_id, 'mo2f_external_app_type', $mo2f_external_app_type );
234
+ update_user_meta( $user_id, 'skipped_flow_driven_setup', true );
235
+ update_user_meta( $user_id, 'current_modal', 0 );
236
 
237
+ delete_option( 'mo2f_show_loginwith_phone' );
238
+ delete_option( 'mo2f_deviceid_enabled' );
239
+ delete_option( 'mo2f-login-transactionId' );
240
+ delete_user_meta( $user_id, 'mo2f_google_authentication_status' );
241
+ delete_user_meta( $user_id, 'mo2f_kba_registration_status' );
242
+ delete_user_meta( $user_id, 'mo2f_email_verification_status' );
243
+ delete_user_meta( $user_id, 'mo2f_authy_authentication_status' );
244
+ delete_user_meta( $user_id, 'mo_2factor_map_id_with_email' );
245
+ delete_user_meta( $user_id, 'mo_2factor_user_registration_with_miniorange' );
246
+ delete_user_meta( $user_id, 'mo2f_mobile_registration_status' );
247
+ delete_user_meta( $user_id, 'mo2f_otp_registration_status' );
248
+ delete_user_meta( $user_id, 'mo2f_selected_2factor_method' );
249
+ delete_user_meta( $user_id, 'mo2f_configure_test_option' );
250
+ delete_user_meta( $user_id, 'mo_2factor_user_registration_status' );
251
 
252
+ update_option( 'mo2f_existing_user_values_updated', 1 );
253
 
254
+ }
255
+ }
256
  }
257
  }
258
 
386
  ? true : false;
387
 
388
 
389
+ if ( get_option( 'mo2f_is_NC' ) && !get_option( 'mo2f_is_NNC' ) ) {
390
  if ( ! $can_current_user_manage_options && get_option( 'mo2fa_' . $miniorange_role ) &&
391
  $admin_registration_status && ! $is_customer_admin && $is_plugin_activated && $is_2fa_enabled_for_users ) {
392
  $user_register = new Miniorange_User_Register();
430
  }
431
 
432
  function mo_2_factor_enable_frontend_style() {
433
+ wp_enqueue_style( 'mo2f_frontend_login_style', plugins_url( 'includes/css/front_end_login.css?version=5.0.8', __FILE__ ) );
434
+ wp_enqueue_style( 'bootstrap_style', plugins_url( 'includes/css/bootstrap.min.css?version=5.0.8', __FILE__ ) );
435
+ wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url( 'includes/css/phone.css?version=5.0.8', __FILE__ ) );
436
  wp_enqueue_style( 'mo_2_factor_wpb-fa', plugins_url( 'includes/css/font-awesome.min.css', __FILE__ ) );
437
+ wp_enqueue_style( 'mo2f_login_popup_style', plugins_url( 'includes/css/mo2f_login_popup_ui.css?version=5.0.8', __FILE__ ) );
438
  }
439
 
440
  function plugin_settings_style($mo2fa_hook_page) {
441
  if ( 'toplevel_page_miniOrange_2_factor_settings' != $mo2fa_hook_page ) {
442
  return;
443
  }
444
+ wp_enqueue_style( 'mo_2_factor_admin_settings_style', plugins_url( 'includes/css/style_settings.css?version=5.0.8', __FILE__ ) );
445
+ wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url( 'includes/css/phone.css?version=5.0.8', __FILE__ ) );
446
+ wp_enqueue_style( 'bootstrap_style', plugins_url( 'includes/css/bootstrap.min.css?version=5.0.8', __FILE__ ) );
447
  wp_enqueue_style( 'mo_2_factor_wpb-fa', plugins_url( 'includes/css/font-awesome.min.css', __FILE__ ) );
448
  }
449
 
466
  $user = wp_get_current_user();
467
  $user_id = $user->ID;
468
  global $is_flow_driven_setup;
469
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
470
 
471
  if ( ! session_id() || session_id() == '' || ! isset( $_SESSION ) ) {
472
  session_start();
493
  $company = '';
494
  $firstName = '';
495
  $lastName = '';
496
+
497
  if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['email'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['password'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['confirmPassword'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['company'] ) ) {
498
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "INVALID_ENTRY" ) );
499
  $this->mo_auth_show_error_message();
948
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
949
  } else if ( $current_modal == 3 ) {
950
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_test' );
951
+ } else if ( $current_modal == 6 ) {
952
+ update_user_meta( $user->ID, 'current_modal', 0 );
953
  }
954
 
 
955
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 1 );
956
 
957
  update_option( 'mo2f_message', "" );
1039
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
1040
  } else if ( $current_modal == 3 ) {
1041
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_test' );
1042
+ } else if ( $current_modal == 6 ) {
1043
+ update_user_meta( $user->ID, 'current_modal', 0 );
1044
  }
1045
 
 
1046
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 1 );
1047
 
1048
  update_option( 'mo2f_message', "" );
2003
  update_option( 'mo2f_enable_2fa', isset( $_POST['mo2f_enable_2fa'] ) ? $_POST['mo2f_enable_2fa'] : 0 );
2004
  }
2005
 
2006
+ if ( isset( $_POST['option'] ) && $_POST['option'] == 'mo_2factor_resume_flow_driven_setup' ) {
2007
+ update_option( 'mo2f_message', "" );
2008
+
2009
+ update_user_meta( $user->ID, 'skipped_flow_driven_setup', 0 );
2010
+ }
2011
  if ( isset( $_POST['option'] ) && $_POST['option'] == 'mo_2factor_test_authentication_method' ) {
2012
 
2013
+ if ( $is_flow_driven_setup ) {
2014
+ update_user_meta( $user->ID, 'current_modal', 5 );
2015
+ }else{
2016
+ update_user_meta( $user->ID, 'test_2FA', 1 );
2017
+ }
2018
 
2019
  $selected_2FA_method = $_POST['mo2f_configured_2FA_method_test'];
2020
  $selected_2FA_method_server = MO2f_Utility::mo2f_decode_2_factor( $selected_2FA_method, "server" );
2145
  $this->miniorange_email_verification_call( $user );
2146
  }
2147
 
2148
+
 
 
2149
 
2150
  update_user_meta( $user->ID, 'mo2f_2FA_method_to_test', $selected_2FA_method );
2151
 
2174
  function mo_auth_deactivate() {
2175
  global $Mo2fdbQueries;
2176
  $mo2f_register_with_another_email = get_option( 'mo2f_register_with_another_email' );
2177
+ $is_EC = !get_option('mo2f_is_NC') ? 1: 0;
2178
+ $is_NNC = get_option('mo2f_is_NC') && get_option('mo2f_is_NNC') ? 1: 0;
2179
 
2180
+ if ( $mo2f_register_with_another_email || $is_EC || $is_NNC ) {
2181
  update_option( 'mo2f_register_with_another_email', 0 );
2182
  $users = get_users( array() );
2183
  $this->mo2f_delete_user_details( $users );
2375
  $email = get_option( 'mo2f_email' );
2376
 
2377
  update_option( 'mo2f_is_NC', 1 );
2378
+ update_option( 'mo2f_is_NNC', 1 );
2379
+
2380
  update_user_meta( $user->ID, 'skipped_flow_driven_setup', 0 );
2381
  update_user_meta( $user->ID, 'current_modal', 0 );
2382
 
2479
  }
2480
 
2481
  function mo2f_get_qr_code_for_mobile( $email, $id ) {
2482
+ $is_flow_driven_setup = get_user_meta( $id, 'skipped_flow_driven_setup', true ) ? 0 : 1;
2483
 
2484
  $registerMobile = new Two_Factor_Setup();
2485
  $content = $registerMobile->register_mobile( $email );
2586
  update_option( 'mo2f_is_NC', 0 );
2587
  } else {
2588
  update_option( 'mo2f_is_NC', 1 );
2589
+ update_option( 'mo2f_is_NNC', 1 );
2590
  }
2591
 
2592
  global $Mo2fdbQueries;
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: google authenticator, two factor authentication, two factor, 2FA, 2 factor
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
  Requires PHP: 5.3.0
8
- Stable tag: 5.0.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -19,7 +19,7 @@ This plugin provides two factor authentication during login. If you are looking
19
 
20
  <h4>Free Plugin Features</h4>
21
 
22
- * 2FA for **Unlimited Users**
23
  * **Available Authentication Methods:** Google Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA)
24
  * Language Translation Support
25
 
@@ -219,6 +219,9 @@ miniOrange authentication service has 15+ authentication methods.One time passco
219
 
220
  == Changelog ==
221
 
 
 
 
222
  = 5.0.7 =
223
  * Google Authenticator (2FA) : Bug Fix for User Registration and other plugin conflicts in Dashboard.
224
 
@@ -490,6 +493,9 @@ More descriptive setup messages and UI changes.
490
 
491
  == Upgrade Notice ==
492
 
 
 
 
493
  = 5.0.7 =
494
  * Google Authenticator (2FA) : Bug Fix for User Registration and other plugin conflicts in Dashboard.
495
 
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
  Requires PHP: 5.3.0
8
+ Stable tag: 5.0.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
19
 
20
  <h4>Free Plugin Features</h4>
21
 
22
+ * 2FA for **1 User** forever
23
  * **Available Authentication Methods:** Google Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA)
24
  * Language Translation Support
25
 
219
 
220
  == Changelog ==
221
 
222
+ = 5.0.8 =
223
+ * Google Authenticator (2FA) : Changes for 2FA Free plugin for 1 user forever.
224
+
225
  = 5.0.7 =
226
  * Google Authenticator (2FA) : Bug Fix for User Registration and other plugin conflicts in Dashboard.
227
 
493
 
494
  == Upgrade Notice ==
495
 
496
+ = 5.0.8 =
497
+ * Google Authenticator (2FA) : Changes for 2FA Free plugin for 1 user forever.
498
+
499
  = 5.0.7 =
500
  * Google Authenticator (2FA) : Bug Fix for User Registration and other plugin conflicts in Dashboard.
501
 
uninstall.php CHANGED
@@ -39,6 +39,7 @@ if ( ! is_multisite() ) {
39
  delete_option( 'mo2f_enable_custom_icon' );
40
  delete_option( 'mo2f_show_sms_transaction_message' );
41
  update_option( 'mo2f_is_NC', 1 );
 
42
  delete_option( 'mo2f_admin_first_name' );
43
  delete_option( 'mo2_admin_last_name' );
44
  delete_option( 'mo2f_admin_company' );
@@ -104,6 +105,7 @@ if ( ! is_multisite() ) {
104
  delete_option( 'mo2f_set_transactions' );
105
  delete_option( 'mo2f_show_sms_transaction_message' );
106
  update_option( 'mo2f_is_NC', 1 );
 
107
 
108
  delete_option( 'mo2f_auth_methods_for_users' );
109
  delete_option( 'mo2f_enable_mobile_support' );
39
  delete_option( 'mo2f_enable_custom_icon' );
40
  delete_option( 'mo2f_show_sms_transaction_message' );
41
  update_option( 'mo2f_is_NC', 1 );
42
+ update_option( 'mo2f_is_NNC', 1 );
43
  delete_option( 'mo2f_admin_first_name' );
44
  delete_option( 'mo2_admin_last_name' );
45
  delete_option( 'mo2f_admin_company' );
105
  delete_option( 'mo2f_set_transactions' );
106
  delete_option( 'mo2f_show_sms_transaction_message' );
107
  update_option( 'mo2f_is_NC', 1 );
108
+ update_option( 'mo2f_is_NNC', 1 );
109
 
110
  delete_option( 'mo2f_auth_methods_for_users' );
111
  delete_option( 'mo2f_enable_mobile_support' );
views/configure_google_authenticator CHANGED
@@ -5,7 +5,7 @@ function mo2f_configure_google_authenticator( $user ) {
5
  $mo2f_google_auth = isset( $_SESSION['mo2f_google_auth'] ) ? $_SESSION['mo2f_google_auth'] : null;
6
  $data = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_qrCode'] : null;
7
  $ga_secret = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_secret'] : null;
8
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
9
  $h_size = $is_flow_driven_setup ? 'h4' : 'h3';
10
  ?>
11
  <table>
5
  $mo2f_google_auth = isset( $_SESSION['mo2f_google_auth'] ) ? $_SESSION['mo2f_google_auth'] : null;
6
  $data = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_qrCode'] : null;
7
  $ga_secret = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_secret'] : null;
8
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
9
  $h_size = $is_flow_driven_setup ? 'h4' : 'h3';
10
  ?>
11
  <table>
views/configure_kba_questions CHANGED
@@ -153,9 +153,11 @@ function mo2f_configure_kba_questions() { ?>
153
  }
154
 
155
  function mo2f_configure_for_mobile_suppport_kba( $user ) {
 
156
  ?>
157
 
158
- <?php if ( ! get_user_meta( $user->ID, 'current_modal', true ) ) { ?>
 
159
  <h3><?php echo mo2f_lt( 'Configure Second Factor - KBA (Security Questions)' ); ?></h3>
160
  <hr/>
161
  <?php } ?>
@@ -169,16 +171,17 @@ function mo2f_configure_for_mobile_suppport_kba( $user ) {
169
  <input type="submit" id="mo2f_kba_submit_btn" name="submit"
170
  value="<?php echo mo2f_lt( 'Save' ); ?>"
171
  class="button button-primary button-large" style="width:100px;line-height:30px;"/>
 
172
  </form>
173
- <?php if ( get_user_meta( $user->ID, 'current_modal', true ) ) { ?>
174
  <br><br>
175
  <?php } ?>
176
- </td>
177
  <td>
178
 
179
  <form name="f" method="post" action="" id="mo2f_go_back_form">
180
  <input type="hidden" name="option" value="mo2f_go_back"/>
181
- <?php if ( ! get_user_meta( $user->ID, 'current_modal', true ) ) { ?>
182
  <input type="submit" name="back" id="go_back" class="button button-primary button-large"
183
  value="<?php echo mo2f_lt( 'Back' ); ?>"
184
  style="width:100px;line-height:30px;"/>
153
  }
154
 
155
  function mo2f_configure_for_mobile_suppport_kba( $user ) {
156
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
157
  ?>
158
 
159
+
160
+ <?php if ( ! $is_flow_driven_setup ) { ?>
161
  <h3><?php echo mo2f_lt( 'Configure Second Factor - KBA (Security Questions)' ); ?></h3>
162
  <hr/>
163
  <?php } ?>
171
  <input type="submit" id="mo2f_kba_submit_btn" name="submit"
172
  value="<?php echo mo2f_lt( 'Save' ); ?>"
173
  class="button button-primary button-large" style="width:100px;line-height:30px;"/>
174
+ </td>
175
  </form>
176
+ <?php if ( $is_flow_driven_setup ) { ?>
177
  <br><br>
178
  <?php } ?>
179
+
180
  <td>
181
 
182
  <form name="f" method="post" action="" id="mo2f_go_back_form">
183
  <input type="hidden" name="option" value="mo2f_go_back"/>
184
+ <?php if ( ! $is_flow_driven_setup ) { ?>
185
  <input type="submit" name="back" id="go_back" class="button button-primary button-large"
186
  value="<?php echo mo2f_lt( 'Back' ); ?>"
187
  style="width:100px;line-height:30px;"/>
views/configure_miniorange_authenticator CHANGED
@@ -1,5 +1,6 @@
1
  <?php function mo2f_configure_miniorange_authenticator($user){
2
- $is_flow_driven_setup=! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
 
3
  $mobile_reg_status = get_user_meta($user->ID,'mobile_registration_status',true);
4
  if(!$mobile_reg_status) {
5
  download_instruction_for_mobile_app($is_flow_driven_setup, $mobile_reg_status);
1
  <?php function mo2f_configure_miniorange_authenticator($user){
2
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
3
+
4
  $mobile_reg_status = get_user_meta($user->ID,'mobile_registration_status',true);
5
  if(!$mobile_reg_status) {
6
  download_instruction_for_mobile_app($is_flow_driven_setup, $mobile_reg_status);
views/test_google_authy_authenticator CHANGED
@@ -1,5 +1,5 @@
1
  <?php function mo2f_test_google_authy_authenticator( $user, $method ) {
2
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
3
 
4
  if ( ! $is_flow_driven_setup ) { ?>
5
  <h3><?php echo mo2f_lt( 'Test ' ) . mo2f_lt( $method ); ?></h3>
1
  <?php function mo2f_test_google_authy_authenticator( $user, $method ) {
2
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
3
 
4
  if ( ! $is_flow_driven_setup ) { ?>
5
  <h3><?php echo mo2f_lt( 'Test ' ) . mo2f_lt( $method ); ?></h3>
views/test_kba_security_questions CHANGED
@@ -1,6 +1,6 @@
1
  <?php function mo2f_test_kba_security_questions( $user ) {
2
-
3
- if ( ! get_user_meta( $user->ID, 'current_modal', true ) ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Security Questions( KBA )' ); ?></h3>
5
  <hr>
6
  <?php } ?><br>
@@ -31,14 +31,14 @@
31
  }
32
  ?>
33
  </div>
34
- <?php if ( ! get_user_meta( $user->ID, 'current_modal', true ) ) { ?><input type="button" name="back"
35
  id="go_back"
36
  class="button button-primary button-large"
37
  value="<?php echo mo2f_lt( 'Back' ); ?>" />
38
  <?php } ?>
39
  <input type="submit" name="validate" id="validate" class="button button-primary button-large"
40
  value="<?php echo mo2f_lt( 'Validate Answers' ); ?>"/>
41
- <?php if ( get_user_meta( $user->ID, 'current_modal', true ) ) { ?>
42
  <br><br>
43
  <?php } ?>
44
  </form>
1
  <?php function mo2f_test_kba_security_questions( $user ) {
2
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
3
+ if ( ! $is_flow_driven_setup ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Security Questions( KBA )' ); ?></h3>
5
  <hr>
6
  <?php } ?><br>
31
  }
32
  ?>
33
  </div>
34
+ <?php if ( ! $is_flow_driven_setup ) { ?><input type="button" name="back"
35
  id="go_back"
36
  class="button button-primary button-large"
37
  value="<?php echo mo2f_lt( 'Back' ); ?>" />
38
  <?php } ?>
39
  <input type="submit" name="validate" id="validate" class="button button-primary button-large"
40
  value="<?php echo mo2f_lt( 'Validate Answers' ); ?>"/>
41
+ <?php if ( $is_flow_driven_setup ) { ?>
42
  <br><br>
43
  <?php } ?>
44
  </form>
views/test_miniorange_push_notification CHANGED
@@ -1,5 +1,5 @@
1
  <?php function mo2f_test_miniorange_push_notification( $user ) {
2
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
3
  if ( ! $is_flow_driven_setup ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Push Notification' ); ?></h3>
5
  <hr>
1
  <?php function mo2f_test_miniorange_push_notification( $user ) {
2
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
3
  if ( ! $is_flow_driven_setup ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Push Notification' ); ?></h3>
5
  <hr>
views/test_miniorange_qr_code_authentication CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
 
3
  function mo2f_test_miniorange_qr_code_authentication( $user ) {
4
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
5
  if ( ! $is_flow_driven_setup ) { ?>
6
  <h3><?php echo mo2f_lt( 'Test QR Code Authentication' ); ?></h3>
7
  <hr>
1
  <?php
2
 
3
  function mo2f_test_miniorange_qr_code_authentication( $user ) {
4
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
5
  if ( ! $is_flow_driven_setup ) { ?>
6
  <h3><?php echo mo2f_lt( 'Test QR Code Authentication' ); ?></h3>
7
  <hr>
views/test_miniorange_soft_token CHANGED
@@ -1,5 +1,5 @@
1
  <?php function mo2f_test_miniorange_soft_token( $user ) {
2
- $is_flow_driven_setup = ! ( get_user_meta( $user->ID, 'current_modal', true ) ) ? 0 : 1;
3
  if ( ! $is_flow_driven_setup ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Soft Token' ); ?></h3>
5
  <hr>
1
  <?php function mo2f_test_miniorange_soft_token( $user ) {
2
+ $is_flow_driven_setup = get_user_meta( $user->ID, 'skipped_flow_driven_setup', true ) ? 0 : 1;
3
  if ( ! $is_flow_driven_setup ) { ?>
4
  <h3><?php echo mo2f_lt( 'Test Soft Token' ); ?></h3>
5
  <hr>