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

Version Description

Download this release

Release Info

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

Code changes from version 5.4.31 to 5.4.32

api/Mo2f_OnPremRedirect.php CHANGED
@@ -28,7 +28,7 @@ class Mo2f_OnPremRedirect {
28
  $user_id = wp_get_current_user()->ID;
29
  }
30
  else{
31
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
32
  }
33
  $redirect_to = isset( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : null;
34
  $kba_ans_1 = sanitize_text_field( $_POST['mo2f_answer_1'] );
@@ -98,7 +98,7 @@ class Mo2f_OnPremRedirect {
98
  $user = wp_get_current_user();
99
  $user_id = $user->ID;
100
  }else{
101
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
102
  }
103
  $secret= $gauth_obj->mo_GAuth_get_secret($user_id);
104
  $content=$gauth_obj->verifyCode($secret, $otpToken);
28
  $user_id = wp_get_current_user()->ID;
29
  }
30
  else{
31
+ $user_id = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
32
  }
33
  $redirect_to = isset( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : null;
34
  $kba_ans_1 = sanitize_text_field( $_POST['mo2f_answer_1'] );
98
  $user = wp_get_current_user();
99
  $user_id = $user->ID;
100
  }else{
101
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
102
  }
103
  $secret= $gauth_obj->mo_GAuth_get_secret($user_id);
104
  $content=$gauth_obj->verifyCode($secret, $otpToken);
api/class-rba-attributes.php CHANGED
@@ -139,7 +139,7 @@ class Miniorange_Rba_Attributes {
139
  $gauth_obj= new Google_auth_onpremise();
140
  $session_id_encrypt = isset($_POST['mo2f_session_id']) ? sanitize_text_field($_POST['mo2f_session_id']) : null;
141
  if($session_id_encrypt){
142
- $secret_ga = MO2f_Utility::mo2f_retrieve_user_temp_values( 'secret_ga',$session_id_encrypt );
143
  }else{
144
  $secret_ga = $secret;
145
  }
139
  $gauth_obj= new Google_auth_onpremise();
140
  $session_id_encrypt = isset($_POST['mo2f_session_id']) ? sanitize_text_field($_POST['mo2f_session_id']) : null;
141
  if($session_id_encrypt){
142
+ $secret_ga = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'secret_ga');
143
  }else{
144
  $secret_ga = $secret;
145
  }
controllers/request_christmas_offer.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
-
3
-
4
- if(current_user_can( 'manage_options' ) && isset($_POST['option']) )
5
- {
6
- switch($_POST['option'])
7
- {
8
- case "mo_2FA_christmas_request_form":
9
- wpns_handle_christmas_request_form($_POST); break;
10
- }
11
- }
12
-
13
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'request_christmas_offer.php';
14
-
15
- function wpns_handle_christmas_request_form($post){
16
- $nonce = isset($post['nonce'])?$post['nonce']:NULL;
17
- $usecase = isset($post['mo_2FA_christmas_usecase'])? $post['mo_2FA_christmas_usecase']: NULL;
18
- $email = isset($post['mo_2FA_christmas_email'])? $post['mo_2FA_christmas_email'] : NULL;
19
- if ( ! wp_verify_nonce( $nonce, 'mo2f-Request-christmas' ) ){
20
- return;
21
- }
22
- if(empty($usecase) || empty($email) )
23
- {
24
- do_action('wpns_show_message',MoWpnsMessages::showMessage('DEMO_FORM_ERROR'),'SUCCESS');
25
- return;
26
- }
27
- else{
28
-
29
- $usecase = sanitize_text_field( $usecase );
30
- $email = sanitize_text_field( $email );
31
- $query = 'REQUEST FOR CHRISTMAS OFFERS';
32
- $query .= ' =>';
33
- $query .= ' : ';
34
- $query .= $usecase;
35
- $contact_us = new MocURL();
36
- $submited = json_decode($contact_us->submit_contact_us($email, '', $query),true);
37
-
38
- if(json_last_error() == JSON_ERROR_NONE && $submited)
39
- {
40
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_SENT'),'SUCCESS');
41
- return;
42
- }
43
- else{
44
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
45
- }
46
- }
47
- }
48
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
controllers/twofa/mo2fa_common_login.php CHANGED
@@ -260,7 +260,7 @@ function mo2f_get_kba_authentication_prompt($login_status, $login_message, $redi
260
  $mo_wpns_config = new MoWpnsHandler();
261
  $mo2f_login_option = MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option');
262
  $mo2f_remember_device_enabled = get_option( 'mo2f_remember_device' );
263
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
264
  ?>
265
  <html>
266
  <head>
@@ -489,10 +489,8 @@ function mo2f_get_push_notification_oobemail_prompt( $id, $login_status, $login_
489
  $mo2f_enable_forgotphone = MoWpnsUtility::get_mo2f_db_option('mo2f_enable_forgotphone', 'get_option');
490
  $mo2f_KBA_config_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $id );
491
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
492
- $mo2f_EV_txid = get_user_meta($id,'mo2f_EV_txid',true);
493
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
494
- if(!MO2F_IS_ONPREM)
495
- $mo2f_EV_txid = $_SESSION['mo2f_transactionId'];
496
  ?>
497
  <html>
498
  <head>
@@ -729,7 +727,7 @@ function mo2f_get_qrcode_authentication_prompt( $login_status, $login_message, $
729
  $mo2f_enable_forgotphone = MoWpnsUtility::get_mo2f_db_option('mo2f_enable_forgotphone', 'get_option');
730
  $mo_wpns_config = new MoWpnsHandler();
731
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
732
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
733
  ?>
734
  <html>
735
  <head>
@@ -906,7 +904,7 @@ function mo2f_get_otp_authentication_prompt( $login_status, $login_message, $red
906
  $mo_wpns_config = new MoWpnsHandler();
907
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
908
  $attempts = get_option('mo2f_attempts_before_redirect', 3);
909
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
910
  $mo2f_otp_over_email_config_status = $Mo2fdbQueries->get_user_detail( 'mo2f_OTPOverEmail_config_status', $user_id );
911
  ?>
912
  <html>
260
  $mo_wpns_config = new MoWpnsHandler();
261
  $mo2f_login_option = MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option');
262
  $mo2f_remember_device_enabled = get_option( 'mo2f_remember_device' );
263
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
264
  ?>
265
  <html>
266
  <head>
489
  $mo2f_enable_forgotphone = MoWpnsUtility::get_mo2f_db_option('mo2f_enable_forgotphone', 'get_option');
490
  $mo2f_KBA_config_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $id );
491
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
492
+ $mo2f_EV_txid = get_user_meta($id,'mo2f_EV_txid',true);
493
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
 
 
494
  ?>
495
  <html>
496
  <head>
727
  $mo2f_enable_forgotphone = MoWpnsUtility::get_mo2f_db_option('mo2f_enable_forgotphone', 'get_option');
728
  $mo_wpns_config = new MoWpnsHandler();
729
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
730
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
731
  ?>
732
  <html>
733
  <head>
904
  $mo_wpns_config = new MoWpnsHandler();
905
  $mo2f_is_new_customer = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
906
  $attempts = get_option('mo2f_attempts_before_redirect', 3);
907
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
908
  $mo2f_otp_over_email_config_status = $Mo2fdbQueries->get_user_detail( 'mo2f_OTPOverEmail_config_status', $user_id );
909
  ?>
910
  <html>
controllers/twofa/mo2fa_inline_registration.php CHANGED
@@ -50,7 +50,7 @@ function prompt_user_to_select_2factor_mthod_inline($current_user_id, $login_sta
50
  }
51
  $Mo2fdbQueries->update_user_details( $current_user_id, array('mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS') );
52
  $pass2fa= new Miniorange_Password_2Factor_Login();
53
- $pass2fa->mo2fa_pass2login($redirect_to);
54
  }
55
  prompt_user_for_setup_success($current_user_id, $login_status, $login_message,$redirect_to,$session_id);
56
  }else{
@@ -496,11 +496,8 @@ function prompt_user_for_miniorange_app_setup($current_user_id, $login_status, $
496
  }
497
 
498
  function prompt_user_for_google_authenticator_setup($current_user_id, $login_status, $login_message,$redirect_to,$session_id){
499
- // $mo2f_google_auth=json_decode(get_user_meta($current_user_id,'mo2f_google_auth', true),true);
500
- // $data = isset($mo2f_google_auth) ? $mo2f_google_auth['ga_qrCode'] : null;
501
- // $ga_secret = isset($mo2f_google_auth) ? $mo2f_google_auth['ga_secret'] : null;
502
- $ga_secret = MO2f_Utility::mo2f_retrieve_user_temp_values( 'secret_ga',$session_id );
503
- $data = MO2f_Utility::mo2f_retrieve_user_temp_values( 'ga_qrCode',$session_id );
504
 
505
  ?>
506
  <html>
@@ -729,7 +726,9 @@ function mo2f_inline_css_and_js(){
729
 
730
  function initialize_inline_mobile_registration($current_user,$session_id,$qrCode){
731
  $data = $qrCode;
732
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId', $session_id );
 
 
733
  $url = MO_HOST_NAME;
734
  $opt=fetch_methods($current_user);
735
  ?>
@@ -1093,7 +1092,7 @@ function prompt_user_for_setup_success($id, $login_status, $login_message,$redir
1093
  if(get_site_option('mo2f_remember_device')!=1)
1094
  {
1095
  $pass2fa= new Miniorange_Password_2Factor_Login();
1096
- $pass2fa->mo2fa_pass2login(site_url());
1097
  ?>
1098
  <center>
1099
  <p style="font-size:17px;"><?php echo __('You have successfully set up ', 'miniorange-2-factor-authentication'); ?><b style="color:#28B463;"><?php echo $mo2f_second_factor; ?> </b><?php echo __('as your Two Factor method.', 'miniorange-2-factor-authentication'); ?><br><br>
50
  }
51
  $Mo2fdbQueries->update_user_details( $current_user_id, array('mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS') );
52
  $pass2fa= new Miniorange_Password_2Factor_Login();
53
+ $pass2fa->mo2fa_pass2login($redirect_to, $session_id);
54
  }
55
  prompt_user_for_setup_success($current_user_id, $login_status, $login_message,$redirect_to,$session_id);
56
  }else{
496
  }
497
 
498
  function prompt_user_for_google_authenticator_setup($current_user_id, $login_status, $login_message,$redirect_to,$session_id){
499
+ $ga_secret = MO2f_Utility::mo2f_get_transient($session_id, 'secret_ga');
500
+ $data = MO2f_Utility::mo2f_get_transient($session_id, 'ga_qrCode');
 
 
 
501
 
502
  ?>
503
  <html>
726
 
727
  function initialize_inline_mobile_registration($current_user,$session_id,$qrCode){
728
  $data = $qrCode;
729
+
730
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id, 'mo2f_transactionId' );
731
+
732
  $url = MO_HOST_NAME;
733
  $opt=fetch_methods($current_user);
734
  ?>
1092
  if(get_site_option('mo2f_remember_device')!=1)
1093
  {
1094
  $pass2fa= new Miniorange_Password_2Factor_Login();
1095
+ $pass2fa->mo2fa_pass2login(site_url(), $session_id);
1096
  ?>
1097
  <center>
1098
  <p style="font-size:17px;"><?php echo __('You have successfully set up ', 'miniorange-2-factor-authentication'); ?><b style="color:#28B463;"><?php echo $mo2f_second_factor; ?> </b><?php echo __('as your Two Factor method.', 'miniorange-2-factor-authentication'); ?><br><br>
handler/twofa/gaonprem.php CHANGED
@@ -11,34 +11,23 @@ class Google_auth_onpremise{
11
 
12
  $user=wp_get_current_user();
13
  $user_id=$user->ID;
14
- // if(!isset($_SESSION)){
15
- // session_start();
16
- // }
17
- // if(!isset($_SESSION['secret_ga'])){
18
- // $_SESSION['secret_ga'] = $this->createSecret();
19
- // }
20
  if(isset($_POST) && isset($_POST['mo2f_session_id'])){
21
  $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
22
  }else{
23
- $pass2fa_login_session = new Miniorange_Password_2Factor_Login();
24
- $session_id_encrypt = $pass2fa_login_session->create_session();
25
  }
26
- $secret_ga = MO2f_Utility::mo2f_retrieve_user_temp_values( 'secret_ga',$session_id_encrypt );
27
- if(empty($secret_ga)){
28
  $secret_ga = $this->createSecret();
29
- MO2f_Utility::set_user_values($session_id_encrypt, 'secret_ga', $secret_ga);
30
  }
31
 
32
 
33
  $issuer=get_option('mo2f_google_appname', 'miniOrangeAu');
34
  $email=$user->user_email;
35
-
36
- // $otpcode=$this->getCode($_SESSION['secret_ga']);
37
  $otpcode=$this->getCode($secret_ga);
38
-
39
- // $url=$this->geturl($_SESSION['secret_ga'] ,$issuer,$email);
40
  $url=$this->geturl($secret_ga ,$issuer,$email);
41
- // mo2f_configure_google_authenticator_onprem( $_SESSION['secret_ga'] ,$url,$otpcode );
42
  echo '<div class="mo_wpns_setting_layout">';
43
  mo2f_configure_google_authenticator_onprem( $secret_ga ,$url,$otpcode, $session_id_encrypt );
44
  echo '</div>';
11
 
12
  $user=wp_get_current_user();
13
  $user_id=$user->ID;
14
+
 
 
 
 
 
15
  if(isset($_POST) && isset($_POST['mo2f_session_id'])){
16
  $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
17
  }else{
18
+ $session_id_encrypt = MO2f_Utility::random_str(20);
 
19
  }
20
+ $secret_ga = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'secret_ga');
21
+ if(!$secret_ga){
22
  $secret_ga = $this->createSecret();
23
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $secret_ga);
24
  }
25
 
26
 
27
  $issuer=get_option('mo2f_google_appname', 'miniOrangeAu');
28
  $email=$user->user_email;
 
 
29
  $otpcode=$this->getCode($secret_ga);
 
 
30
  $url=$this->geturl($secret_ga ,$issuer,$email);
 
31
  echo '<div class="mo_wpns_setting_layout">';
32
  mo2f_configure_google_authenticator_onprem( $secret_ga ,$url,$otpcode, $session_id_encrypt );
33
  echo '</div>';
handler/twofa/setup_twofa.php CHANGED
@@ -762,7 +762,7 @@ function mo2f_show_2FA_test_screen( $user, $selected2FAmethod ) {
762
  mo2f_test_miniorange_soft_token( $user );
763
  break;
764
  case "Email Verification":
765
- mo2f_test_email_verification();
766
  break;
767
  case "OTP Over SMS":
768
  mo2f_test_otp_over_sms( $user );
762
  mo2f_test_miniorange_soft_token( $user );
763
  break;
764
  case "Email Verification":
765
+ mo2f_test_email_verification($user);
766
  break;
767
  case "OTP Over SMS":
768
  mo2f_test_otp_over_sms( $user );
handler/twofa/two_fa_pass2login.php CHANGED
@@ -36,7 +36,7 @@ class Miniorange_Password_2Factor_Login {
36
  $password = sanitize_text_field( $_POST['password'] );
37
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
38
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
39
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
40
  if( $moWpnsUtility->check_empty_or_null( $email ) || $moWpnsUtility->check_empty_or_null( $password ) )
41
  {
42
  $login_message=MoWpnsMessages::showMessage('REQUIRED_FIELDS');
@@ -53,7 +53,9 @@ class Miniorange_Password_2Factor_Login {
53
  $password = sanitize_text_field($_POST['password']);
54
  $confirmPassword = sanitize_text_field($_POST['confirmPassword']);
55
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
56
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
57
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
58
  if( strlen( $password ) < 6 || strlen( $confirmPassword ) < 6)
59
  {
@@ -113,7 +115,9 @@ class Miniorange_Password_2Factor_Login {
113
  } else {
114
  $codes=explode(",", $backups);
115
  $session_id = sanitize_text_field($_POST['session_id']);
116
- $id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id );
 
 
117
  update_user_meta($id, 'mo_backup_code_downloaded', 1);
118
  delete_user_meta($id, 'chqwetcsdvnvd');
119
  MO2f_Utility::mo2f_download_backup_codes($id, $codes);
@@ -143,7 +147,6 @@ class Miniorange_Password_2Factor_Login {
143
  }else {
144
  $this->miniorange_pass2login_start_session();
145
  $session_id_encrypt = isset($POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
146
- $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize( $_SESSION[ 'mo2f_current_user' ] ) : null;
147
  $redirect_to = isset($POSTED[ 'redirect_to' ]) ? esc_url_raw($POSTED[ 'redirect_to' ]) : null;
148
  $mo2fa_login_message = __('Please provide your backup codes.','miniorange-2-factor-authentication');
149
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
@@ -161,9 +164,9 @@ class Miniorange_Password_2Factor_Login {
161
  return $error;
162
  } else {
163
  $this->miniorange_pass2login_start_session();
164
- $currentuser_id = isset($_SESSION[ 'mo2f_current_user_id' ]) ? $_SESSION[ 'mo2f_current_user_id' ] : null;
165
  $redirect_to = isset($POSTED[ 'redirect_to' ]) ? esc_url_raw($POSTED[ 'redirect_to' ]) : null;
166
- if(isset($_SESSION[ 'mo2f_current_user_id' ])){
167
  if(MO2f_Utility::mo2f_check_empty_or_null($POSTED[ 'mo2f_backup_code' ]) ){
168
  $mo2fa_login_message = __('Please provide backup code.','miniorange-2-factor-authentication');
169
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
@@ -194,7 +197,7 @@ class Miniorange_Password_2Factor_Login {
194
  $result = wp_mail($mo2f_user_email,$subject,$message,$headers);
195
  }
196
 
197
- $this->mo2fa_pass2login($redirect_to);
198
  }else{
199
  $mo2fa_login_message = __('The codes you have provided are either expired or incorrect.','miniorange-2-factor-authentication');
200
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
@@ -223,8 +226,7 @@ class Miniorange_Password_2Factor_Login {
223
 
224
  $redirect_to = esc_url_raw($_POST['redirect_to']);
225
  $session_id = sanitize_text_field($_POST['session_id']);
226
-
227
- $id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id );
228
 
229
  $codes=MO2f_Utility::mo_2f_generate_backup_codes();
230
  $codes_hash=MO2f_Utility::mo2f_get_codes_hash($codes);
@@ -320,9 +322,9 @@ class Miniorange_Password_2Factor_Login {
320
  } else{
321
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
322
  }
 
323
 
324
 
325
- $current_user = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
326
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
327
  if($selected_2factor_method == 'OTP Over Whatsapp')
328
  {
@@ -459,7 +461,10 @@ class Miniorange_Password_2Factor_Login {
459
  if(isset($_POST['verify_phone']))
460
  $phone = sanitize_text_field( $_POST['verify_phone'] );
461
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
462
- $current_user = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
 
463
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
464
  $customer = new Customer_Setup();
465
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
@@ -667,8 +672,9 @@ class Miniorange_Password_2Factor_Login {
667
  array_push($kba_q_a_list, $kba_answers[$c]);
668
  }
669
 
 
 
670
 
671
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
672
  $current_user = get_user_by('id',$user_id);
673
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
674
  $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
@@ -734,7 +740,9 @@ class Miniorange_Password_2Factor_Login {
734
  $this->miniorange_pass2login_start_session();
735
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
736
  MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
737
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
738
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
739
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
740
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
@@ -829,8 +837,7 @@ class Miniorange_Password_2Factor_Login {
829
  global $Mo2fdbQueries;
830
  $this->miniorange_pass2login_start_session();
831
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
832
-
833
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
834
 
835
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
836
  $current_user = get_user_by('id',$user_id);
@@ -841,7 +848,8 @@ class Miniorange_Password_2Factor_Login {
841
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
842
  $miniorageqr = $this->mo2f_inline_get_qr_code_for_mobile($email,$current_user->ID);
843
  $mo2fa_login_message=$miniorageqr['message'];
844
- MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_transactionId', $miniorageqr['mo2f-login-transactionId'] );
 
845
  $this->mo2f_transactionid=$miniorageqr['mo2f-login-transactionId'];
846
  }else{
847
  $mo2fa_login_message = __('Invalid request. Please register with miniOrange before configuring your mobile.','miniorange-2-factor-authentication');
@@ -863,13 +871,13 @@ class Miniorange_Password_2Factor_Login {
863
  $this->miniorange_pass2login_start_session();
864
  $otpToken = sanitize_text_field($_POST['google_auth_code']);
865
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
866
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
867
  $current_user = get_user_by('id',$user_id);
868
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
869
- // $mo2f_google_auth=json_decode(get_user_meta($user_id,'mo2f_google_auth', true),true);
870
- // $mo2f_google_auth = isset($mo2f_google_auth) ?$mo2f_google_auth : null;
871
- // $ga_secret = $mo2f_google_auth != null ? $mo2f_google_auth['ga_secret'] : null;
872
- $ga_secret = MO2f_Utility::mo2f_retrieve_user_temp_values( 'secret_ga',$session_id_encrypt );
873
  $mo2fa_login_message = '';
874
  $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
875
  if(MO2f_Utility::mo2f_check_number_length($otpToken)){
@@ -925,8 +933,11 @@ class Miniorange_Password_2Factor_Login {
925
  } else {
926
  global $Mo2fdbQueries;
927
  $this->miniorange_pass2login_start_session();
928
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
929
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
 
930
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
931
  $current_user = get_user_by('id',$user_id);
932
  $Mo2fdbQueries->update_user_details( $current_user->ID, array( "mo2f_configured_2FA_method" => '' ) );
@@ -1015,15 +1026,16 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1015
  return $error;
1016
  }
1017
  else{
1018
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1019
- global $Mo2fdbQueries;
1020
- $redirect_to = esc_url_raw($_POST['redirect_to']);
1021
- $session_id_encrypt = sanitize_text_field($session_id_encrypt);
1022
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1023
-
1024
- $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_2factor_enable_2fa_byusers' => 0) );
1025
-
1026
- $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
 
1027
  }
1028
  }
1029
  }
@@ -1042,8 +1054,11 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1042
  global $Mo2fdbQueries;
1043
  $this->miniorange_pass2login_start_session();
1044
  $mo2fa_login_message = '';
1045
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1046
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
 
 
1047
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1048
  $current_user = get_user_by('id',$user_id);
1049
  $currentUserId = $current_user->ID;
@@ -1134,10 +1149,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1134
  $mo2f_google_auth = array();
1135
  $mo2f_google_auth['ga_qrCode'] = $url;
1136
  $mo2f_google_auth['ga_secret'] = $onpremise_secret;
1137
- // $_SESSION['mo2f_google_auth'] = $mo2f_google_auth;
1138
- MO2f_Utility::set_user_values($session_id_encrypt, 'secret_ga', $onpremise_secret);
1139
- MO2f_Utility::set_user_values($session_id_encrypt, 'ga_qrCode', $url);
1140
- // update_user_meta($current_user->ID,'mo2f_google_auth', json_encode($mo2f_google_auth));
1141
 
1142
  }else{
1143
  $current_user = get_userdata($currentUserId);
@@ -1162,13 +1176,12 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1162
  if ( json_last_error() == JSON_ERROR_NONE ) {
1163
  if ( $google_response['status'] == 'SUCCESS' ) {
1164
 
1165
- $mo2f_google_auth = array();
1166
- $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
1167
- $mo2f_google_auth['ga_secret'] = $google_response['secret'];
1168
- // $_SESSION['mo2f_google_auth'] = $mo2f_google_auth;
1169
- // update_user_meta( $current_user->ID, 'mo2f_google_auth', json_encode( $mo2f_google_auth ) );
1170
- MO2f_Utility::set_user_values($session_id_encrypt, 'secret_ga', $mo2f_google_auth['ga_secret']);
1171
- MO2f_Utility::set_user_values($session_id_encrypt, 'ga_qrCode', $mo2f_google_auth['ga_qrCode']);
1172
 
1173
  } else {
1174
  $mo2fa_login_message = __( 'Invalid request. Please register with miniOrange to configure 2 Factor plugin.', 'miniorange-2-factor-authentication' );
@@ -1232,7 +1245,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1232
  }else{
1233
  $this->miniorange_pass2login_start_session();
1234
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1235
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1236
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1237
  if ( isset( $user_id ) ) {
1238
  if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_2'] ) ) {
@@ -1241,7 +1254,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1241
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1242
  }
1243
  $otpToken = array();
1244
- $kba_questions = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo_2_factor_kba_questions',$session_id_encrypt );
1245
  $otpToken[0] = $kba_questions[0]['question'];
1246
  $otpToken[1] = sanitize_text_field( $_POST['mo2f_answer_1'] );
1247
  $otpToken[2] = $kba_questions[1]['question'];
@@ -1302,7 +1315,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1302
  $this->miniorange_pass2login_start_session();
1303
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1304
  try {
1305
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id', $session_id_encrypt );
1306
  Global $Mo2fdbQueries;
1307
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1308
  $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
@@ -1346,7 +1359,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1346
  $mo2fa_login_message = '';
1347
  $this->miniorange_pass2login_start_session();
1348
  $customer = new Customer_Setup();
1349
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1350
  Global $Mo2fdbQueries;
1351
  $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1352
  $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
@@ -1386,7 +1399,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1386
  } else {
1387
  $this->miniorange_pass2login_start_session();
1388
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1389
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1390
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1391
  $this->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1392
  }
@@ -1415,7 +1428,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1415
  $this->miniorange_pass2login_start_session();
1416
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1417
  //if the php session folder has insufficient permissions, cookies to be used
1418
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId',$session_id_encrypt );
1419
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1420
  $checkMobileStatus = new Two_Factor_Setup();
1421
  $content = $checkMobileStatus->check_mobile_status( $mo2f_login_transaction_id );
@@ -1470,7 +1483,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1470
  $mo2fa_login_message = '';
1471
  $this->miniorange_pass2login_start_session();
1472
  $customer = new Customer_Setup();
1473
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1474
  $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1475
  $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1476
  if ( $kba_configuration_status ) {
@@ -1533,7 +1546,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1533
  $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1534
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1535
  $softtoken = '';
1536
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1537
  $attempts = get_option('mo2f_attempts_before_redirect', 3);
1538
  if ( MO2f_utility::mo2f_check_empty_or_null( $_POST['mo2fa_softtoken'] ) ) {
1539
  if($attempts>1 || $attempts=='disabled')
@@ -1575,7 +1588,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1575
  $content = '';
1576
  $current_user = get_userdata($user_id);
1577
  //if the php session folder has insufficient permissions, cookies to be used
1578
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId', $session_id_encrypt );
1579
 
1580
  if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ) {
1581
  $content = json_decode( $customer->validate_otp_token( 'EMAIL', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ),$current_user ), true );
@@ -1708,7 +1721,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1708
  return $error;
1709
  } else {
1710
  $this->miniorange_pass2login_start_session();
1711
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
1712
  $currentuser = get_user_by( 'id', $user_id );
1713
  $attributes = isset( $POSTED['miniorange_rba_attribures'] ) ? $POSTED['miniorange_rba_attribures'] : null;
1714
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
@@ -1754,8 +1767,11 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
1754
  if ( username_exists( $username ) ) { /*if username exists in wp site */
1755
  $user = new WP_User( $username );
1756
  $redirect_to = isset( $_REQUEST['redirect_to'] ) ? esc_url_raw($_REQUEST['redirect_to']) : null;
1757
- MO2f_Utility::set_user_values($session_id, 'mo2f_current_user_id', $user->ID );
1758
- MO2f_Utility::set_user_values($session_id, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS' );
 
 
 
1759
  $this->mo2f_userId=$user->ID;
1760
  $this->fstfactor='VALIDATE_SUCCESS';
1761
  $current_roles = miniorange_get_user_role( $user );
@@ -2159,7 +2175,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2159
  $mo2fa_login_message = 'Please answer the following questions:';
2160
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2161
  $mo2f_kbaquestions = $questions;
2162
- MO2f_Utility::set_user_values( $session_id, 'mo_2_factor_kba_questions', $questions );
2163
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2164
  }
2165
 
@@ -2174,7 +2190,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2174
  $questions = array();
2175
  $questions[0] = $response['questions'][0];
2176
  $questions[1] = $response['questions'][1];
2177
- MO2f_Utility::set_user_values( $session_id, 'mo_2_factor_kba_questions', $questions );
2178
  $this->mo2f_kbaquestions=$questions;
2179
  $mo2fa_login_message = 'Please answer the following questions:';
2180
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
@@ -2202,43 +2218,51 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2202
  $login_message = $mo2fa_login_message;
2203
  switch ($login_status) {
2204
  case 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION':
2205
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId',$session_id_encrypt );
2206
  mo2f_get_qrcode_authentication_prompt( $login_status, $login_message, $redirect_to, $qrCode, $session_id_encrypt, $transactionid );
2207
  exit;
2208
  break;
2209
  case 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN':
2210
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2211
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
 
2212
  exit;
2213
  break;
2214
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL':
2215
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
 
2216
  mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id,$show_back_button );
2217
  exit;
2218
  break;
2219
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM':
2220
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2221
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
2222
  exit;
2223
  break;
2224
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP':
2225
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2226
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
2227
  exit;
2228
  break;
2229
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS':
2230
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2231
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
2232
  exit;
2233
  break;
2234
  case 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION':
2235
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2236
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
2237
  exit;
2238
  break;
2239
  case 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION':
2240
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2241
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
 
2242
  exit;
2243
  break;
2244
  case 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL':
@@ -2247,39 +2271,45 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2247
  break;
2248
 
2249
  case 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS':
2250
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId',$session_id_encrypt );
2251
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2252
- mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
 
2253
  exit;
2254
  break;
2255
 
2256
  case 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL':
2257
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId',$session_id_encrypt );
2258
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2259
- mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
 
2260
  exit;
2261
  break;
2262
 
2263
  case 'MO_2_FACTOR_RECONFIG_GOOGLE':
2264
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2265
- $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_google' );
 
2266
  exit;
2267
  break;
2268
 
2269
  case 'MO_2_FACTOR_RECONFIG_KBA':
2270
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2271
- $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_kba' );
 
2272
  exit;
2273
  break;
2274
 
2275
  case 'MO_2_FACTOR_SETUP_SUCCESS':
2276
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2277
- $this->mo2f_inline_setup_success($user_id,$redirect_to,$session_id_encrypt);
 
2278
  break;
2279
 
2280
  case 'MO_2_FACTOR_GENERATE_BACKUP_CODES':
2281
- $current_user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2282
- mo2f_backup_codes_generate($current_user_id, $redirect_to, $session_id_encrypt);
 
2283
  exit;
2284
 
2285
  case 'MO_2_FACTOR_CHALLENGE_BACKUP':
@@ -2287,14 +2317,15 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2287
  exit;
2288
 
2289
  case 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION':
2290
-
2291
- if(MO2F_IS_ONPREM){
2292
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2293
- $ques = get_user_meta( $user_id, 'kba_questions_user');
2294
- mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $ques[0] );
2295
- }
2296
- else{
2297
- $kbaquestions = $this->mo2f_kbaquestions ? $this->mo2f_kbaquestions : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo_2_factor_kba_questions',$session_id_encrypt );
 
2298
  mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $kbaquestions );
2299
  }
2300
  exit;
@@ -2306,8 +2337,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2306
  break;
2307
 
2308
  case 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS':
2309
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id',$session_id_encrypt );
2310
- prompt_user_to_select_2factor_mthod_inline($user_id, $login_status, $login_message,$redirect_to,$session_id_encrypt,$qrCode);
 
2311
  exit;
2312
  break;
2313
 
@@ -2472,7 +2504,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2472
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2473
  if ( $response['status'] == 'SUCCESS' ) {
2474
  $qrCode = $response['qrCode'];
2475
- MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_transactionId', $response['txId'] );
 
 
2476
  $this->mo2f_transactionid=$response['txId'];
2477
  $mo2fa_login_message = '';
2478
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
@@ -2514,14 +2548,20 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2514
  $response = json_decode( $content, true );
2515
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2516
  if ( $response['status'] == 'SUCCESS' ) {
2517
- MO2f_Utility::set_user_values( $session_id, "mo2f_transactionId", $response['txId'] );
 
 
 
2518
  $this->mo2f_transactionid=$response['txId'];
2519
 
2520
  $mo2fa_login_message = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'A Push Notification has been sent to your phone. We are waiting for your approval.' : 'An email has been sent to ' . MO2f_Utility::mo2f_get_hidden_email( $user_email ) . '. We are waiting for your approval.';
2521
  $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2522
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
2523
  } else if ( $response['status'] == 'ERROR' || $response['status'] == 'FAILED' ) {
2524
- MO2f_Utility::set_user_values( $session_id, "mo2f_transactionId", $response['txId'] );
 
 
 
2525
  $this->mo2f_transactionid=$response['txId'];
2526
  $mo2fa_login_message = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'An error occured while sending push notification to your app. You can click on <b>Phone is Offline</b> button to enter soft token from app or <b>Forgot your phone</b> button to receive OTP to your registered email.' : 'An error occured while sending email. Please try again.';
2527
  $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
@@ -2678,7 +2718,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2678
  $response['phoneDelivery']['contact'] = '';
2679
  $message = 'The OTP has been sent to ' . MO2f_Utility::get_hidden_phone( $response['phoneDelivery']['contact'] ) . '. Please enter the OTP you received to Validate.';
2680
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2681
- MO2f_Utility::set_user_values( $session_id, "mo2f_transactionId", $response['txId'] );
 
 
2682
  $this->mo2f_transactionid=$response['txId'];
2683
  $mo2fa_login_message = $message;
2684
  $currentMethod = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
@@ -2707,7 +2749,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2707
  $message = $response['message'] . ' You can click on <a href="https://faq.miniorange.com/knowledgebase/i-am-locked-cant-access-my-account-what-do-i-do/">I am locked out</a> to login via alternate method '.$last_message;
2708
  if(!isset($response['txId']))
2709
  $response['txId'] = '';
2710
- MO2f_Utility::set_user_values( $session_id, "mo2f_transactionId", $response['txId'] );
 
 
2711
  $this->mo2f_transactionid=$response['txId'];
2712
  $mo2fa_login_message = $message;
2713
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
@@ -2725,8 +2769,10 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2725
  function mo2fa_pass2login( $redirect_to = null, $session_id_encrypted=null ) {
2726
  global $Mo2fdbQueries;
2727
  if(empty($this->mo2f_userID)&&empty($this->fstfactor)){
2728
- $user_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_current_user_id', $session_id_encrypted );
2729
- $mo2f_1stfactor_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_1stfactor_status', $session_id_encrypted );
 
 
2730
  } else {
2731
  $user_id=$this->mo2f_userID;
2732
  $mo2f_1stfactor_status=$this->fstfactor;
@@ -2737,6 +2783,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2737
  wp_set_current_user( $user_id, $currentuser->user_login );
2738
  $mobile_login = new Miniorange_Mobile_Login();
2739
  $mobile_login->remove_current_activity($session_id_encrypted);
 
 
 
2740
  wp_set_auth_cookie( $user_id, true );
2741
  do_action( 'wp_login', $currentuser->user_login, $currentuser );
2742
  redirect_user_to( $currentuser, $redirect_to );
@@ -2789,8 +2838,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2789
  }
2790
 
2791
  }
2792
- MO2f_Utility::set_user_values($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID);
2793
- MO2f_Utility::set_user_values($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS');
 
2794
 
2795
  $this->mo2f_userID=$currentuser->ID;
2796
  $this->fstfactor='VALIDATE_SUCCESS';
@@ -2993,8 +3043,9 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
2993
  $response = json_decode( $content, true );
2994
  if(!MO2F_IS_ONPREM)
2995
  {
2996
- if(isset($response['txId']))
2997
- MO2f_Utility::set_user_values( $session_id_encrypt, "mo2f_transactionId", $response['txId'] );
 
2998
  }
2999
 
3000
  }
@@ -3104,13 +3155,11 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
3104
  $passcode = isset($_POST[ "mo2f_validate_otp_token" ]) ? $_POST[ "mo2f_validate_otp_token" ] : $_POST['mo_softtoken'];
3105
  if(!is_null($passcode) and !empty($passcode))
3106
  {
3107
- $passcode = sanitize_text_field($passcode);
3108
- $this->miniorange_pass2login_start_session();
3109
- $session_id_encrypt=$this->create_session();
3110
-
3111
-
3112
- MO2f_Utility::set_user_values($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID);
3113
- MO2f_Utility::set_user_values($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS');
3114
 
3115
  $customer = new Customer_Setup();
3116
  if($mo2f_configured_2FA_method == 'miniOrange Soft Token')
@@ -3123,7 +3172,7 @@ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
3123
  if(strcasecmp($content['status'], 'SUCCESS') == 0) {
3124
  $redirect_to = isset($_POST[ 'redirect_to' ]) ? esc_url_raw($_POST[ 'redirect_to' ]) : null;
3125
 
3126
- $this->mo2fa_pass2login($redirect_to);
3127
  }
3128
  else
3129
  {
36
  $password = sanitize_text_field( $_POST['password'] );
37
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
38
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
39
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
40
  if( $moWpnsUtility->check_empty_or_null( $email ) || $moWpnsUtility->check_empty_or_null( $password ) )
41
  {
42
  $login_message=MoWpnsMessages::showMessage('REQUIRED_FIELDS');
53
  $password = sanitize_text_field($_POST['password']);
54
  $confirmPassword = sanitize_text_field($_POST['confirmPassword']);
55
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
56
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
57
+
58
+
59
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
60
  if( strlen( $password ) < 6 || strlen( $confirmPassword ) < 6)
61
  {
115
  } else {
116
  $codes=explode(",", $backups);
117
  $session_id = sanitize_text_field($_POST['session_id']);
118
+ $id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id, 'mo2f_current_user_id');
119
+
120
+
121
  update_user_meta($id, 'mo_backup_code_downloaded', 1);
122
  delete_user_meta($id, 'chqwetcsdvnvd');
123
  MO2f_Utility::mo2f_download_backup_codes($id, $codes);
147
  }else {
148
  $this->miniorange_pass2login_start_session();
149
  $session_id_encrypt = isset($POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
 
150
  $redirect_to = isset($POSTED[ 'redirect_to' ]) ? esc_url_raw($POSTED[ 'redirect_to' ]) : null;
151
  $mo2fa_login_message = __('Please provide your backup codes.','miniorange-2-factor-authentication');
152
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
164
  return $error;
165
  } else {
166
  $this->miniorange_pass2login_start_session();
167
+ $currentuser_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
168
  $redirect_to = isset($POSTED[ 'redirect_to' ]) ? esc_url_raw($POSTED[ 'redirect_to' ]) : null;
169
+ if(isset($currentuser_id)){
170
  if(MO2f_Utility::mo2f_check_empty_or_null($POSTED[ 'mo2f_backup_code' ]) ){
171
  $mo2fa_login_message = __('Please provide backup code.','miniorange-2-factor-authentication');
172
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
197
  $result = wp_mail($mo2f_user_email,$subject,$message,$headers);
198
  }
199
 
200
+ $this->mo2fa_pass2login($redirect_to, $session_id_encrypt);
201
  }else{
202
  $mo2fa_login_message = __('The codes you have provided are either expired or incorrect.','miniorange-2-factor-authentication');
203
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
226
 
227
  $redirect_to = esc_url_raw($_POST['redirect_to']);
228
  $session_id = sanitize_text_field($_POST['session_id']);
229
+ $id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id, 'mo2f_current_user_id');
 
230
 
231
  $codes=MO2f_Utility::mo_2f_generate_backup_codes();
232
  $codes_hash=MO2f_Utility::mo2f_get_codes_hash($codes);
322
  } else{
323
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
324
  }
325
+ $current_user = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
326
 
327
 
 
328
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
329
  if($selected_2factor_method == 'OTP Over Whatsapp')
330
  {
461
  if(isset($_POST['verify_phone']))
462
  $phone = sanitize_text_field( $_POST['verify_phone'] );
463
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
464
+
465
+ $current_user = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
466
+
467
+
468
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
469
  $customer = new Customer_Setup();
470
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
672
  array_push($kba_q_a_list, $kba_answers[$c]);
673
  }
674
 
675
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
676
+
677
 
 
678
  $current_user = get_user_by('id',$user_id);
679
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
680
  $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
740
  $this->miniorange_pass2login_start_session();
741
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
742
  MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
743
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
744
+
745
+
746
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
747
  $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
748
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
837
  global $Mo2fdbQueries;
838
  $this->miniorange_pass2login_start_session();
839
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
840
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
 
841
 
842
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
843
  $current_user = get_user_by('id',$user_id);
848
  $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
849
  $miniorageqr = $this->mo2f_inline_get_qr_code_for_mobile($email,$current_user->ID);
850
  $mo2fa_login_message=$miniorageqr['message'];
851
+ MO2f_Utility::mo2f_set_transient( $session_id_encrypt,'mo2f_transactionId', $miniorageqr['mo2f-login-transactionId'] );
852
+
853
  $this->mo2f_transactionid=$miniorageqr['mo2f-login-transactionId'];
854
  }else{
855
  $mo2fa_login_message = __('Invalid request. Please register with miniOrange before configuring your mobile.','miniorange-2-factor-authentication');
871
  $this->miniorange_pass2login_start_session();
872
  $otpToken = sanitize_text_field($_POST['google_auth_code']);
873
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
874
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
875
+
876
+
877
  $current_user = get_user_by('id',$user_id);
878
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
879
+ $ga_secret = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'secret_ga');
880
+
 
 
881
  $mo2fa_login_message = '';
882
  $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
883
  if(MO2f_Utility::mo2f_check_number_length($otpToken)){
933
  } else {
934
  global $Mo2fdbQueries;
935
  $this->miniorange_pass2login_start_session();
936
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
937
+
938
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
939
+
940
+
941
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
942
  $current_user = get_user_by('id',$user_id);
943
  $Mo2fdbQueries->update_user_details( $current_user->ID, array( "mo2f_configured_2FA_method" => '' ) );
1026
  return $error;
1027
  }
1028
  else{
1029
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1030
+ global $Mo2fdbQueries;
1031
+ $redirect_to = esc_url_raw($_POST['redirect_to']);
1032
+ $session_id_encrypt = sanitize_text_field($session_id_encrypt);
1033
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1034
+
1035
+
1036
+ $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_2factor_enable_2fa_byusers' => 0) );
1037
+
1038
+ $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
1039
  }
1040
  }
1041
  }
1054
  global $Mo2fdbQueries;
1055
  $this->miniorange_pass2login_start_session();
1056
  $mo2fa_login_message = '';
1057
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1058
+
1059
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1060
+
1061
+
1062
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1063
  $current_user = get_user_by('id',$user_id);
1064
  $currentUserId = $current_user->ID;
1149
  $mo2f_google_auth = array();
1150
  $mo2f_google_auth['ga_qrCode'] = $url;
1151
  $mo2f_google_auth['ga_secret'] = $onpremise_secret;
1152
+
1153
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $onpremise_secret);
1154
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $url);
 
1155
 
1156
  }else{
1157
  $current_user = get_userdata($currentUserId);
1176
  if ( json_last_error() == JSON_ERROR_NONE ) {
1177
  if ( $google_response['status'] == 'SUCCESS' ) {
1178
 
1179
+ $mo2f_google_auth = array();
1180
+ $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
1181
+ $mo2f_google_auth['ga_secret'] = $google_response['secret'];
1182
+
1183
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $mo2f_google_auth['ga_secret']);
1184
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $mo2f_google_auth['ga_qrCode']);
 
1185
 
1186
  } else {
1187
  $mo2fa_login_message = __( 'Invalid request. Please register with miniOrange to configure 2 Factor plugin.', 'miniorange-2-factor-authentication' );
1245
  }else{
1246
  $this->miniorange_pass2login_start_session();
1247
  $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1248
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1249
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1250
  if ( isset( $user_id ) ) {
1251
  if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_2'] ) ) {
1254
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1255
  }
1256
  $otpToken = array();
1257
+ $kba_questions = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo_2_factor_kba_questions' );
1258
  $otpToken[0] = $kba_questions[0]['question'];
1259
  $otpToken[1] = sanitize_text_field( $_POST['mo2f_answer_1'] );
1260
  $otpToken[2] = $kba_questions[1]['question'];
1315
  $this->miniorange_pass2login_start_session();
1316
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1317
  try {
1318
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1319
  Global $Mo2fdbQueries;
1320
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1321
  $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
1359
  $mo2fa_login_message = '';
1360
  $this->miniorange_pass2login_start_session();
1361
  $customer = new Customer_Setup();
1362
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1363
  Global $Mo2fdbQueries;
1364
  $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1365
  $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1399
  } else {
1400
  $this->miniorange_pass2login_start_session();
1401
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1402
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1403
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1404
  $this->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1405
  }
1428
  $this->miniorange_pass2login_start_session();
1429
  $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1430
  //if the php session folder has insufficient permissions, cookies to be used
1431
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1432
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1433
  $checkMobileStatus = new Two_Factor_Setup();
1434
  $content = $checkMobileStatus->check_mobile_status( $mo2f_login_transaction_id );
1483
  $mo2fa_login_message = '';
1484
  $this->miniorange_pass2login_start_session();
1485
  $customer = new Customer_Setup();
1486
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1487
  $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1488
  $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1489
  if ( $kba_configuration_status ) {
1546
  $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1547
  $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1548
  $softtoken = '';
1549
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1550
  $attempts = get_option('mo2f_attempts_before_redirect', 3);
1551
  if ( MO2f_utility::mo2f_check_empty_or_null( $_POST['mo2fa_softtoken'] ) ) {
1552
  if($attempts>1 || $attempts=='disabled')
1588
  $content = '';
1589
  $current_user = get_userdata($user_id);
1590
  //if the php session folder has insufficient permissions, cookies to be used
1591
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1592
 
1593
  if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ) {
1594
  $content = json_decode( $customer->validate_otp_token( 'EMAIL', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ),$current_user ), true );
1721
  return $error;
1722
  } else {
1723
  $this->miniorange_pass2login_start_session();
1724
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1725
  $currentuser = get_user_by( 'id', $user_id );
1726
  $attributes = isset( $POSTED['miniorange_rba_attribures'] ) ? $POSTED['miniorange_rba_attribures'] : null;
1727
  $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1767
  if ( username_exists( $username ) ) { /*if username exists in wp site */
1768
  $user = new WP_User( $username );
1769
  $redirect_to = isset( $_REQUEST['redirect_to'] ) ? esc_url_raw($_REQUEST['redirect_to']) : null;
1770
+
1771
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_current_user_id', $user->ID, 600);
1772
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
1773
+
1774
+
1775
  $this->mo2f_userId=$user->ID;
1776
  $this->fstfactor='VALIDATE_SUCCESS';
1777
  $current_roles = miniorange_get_user_role( $user );
2175
  $mo2fa_login_message = 'Please answer the following questions:';
2176
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2177
  $mo2f_kbaquestions = $questions;
2178
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2179
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2180
  }
2181
 
2190
  $questions = array();
2191
  $questions[0] = $response['questions'][0];
2192
  $questions[1] = $response['questions'][1];
2193
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2194
  $this->mo2f_kbaquestions=$questions;
2195
  $mo2fa_login_message = 'Please answer the following questions:';
2196
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2218
  $login_message = $mo2fa_login_message;
2219
  switch ($login_status) {
2220
  case 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION':
2221
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2222
  mo2f_get_qrcode_authentication_prompt( $login_status, $login_message, $redirect_to, $qrCode, $session_id_encrypt, $transactionid );
2223
  exit;
2224
  break;
2225
  case 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN':
2226
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2227
+
2228
+
2229
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2230
  exit;
2231
  break;
2232
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL':
2233
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2234
+
2235
  mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id,$show_back_button );
2236
  exit;
2237
  break;
2238
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM':
2239
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2240
+
2241
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2242
  exit;
2243
  break;
2244
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP':
2245
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2246
+
2247
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2248
  exit;
2249
  break;
2250
  case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS':
2251
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2252
+
2253
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2254
  exit;
2255
  break;
2256
  case 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION':
2257
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2258
+
2259
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2260
  exit;
2261
  break;
2262
  case 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION':
2263
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2264
+
2265
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2266
  exit;
2267
  break;
2268
  case 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL':
2271
  break;
2272
 
2273
  case 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS':
2274
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_transactionId' );
2275
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2276
+
2277
+ mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2278
  exit;
2279
  break;
2280
 
2281
  case 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL':
2282
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2283
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2284
+
2285
+ mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2286
  exit;
2287
  break;
2288
 
2289
  case 'MO_2_FACTOR_RECONFIG_GOOGLE':
2290
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2291
+
2292
+ $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_google' );
2293
  exit;
2294
  break;
2295
 
2296
  case 'MO_2_FACTOR_RECONFIG_KBA':
2297
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2298
+
2299
+ $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_kba' );
2300
  exit;
2301
  break;
2302
 
2303
  case 'MO_2_FACTOR_SETUP_SUCCESS':
2304
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2305
+
2306
+ $this->mo2f_inline_setup_success($user_id,$redirect_to,$session_id_encrypt);
2307
  break;
2308
 
2309
  case 'MO_2_FACTOR_GENERATE_BACKUP_CODES':
2310
+ $current_user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2311
+
2312
+ mo2f_backup_codes_generate($current_user_id, $redirect_to, $session_id_encrypt);
2313
  exit;
2314
 
2315
  case 'MO_2_FACTOR_CHALLENGE_BACKUP':
2317
  exit;
2318
 
2319
  case 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION':
2320
+
2321
+ if(MO2F_IS_ONPREM){
2322
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2323
+
2324
+ $ques = get_user_meta( $user_id, 'kba_questions_user');
2325
+ mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $ques[0] );
2326
+ }
2327
+ else{
2328
+ $kbaquestions = $this->mo2f_kbaquestions ? $this->mo2f_kbaquestions : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo_2_factor_kba_questions');
2329
  mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $kbaquestions );
2330
  }
2331
  exit;
2337
  break;
2338
 
2339
  case 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS':
2340
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2341
+
2342
+ prompt_user_to_select_2factor_mthod_inline($user_id, $login_status, $login_message,$redirect_to,$session_id_encrypt,$qrCode);
2343
  exit;
2344
  break;
2345
 
2504
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2505
  if ( $response['status'] == 'SUCCESS' ) {
2506
  $qrCode = $response['qrCode'];
2507
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionId', $response['txId']);
2508
+
2509
+
2510
  $this->mo2f_transactionid=$response['txId'];
2511
  $mo2fa_login_message = '';
2512
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
2548
  $response = json_decode( $content, true );
2549
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2550
  if ( $response['status'] == 'SUCCESS' ) {
2551
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2552
+ update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2553
+
2554
+
2555
  $this->mo2f_transactionid=$response['txId'];
2556
 
2557
  $mo2fa_login_message = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'A Push Notification has been sent to your phone. We are waiting for your approval.' : 'An email has been sent to ' . MO2f_Utility::mo2f_get_hidden_email( $user_email ) . '. We are waiting for your approval.';
2558
  $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2559
  $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
2560
  } else if ( $response['status'] == 'ERROR' || $response['status'] == 'FAILED' ) {
2561
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2562
+ update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2563
+
2564
+
2565
  $this->mo2f_transactionid=$response['txId'];
2566
  $mo2fa_login_message = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'An error occured while sending push notification to your app. You can click on <b>Phone is Offline</b> button to enter soft token from app or <b>Forgot your phone</b> button to receive OTP to your registered email.' : 'An error occured while sending email. Please try again.';
2567
  $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2718
  $response['phoneDelivery']['contact'] = '';
2719
  $message = 'The OTP has been sent to ' . MO2f_Utility::get_hidden_phone( $response['phoneDelivery']['contact'] ) . '. Please enter the OTP you received to Validate.';
2720
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2721
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2722
+
2723
+
2724
  $this->mo2f_transactionid=$response['txId'];
2725
  $mo2fa_login_message = $message;
2726
  $currentMethod = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
2749
  $message = $response['message'] . ' You can click on <a href="https://faq.miniorange.com/knowledgebase/i-am-locked-cant-access-my-account-what-do-i-do/">I am locked out</a> to login via alternate method '.$last_message;
2750
  if(!isset($response['txId']))
2751
  $response['txId'] = '';
2752
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2753
+
2754
+
2755
  $this->mo2f_transactionid=$response['txId'];
2756
  $mo2fa_login_message = $message;
2757
  $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
2769
  function mo2fa_pass2login( $redirect_to = null, $session_id_encrypted=null ) {
2770
  global $Mo2fdbQueries;
2771
  if(empty($this->mo2f_userID)&&empty($this->fstfactor)){
2772
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypted, 'mo2f_current_user_id');
2773
+ $mo2f_1stfactor_status = MO2f_Utility::mo2f_get_transient( $session_id_encrypted, 'mo2f_1stfactor_status' );
2774
+
2775
+
2776
  } else {
2777
  $user_id=$this->mo2f_userID;
2778
  $mo2f_1stfactor_status=$this->fstfactor;
2783
  wp_set_current_user( $user_id, $currentuser->user_login );
2784
  $mobile_login = new Miniorange_Mobile_Login();
2785
  $mobile_login->remove_current_activity($session_id_encrypted);
2786
+
2787
+ delete_expired_transients( true );
2788
+
2789
  wp_set_auth_cookie( $user_id, true );
2790
  do_action( 'wp_login', $currentuser->user_login, $currentuser );
2791
  redirect_user_to( $currentuser, $redirect_to );
2838
  }
2839
 
2840
  }
2841
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
2842
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
2843
+
2844
 
2845
  $this->mo2f_userID=$currentuser->ID;
2846
  $this->fstfactor='VALIDATE_SUCCESS';
3043
  $response = json_decode( $content, true );
3044
  if(!MO2F_IS_ONPREM)
3045
  {
3046
+ if(isset($response['txId'])){
3047
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionid', $response['txId']);
3048
+ }
3049
  }
3050
 
3051
  }
3155
  $passcode = isset($_POST[ "mo2f_validate_otp_token" ]) ? $_POST[ "mo2f_validate_otp_token" ] : $_POST['mo_softtoken'];
3156
  if(!is_null($passcode) and !empty($passcode))
3157
  {
3158
+ $passcode = sanitize_text_field($passcode);
3159
+ $this->miniorange_pass2login_start_session();
3160
+ $session_id_encrypt=$this->create_session();
3161
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
3162
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
 
 
3163
 
3164
  $customer = new Customer_Setup();
3165
  if($mo2f_configured_2FA_method == 'miniOrange Soft Token')
3172
  if(strcasecmp($content['status'], 'SUCCESS') == 0) {
3173
  $redirect_to = isset($_POST[ 'redirect_to' ]) ? esc_url_raw($_POST[ 'redirect_to' ]) : null;
3174
 
3175
+ $this->mo2fa_pass2login($redirect_to, $session_id_encrypt);
3176
  }
3177
  else
3178
  {
handler/twofa/two_fa_settings.php CHANGED
@@ -1313,7 +1313,7 @@ class Miniorange_Authentication {
1313
 
1314
  return $error;
1315
  } else {
1316
-
1317
  $twofactor_transactions = new Mo2fDB;
1318
  $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($user_id);
1319
 
@@ -1330,7 +1330,7 @@ class Miniorange_Authentication {
1330
  'MO_2_FACTOR_PLUGIN_SETTINGS'
1331
  ) ) ) {
1332
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1333
- $this->mo2f_get_qr_code_for_mobile( $email, $user->ID );
1334
 
1335
  } else {
1336
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "REGISTER_WITH_MO" ) );
@@ -1572,9 +1572,7 @@ class Miniorange_Authentication {
1572
  } else {
1573
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
1574
  }
1575
-
1576
- //if the php session folder has insufficient permissions, temporary options to be used
1577
- $mo2f_transactionId = isset( $_SESSION['mo2f_transactionId'] ) && ! empty( $_SESSION['mo2f_transactionId'] ) ? $_SESSION['mo2f_transactionId'] : get_option( 'mo2f_transactionId' );
1578
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1579
  $selected_2_2factor_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1580
  $customer = new Customer_Setup();
@@ -1740,11 +1738,9 @@ class Miniorange_Authentication {
1740
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1741
 
1742
  $customer = new Customer_Setup();
1743
- $txId = get_user_meta($user->ID,'Mo2fOtpOverEmailtxId');
1744
- if($txId == '' or empty($txId))
1745
- $txId = $_SESSION['mo2f_transactionId'];
1746
 
1747
- $content = json_decode( $customer->validate_otp_token( 'OTP_OVER_EMAIL', $email, $txId, $otp_token, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
 
1748
  if ( json_last_error() == JSON_ERROR_NONE ) {
1749
 
1750
  if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) { //Google OTP validated
@@ -1832,7 +1828,6 @@ class Miniorange_Authentication {
1832
 
1833
  update_user_meta( $user->ID, 'mo2f_external_app_type', "Google Authenticator" );
1834
  mo2f_display_test_2fa_notification($user);
1835
- // unset($_SESSION['secret_ga']);
1836
  delete_user_meta($user->ID, 'mo2f_google_auth');
1837
 
1838
  } else {
@@ -2069,7 +2064,6 @@ class Miniorange_Authentication {
2069
  $kba_ans_2 = sanitize_text_field( $_POST['mo2f_answer_2'] );
2070
  }
2071
  //if the php session folder has insufficient permissions, temporary options to be used
2072
- // $kba_questions = isset( $_SESSION['mo_2_factor_kba_questions'] ) && ! empty( $_SESSION['mo_2_factor_kba_questions'] ) ? $_SESSION['mo_2_factor_kba_questions'] : get_option( 'kba_questions' );
2073
  $kba_questions = get_user_meta($user->ID, 'mo_2_factor_kba_questions', true);
2074
 
2075
  $kbaAns = array();
@@ -2080,14 +2074,11 @@ class Miniorange_Authentication {
2080
  $kbaAns[3] = $kba_ans_2;
2081
  }
2082
  //if the php session folder has insufficient permissions, temporary options to be used
2083
- // $mo2f_transactionId = isset( $_SESSION['mo2f_transactionId'] ) && ! empty( $_SESSION['mo2f_transactionId'] ) ? $_SESSION['mo2f_transactionId'] : get_option( 'mo2f_transactionId' );
2084
  $mo2f_transactionId = get_option('mo2f_transactionId');
2085
  $kba_validate = new Customer_Setup();
2086
  $kba_validate_response = json_decode( $kba_validate->validate_otp_token( 'KBA', null, $mo2f_transactionId, $kbaAns, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
2087
  if ( json_last_error() == JSON_ERROR_NONE ) {
2088
  if ( strcasecmp( $kba_validate_response['status'], 'SUCCESS' ) == 0 ) {
2089
- // unset( $_SESSION['mo_2_factor_kba_questions'] );
2090
- // unset( $_SESSION['mo2f_transactionId'] );
2091
  delete_option('mo2f_transactionId');
2092
  delete_option('kba_questions');
2093
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "COMPLETED_TEST" ) );
@@ -2256,7 +2247,8 @@ class Miniorange_Authentication {
2256
  }
2257
 
2258
  $phone = str_replace( ' ', '', $phone );
2259
- $_SESSION['user_phone'] = $phone;
 
2260
  update_option( 'user_phone_temp', $phone );
2261
  $customer = new Customer_Setup();
2262
  $currentMethod = "SMS";
@@ -2268,7 +2260,9 @@ class Miniorange_Authentication {
2268
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( $content['message'] ) );
2269
  $this->mo_auth_show_error_message();
2270
  } else if ( $content['status'] == 'SUCCESS' ) {
2271
- $_SESSION['mo2f_transactionId'] = $content['txId'];
 
 
2272
  update_option( 'mo2f_transactionId', $content['txId'] );
2273
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "OTP_SENT" ) . ' ' . $phone . ' .' . Mo2fConstants:: langTranslate( "ENTER_OTP" ) );
2274
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
@@ -2466,12 +2460,11 @@ class Miniorange_Authentication {
2466
  return;
2467
  } else {
2468
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
 
2469
  }
 
2470
 
2471
- //if the php session folder has insufficient permissions, temporary options to be used
2472
- $mo2f_transactionId = isset( $_SESSION['mo2f_transactionId'] ) && ! empty( $_SESSION['mo2f_transactionId'] ) ? $_SESSION['mo2f_transactionId'] : get_option( 'mo2f_transactionId' );
2473
- $user_phone = isset( $_SESSION['user_phone'] ) && $_SESSION['user_phone'] != 'false' ? $_SESSION['user_phone'] : get_option( 'user_phone_temp' );
2474
- //$mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
2475
  $mo2f_configured_2FA_method = get_user_meta( $user->ID, 'mo2f_2FA_method_to_configure', true );
2476
  $phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
2477
  $customer = new Customer_Setup();
@@ -2528,7 +2521,7 @@ class Miniorange_Authentication {
2528
  delete_user_meta( $user->ID, 'configure_2FA' );
2529
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
2530
 
2531
- unset( $_SESSION['user_phone'] );
2532
  MO2f_Utility::unset_session_variables( 'user_phone' );
2533
  delete_option( 'user_phone_temp' );
2534
 
@@ -2809,15 +2802,12 @@ class Miniorange_Authentication {
2809
 
2810
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate KBA Questions*/
2811
  if ( $response['status'] == 'SUCCESS' ) {
2812
- $_SESSION['mo2f_transactionId'] = $response['txId'];
2813
  update_option( 'mo2f_transactionId', $response['txId'] );
2814
  $questions = array();
2815
 
2816
  $questions[0] = $response['questions'][0];
2817
  $questions[1] = $response['questions'][1];
2818
- // $_SESSION['mo_2_factor_kba_questions'] = $questions;
2819
  update_user_meta($user->ID, 'mo_2_factor_kba_questions', $questions);
2820
- // update_option( 'kba_questions', $questions );
2821
 
2822
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ANSWER_SECURITY_QUESTIONS" ) );
2823
  $this->mo_auth_show_success_message();
@@ -2843,10 +2833,10 @@ class Miniorange_Authentication {
2843
 
2844
  } else {
2845
  if ( $response['status'] == 'SUCCESS' ) {
2846
- $_SESSION['mo2f_transactionId'] = $response['txId'];
2847
- update_option( 'mo2f_transactionId', $response['txId'] );
2848
- $_SESSION['mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
2849
- update_option( 'mo2f_transactionId', $response['txId'] );
2850
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "PUSH_NOTIFICATION_SENT" ) );
2851
  $this->mo_auth_show_success_message();
2852
 
@@ -2990,8 +2980,7 @@ class Miniorange_Authentication {
2990
  }
2991
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "OTP_SENT" ) . ' <b>' . ( $phone ) . '</b>. ' . Mo2fConstants:: langTranslate( "ENTER_OTP" ) );
2992
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2993
-
2994
- $_SESSION['mo2f_transactionId'] = $response['txId'];
2995
  update_option( 'mo2f_transactionId', $response['txId'] );
2996
  $this->mo_auth_show_success_message();
2997
 
@@ -3015,16 +3004,15 @@ class Miniorange_Authentication {
3015
 
3016
  } else {
3017
  if ( $response['status'] == 'SUCCESS' ) {
3018
- $_SESSION['mo2f_qrCode'] = $response['qrCode'];
3019
- $_SESSION['mo2f_transactionId'] = $response['txId'];
3020
- $_SESSION['mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
 
 
3021
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "SCAN_QR_CODE" ) );
3022
  $this->mo_auth_show_success_message();
3023
 
3024
  } else {
3025
- unset( $_SESSION['mo2f_qrCode'] );
3026
- unset( $_SESSION['mo2f_transactionId'] );
3027
- unset( $_SESSION['mo2f_show_qr_code'] );
3028
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
3029
  $this->mo_auth_show_error_message();
3030
 
@@ -3068,9 +3056,6 @@ class Miniorange_Authentication {
3068
  delete_user_meta( $user->ID, 'test_2FA' );
3069
  delete_user_meta( $user->ID, 'configure_2FA' );
3070
 
3071
- // if(isset($_SESSION['secret_ga'])){
3072
- // unset($_SESSION['secret_ga']);
3073
- // }
3074
  }
3075
  }
3076
 
@@ -3312,7 +3297,6 @@ class Miniorange_Authentication {
3312
  $mo2f_google_auth = array();
3313
  $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
3314
  $mo2f_google_auth['ga_secret'] = $google_response['secret'];
3315
- // $_SESSION['mo2f_google_auth'] = $mo2f_google_auth;
3316
  update_user_meta($user->ID, 'mo2f_google_auth', $mo2f_google_auth);
3317
  }else {
3318
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_USER_REGISTRATION" ) );
@@ -3398,7 +3382,7 @@ class Miniorange_Authentication {
3398
  }
3399
  }
3400
 
3401
- function mo2f_get_qr_code_for_mobile( $email, $id ) {
3402
 
3403
  $registerMobile = new Two_Factor_Setup();
3404
  $content = $registerMobile->register_mobile( $email );
@@ -3415,10 +3399,12 @@ class Miniorange_Authentication {
3415
  } else {
3416
  if ( $response['status'] == 'IN_PROGRESS' ) {
3417
  update_option( 'mo2f_message', Mo2fConstants::langTranslate( "SCAN_QR_CODE" ) );
3418
- $_SESSION['mo2f_qrCode'] = $response['qrCode'];
3419
- $_SESSION['mo2f_transactionId'] = $response['txId'];
3420
- update_option( 'mo2f_transactionId', $response['txId'] );
3421
- $_SESSION['mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
 
 
3422
  $this->mo_auth_show_success_message();
3423
  } else {
3424
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
@@ -3500,8 +3486,12 @@ class Miniorange_Authentication {
3500
  }
3501
  $otpTokenH = hash('sha512',$otpToken);
3502
  $otpTokenDH = hash('sha512', $otpTokenD);
3503
- $_SESSION['txid'] = $txid;
3504
- $_SESSION['otpToken'] = $otpToken;
 
 
 
 
3505
  $userID = hash('sha512',$current_user->ID);
3506
  update_site_option($userID,$otpTokenH);
3507
  update_site_option($txid,3);
@@ -3563,12 +3553,13 @@ class Miniorange_Authentication {
3563
  $this->mo_auth_show_error_message();
3564
  } else {
3565
  if ( $response['status'] == 'SUCCESS' ) {
3566
- $_SESSION['mo2f_transactionId'] = $response['txId'];
 
 
3567
  update_option( 'mo2f_transactionId', $response['txId'] );
3568
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "VERIFICATION_EMAIL_SENT" ) . '<b> ' . $email . '</b>. ' . Mo2fConstants:: langTranslate( "ACCEPT_LINK_TO_VERIFY_EMAIL" ) );
3569
  $this->mo_auth_show_success_message();
3570
  } else {
3571
- unset( $_SESSION['mo2f_transactionId'] );
3572
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
3573
  $this->mo_auth_show_error_message();
3574
  }
1313
 
1314
  return $error;
1315
  } else {
1316
+ $session_id = sanitize_text_field($_POST['mo2f_session_id']);
1317
  $twofactor_transactions = new Mo2fDB;
1318
  $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($user_id);
1319
 
1330
  'MO_2_FACTOR_PLUGIN_SETTINGS'
1331
  ) ) ) {
1332
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1333
+ $this->mo2f_get_qr_code_for_mobile( $email, $user->ID, $session_id );
1334
 
1335
  } else {
1336
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "REGISTER_WITH_MO" ) );
1572
  } else {
1573
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
1574
  }
1575
+ $mo2f_transactionId = get_user_meta($user->ID, 'mo2f_transactionId', true);
 
 
1576
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1577
  $selected_2_2factor_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1578
  $customer = new Customer_Setup();
1738
  $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1739
 
1740
  $customer = new Customer_Setup();
 
 
 
1741
 
1742
+ $mo2f_transactionId = get_user_meta($user->ID, 'mo2f_transactionId', true);
1743
+ $content = json_decode( $customer->validate_otp_token( 'OTP_OVER_EMAIL', $email, $mo2f_transactionId, $otp_token, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1744
  if ( json_last_error() == JSON_ERROR_NONE ) {
1745
 
1746
  if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) { //Google OTP validated
1828
 
1829
  update_user_meta( $user->ID, 'mo2f_external_app_type', "Google Authenticator" );
1830
  mo2f_display_test_2fa_notification($user);
 
1831
  delete_user_meta($user->ID, 'mo2f_google_auth');
1832
 
1833
  } else {
2064
  $kba_ans_2 = sanitize_text_field( $_POST['mo2f_answer_2'] );
2065
  }
2066
  //if the php session folder has insufficient permissions, temporary options to be used
 
2067
  $kba_questions = get_user_meta($user->ID, 'mo_2_factor_kba_questions', true);
2068
 
2069
  $kbaAns = array();
2074
  $kbaAns[3] = $kba_ans_2;
2075
  }
2076
  //if the php session folder has insufficient permissions, temporary options to be used
 
2077
  $mo2f_transactionId = get_option('mo2f_transactionId');
2078
  $kba_validate = new Customer_Setup();
2079
  $kba_validate_response = json_decode( $kba_validate->validate_otp_token( 'KBA', null, $mo2f_transactionId, $kbaAns, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
2080
  if ( json_last_error() == JSON_ERROR_NONE ) {
2081
  if ( strcasecmp( $kba_validate_response['status'], 'SUCCESS' ) == 0 ) {
 
 
2082
  delete_option('mo2f_transactionId');
2083
  delete_option('kba_questions');
2084
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "COMPLETED_TEST" ) );
2247
  }
2248
 
2249
  $phone = str_replace( ' ', '', $phone );
2250
+ $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
2251
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'user_phone', $phone);
2252
  update_option( 'user_phone_temp', $phone );
2253
  $customer = new Customer_Setup();
2254
  $currentMethod = "SMS";
2260
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( $content['message'] ) );
2261
  $this->mo_auth_show_error_message();
2262
  } else if ( $content['status'] == 'SUCCESS' ) {
2263
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionId', $content['txId']);
2264
+
2265
+
2266
  update_option( 'mo2f_transactionId', $content['txId'] );
2267
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "OTP_SENT" ) . ' ' . $phone . ' .' . Mo2fConstants:: langTranslate( "ENTER_OTP" ) );
2268
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2460
  return;
2461
  } else {
2462
  $otp_token = sanitize_text_field( $_POST['otp_token'] );
2463
+ $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
2464
  }
2465
+ $mo2f_transactionId = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_transactionId' );
2466
 
2467
+ $user_phone = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'user_phone' );
 
 
 
2468
  $mo2f_configured_2FA_method = get_user_meta( $user->ID, 'mo2f_2FA_method_to_configure', true );
2469
  $phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
2470
  $customer = new Customer_Setup();
2521
  delete_user_meta( $user->ID, 'configure_2FA' );
2522
  delete_user_meta( $user->ID, 'mo2f_2FA_method_to_configure' );
2523
 
2524
+
2525
  MO2f_Utility::unset_session_variables( 'user_phone' );
2526
  delete_option( 'user_phone_temp' );
2527
 
2802
 
2803
  if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate KBA Questions*/
2804
  if ( $response['status'] == 'SUCCESS' ) {
 
2805
  update_option( 'mo2f_transactionId', $response['txId'] );
2806
  $questions = array();
2807
 
2808
  $questions[0] = $response['questions'][0];
2809
  $questions[1] = $response['questions'][1];
 
2810
  update_user_meta($user->ID, 'mo_2_factor_kba_questions', $questions);
 
2811
 
2812
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ANSWER_SECURITY_QUESTIONS" ) );
2813
  $this->mo_auth_show_success_message();
2833
 
2834
  } else {
2835
  if ( $response['status'] == 'SUCCESS' ) {
2836
+ update_user_meta($user->ID, 'mo2f_transactionId', $response['txId']);
2837
+ update_user_meta($user->ID, 'mo2f_show_qr_code', 'MO_2_FACTOR_SHOW_QR_CODE');
2838
+
2839
+
2840
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "PUSH_NOTIFICATION_SENT" ) );
2841
  $this->mo_auth_show_success_message();
2842
 
2980
  }
2981
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "OTP_SENT" ) . ' <b>' . ( $phone ) . '</b>. ' . Mo2fConstants:: langTranslate( "ENTER_OTP" ) );
2982
  update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2983
+ update_user_meta($user->ID, 'mo2f_transactionId', $response['txId']);
 
2984
  update_option( 'mo2f_transactionId', $response['txId'] );
2985
  $this->mo_auth_show_success_message();
2986
 
3004
 
3005
  } else {
3006
  if ( $response['status'] == 'SUCCESS' ) {
3007
+ update_user_meta($user->ID, 'mo2f_qrCode', $response['qrCode']);
3008
+ update_user_meta($user->ID, 'mo2f_transactionId', $response['txId']);
3009
+ update_user_meta($user->ID, 'mo2f_show_qr_code', 'MO_2_FACTOR_SHOW_QR_CODE');
3010
+
3011
+
3012
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "SCAN_QR_CODE" ) );
3013
  $this->mo_auth_show_success_message();
3014
 
3015
  } else {
 
 
 
3016
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
3017
  $this->mo_auth_show_error_message();
3018
 
3056
  delete_user_meta( $user->ID, 'test_2FA' );
3057
  delete_user_meta( $user->ID, 'configure_2FA' );
3058
 
 
 
 
3059
  }
3060
  }
3061
 
3297
  $mo2f_google_auth = array();
3298
  $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
3299
  $mo2f_google_auth['ga_secret'] = $google_response['secret'];
 
3300
  update_user_meta($user->ID, 'mo2f_google_auth', $mo2f_google_auth);
3301
  }else {
3302
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_USER_REGISTRATION" ) );
3382
  }
3383
  }
3384
 
3385
+ function mo2f_get_qr_code_for_mobile( $email, $id, $session_id = null ) {
3386
 
3387
  $registerMobile = new Two_Factor_Setup();
3388
  $content = $registerMobile->register_mobile( $email );
3399
  } else {
3400
  if ( $response['status'] == 'IN_PROGRESS' ) {
3401
  update_option( 'mo2f_message', Mo2fConstants::langTranslate( "SCAN_QR_CODE" ) );
3402
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_qrCode', $response['qrCode']);
3403
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
3404
+ update_user_meta($id, 'mo2f_transactionId', $response['txId']);
3405
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_show_qr_code', 'MO_2_FACTOR_SHOW_QR_CODE');
3406
+
3407
+
3408
  $this->mo_auth_show_success_message();
3409
  } else {
3410
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
3486
  }
3487
  $otpTokenH = hash('sha512',$otpToken);
3488
  $otpTokenDH = hash('sha512', $otpTokenD);
3489
+
3490
+
3491
+ update_user_meta($current_user->ID, 'mo2f_transactionId', $txid);
3492
+ update_user_meta($current_user->ID, 'otpToken', $otpToken);
3493
+
3494
+
3495
  $userID = hash('sha512',$current_user->ID);
3496
  update_site_option($userID,$otpTokenH);
3497
  update_site_option($txid,3);
3553
  $this->mo_auth_show_error_message();
3554
  } else {
3555
  if ( $response['status'] == 'SUCCESS' ) {
3556
+ update_user_meta($current_user->ID, 'mo2f_transactionId', $response['txId']);
3557
+
3558
+
3559
  update_option( 'mo2f_transactionId', $response['txId'] );
3560
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "VERIFICATION_EMAIL_SENT" ) . '<b> ' . $email . '</b>. ' . Mo2fConstants:: langTranslate( "ACCEPT_LINK_TO_VERIFY_EMAIL" ) );
3561
  $this->mo_auth_show_success_message();
3562
  } else {
 
3563
  update_option( 'mo2f_message', Mo2fConstants:: langTranslate( "ERROR_DURING_PROCESS" ) );
3564
  $this->mo_auth_show_error_message();
3565
  }
handler/twofa/two_fa_utility.php CHANGED
@@ -231,6 +231,15 @@ class MO2f_Utility {
231
 
232
  }
233
 
 
 
 
 
 
 
 
 
 
234
  /**
235
  * The function returns the session variables, and if not, retrieves the cookie values set in case the right permissions are not aassigned for the sessions folder in the server.
236
  *
231
 
232
  }
233
 
234
+ public static function mo2f_set_transient( $session_id, $key, $value, $expiration = 300 ) {
235
+ set_transient($session_id.$key, $value, $expiration);
236
+ }
237
+
238
+ public static function mo2f_get_transient( $session_id, $key) {
239
+ $transient_value = get_transient($session_id.$key);
240
+ return $transient_value;
241
+ }
242
+
243
  /**
244
  * The function returns the session variables, and if not, retrieves the cookie values set in case the right permissions are not aassigned for the sessions folder in the server.
245
  *
includes/images/christmas_offer.PNG DELETED
Binary file
includes/images/santa-gif.gif DELETED
Binary file
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/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 3 User in the free version of the plugin.
6
- * Version: 5.4.31
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * Text Domain: miniorange-2-factor-authentication
@@ -15,7 +15,7 @@
15
 
16
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
17
 
18
- define( 'MO2F_VERSION', '5.4.31' );
19
  define('MO2F_PLUGIN_URL', (plugin_dir_url(__FILE__)));
20
  define( 'MO2F_TEST_MODE', false );
21
  define( 'MO2F_IS_ONPREM', get_option('is_onprem'));
2
  /**
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
+ * Description: This TFA plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 3 User in the free version of the plugin.
6
+ * Version: 5.4.32
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * Text Domain: miniorange-2-factor-authentication
15
 
16
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
17
 
18
+ define( 'MO2F_VERSION', '5.4.32' );
19
  define('MO2F_PLUGIN_URL', (plugin_dir_url(__FILE__)));
20
  define( 'MO2F_TEST_MODE', false );
21
  define( 'MO2F_IS_ONPREM', get_option('is_onprem'));
readme.txt CHANGED
@@ -1,28 +1,28 @@
1
  === Google Authenticator - WordPress Two Factor Authentication (2FA , MFA) ===
2
 
3
  Contributors: cyberlord92, twofactor, hsn97
4
- Tags: google authenticator, two factor authentication, two factor, 2FA, two-step verification, mobile verification, OTP, mobile verification, two factor, Two step verification, TFA, MFA, 2 factor authentication, Remember Device, OTP,WordPress otp, two step authentication,Clef,SMS, email, signup security, two factor auth, Mobile Authentication, strong authentication, 2 step authentication, mobile verification,Multifactor authentication, passwordless login, one time passcode, soft token Authentication, QR Code Authentication, email verification, KBA, Security Questions,2FA, login OTP, login with SMS, mobile login, phone login, OTP login, mobile verification,knowledge based authentication,authy, authy two factor,yubico,Two-Factor Authentication,WordPress otp, security,user security, ​Twilio WordPress, SMS gateway, Solutions Infini, Clickatell, BulkSMS, MSG91, Nexmo, SMS Country, message, woocommerce, website security, login security, multi factor authentication, multi factor,wordfence, IP Blocking, IP Whitelisting, login Audits, woocommerce, SMS login, passwordless login, auth, login with OTP WordPress, OTP Over SMS and Email, two-step authentication, Mobile Authentication, passwordless login, login without password, passwordless authentication, secure login, temporary login, temporary access, one time passcode, email verification, security, website security, login security, multi-factor authentication, woocommerce, smartphone, WordPress otp, register with OTP, user OTP verification, SMS OTP, OTP Email, registration with OTP verification, registration verification,smartphone authentication
5
  Donate link: https://miniorange.com/
6
  Requires at least: 3.0.1
7
- Tested up to: 5.6
8
  Requires PHP: 5.3.0
9
- Stable tag: 5.4.31
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
- Google Authenticator, Two Factor Authentication (2 Factor), OTP verificaion - SMS and Email, Apps like Microsoft, Duo, LastPass & more on login and Registration for all forms. Google AUthenticator also Supports QR Code, Push Notification and Security Questions along with the Google Authenticator itself.
14
 
15
  == Description ==
16
 
17
- Google Authenticator - Two Factor Authentication (2FA) plugin provides a completely Secure login to your WordPress website. Google Authenticator- Two Factor Authentication (2FA) is a FREE, Simple & very easy to setup plugin. Google Authenticator provides two factor authentication (2FA, MFA) whenever login to your WordPress website ensuring no unauthorised access to your website. Google Authenticator can be configured for any TOTP based Authentication Method for providing addtional layer of security of Two Factor Authentication.
18
 
19
- = User Identity Verification or OTP Verification =
20
- Login and Registration: Verify users on login and Registration with different authentication methods like Google Authenticator, SMS Verification, Email, Authy Authenticator, Duo Authenticator, Microsoft Authenticator, TOTP Based Authenticator, Security Questions and many others. Easy OTP Verification with SMS Verification and Email Verification.
21
 
22
- = Google Authenticator and other 2 Factor ( 2FA ) sync on multiple websites =
23
  You would not need to configure Google Authenticator and other Two Factor Authentication ( 2FA ) methods from second site onword. Just login with miniOrange account and your 2FA will automatically get set. This is available for Google Authenticator, Duo Authenticator, Microsoft Authenticator, Securty Questions, LastPass, Authy, miniOrange methods, OTP over SMS, OTP over Email. It is supported only if you are using our cloud services of 2 Factor.
24
 
25
- == Plugin Integrations and Support for all methods of two factor like Google Authenticator ==
26
  * [Woocommerce](https://wordpress.org/plugins/woocommerce/) (Login Woocommerce using Google Authenticator - Two Factor Authentication (2FA))
27
  * [BuddyPress form](https://wordpress.org/plugins/buddypress/) (Login BuddyPress using Google Authenticator - Two Factor Authentication (2FA))
28
  * [bbpress form](https://wordpress.org/plugins/bbpress/) (Login bbpress using Google Authenticator - Two Factor Authentication (2FA))
@@ -45,7 +45,7 @@ You would not need to configure Google Authenticator and other Two Factor Authen
45
  * [RegistrationMagic – Custom Registration Forms](https://wordpress.org/plugins/custom-registration-form-builder-with-submission-manager/) (Register and Login RegistrationMagic – Custom Registration using Google Authenticator - Two Factor Authentication (2FA))
46
  * And many more
47
 
48
- = Third Party Custom SMS Gateway =
49
  Premium plugin supports any third party custom SMS Gateway. If you don't have your own SMS gateway you can use miniOrange gateway. Send SMS all over the world.
50
  * Some Famous Gateways Supported:
51
  * Twilio : [Twilio](https://www.twilio.com/)
@@ -57,33 +57,34 @@ Premium plugin supports any third party custom SMS Gateway. If you don't have yo
57
 
58
  Others not listed gateway can be tested on our site, Test your Gateway: [Custom Gateway](https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/admin/customer/smsconfig)
59
 
60
- = All Registartion Forms Supported =
61
  Google Authenticator - Two factor authentication( 2 Factor ) is available for all Forms. You can enable OTP Verification on all Registration forms and Google Authenticator, Security Questions, Prevent Account Sharing, Push Notifications on all the Login forms to verify users. Use this shortcode for Registration([mo2f_enable_register]). Settings in <b>Two Factor -> Registration Forms</b>.
62
 
63
 
64
  = FREE Plugin Features =
65
  * Simplified & easy user interface to setup Google Authenticator and other Two Factor Authentication ( 2FA ) methods.
66
  * Google Authenticator - Two Factor Authentication (2FA) for **3 User** forever FREE!
67
- * **Variety of Two Factor Authentication Methods:** Any App supporting TOTP algorithm like Google Authenticator, Authy Authenticator, LastPass Authenticator, Microsoft Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA)
68
  * Includes Language Translation Support. Supports a wide variety of languages for all methods of 2 factor like Google Authenticator
69
  * Passwordless login or login with phone number, supported for Google Authenticator and other 2 Factor authentication methods.
70
- * This plugin Supports standard TOTP + HOTP protocols for Authentication Methods. Any TOTP protocol based authenticator app can be configured using Google Authenticator option in the plugin.
71
  * Two Factor Authentication (2FA) allows authentication on login page itself for Google Authenticator & miniOrange Soft Token.
72
- * Brute force attack prevention & IP Blocking.
73
  * User login Monitorning with and without two-factor authentication(2FA)
74
  * RCP Login and Registration Suppport with all login 2 factor methods like Google Authenticator, OTP Over SMS, QR code Authentication, login with Email for Login.
75
  * OTP Verification of Ulimate Member Registartion form with methods like OTP Over SMS and Email, QR code Authentication.
76
- * Recovery codes in case you are locked out for all Two Factor Authentication (TFA) methods like Google Authenticator, SMS verification,
 
77
 
78
  = Standard Lite Plugin Features =
79
 
80
  * Google Authenticator - Two Factor Authentication (2FA) for all users and all user roles *( Site-based pricing )*
81
  * **Available Two Factor Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, Security Questions(KBA), OTP Over Email, OTP Over SMS, Email Verification. *( SMS credits need to be purchased as per the need)*
82
- * Includes language Translation Support. Supports wide variety of languages.
83
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
84
  * **Unlimitted Email transactions:** Unlimitted Email transactions with your SMTP server.
85
  * **Backup Method:** KBA(Security Questions) For all TFA methods like Google Authenticator, etc.
86
- * Multisite compatible.
87
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
88
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
89
 
@@ -91,11 +92,11 @@ Google Authenticator - Two factor authentication( 2 Factor ) is available for al
91
 
92
  * Google Authenticator - Two Factor Authentication (2FA) for all users and all user roles *( Site-based pricing )*
93
  * **Available Two Factor Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, Security Questions(KBA), OTP Over Email, OTP Over SMS, Email Verification, Mobile Verification. *( SMS credits need to be purchased as per the need)*
94
- * Includes language Translation Support. Supports wide variety of languages.
95
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
96
  * **Unlimitted Email transactions:** Unlimitted Email transactions with your SMTP server.
97
  * **Backup Method:** KBA(Security Questions) , OTP Over Email, Backup codes For all Two Factor Authentication ( TFA ) methods like Google Authenticator, etc.
98
- * Multisite compatible.
99
  * Two Factor Authentication ( TFA ) for Custom login forms like User Pro, login with ajax, Theme my login, etc with all authentication methods like Google Authenticator, mobile Verification with SMS, etc.
100
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
101
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
@@ -112,10 +113,10 @@ Google Authenticator - Two factor authentication( 2 Factor ) is available for al
112
 
113
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
114
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification. *( SMS credits need to be purchased as per the need)*
115
- * Includes language Translation Support. Supports wide variety of languages.
116
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
117
  * **Backup Method:** KBA(Security Questions)
118
- * Multisite compatible.
119
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
120
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
121
 
@@ -123,10 +124,10 @@ Google Authenticator - Two factor authentication( 2 Factor ) is available for al
123
 
124
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
125
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification, Hardware Token, Whatsapp based 2fa(Add-on), Telegram Based 2fa. *( SMS and Email credits need to be purchased as per the need)*
126
- * Language Translation Support
127
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
128
  * **Backup Methods:** KBA(Security Questions), OTP Over Email, Backup Codes [Guide](https://docs.miniorange.com/documentation/want-configure-backup-methods-users-can-configure-case-locked-site-not-able-log)
129
- * Multisite compatible.
130
  * Force Two factor authentication for users [Guide](https://docs.miniorange.com/documentation/enforce-2fa-users)
131
  * Email notification to users asking them to set up Two Factor Authentication (2FA) [Guide](https://docs.miniorange.com/documentation/want-send-email-notification-users-setting-2-factor)
132
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name).
@@ -141,10 +142,10 @@ Google Authenticator - Two factor authentication( 2 Factor ) is available for al
141
 
142
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
143
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification, Hardware Token. *( SMS and Email credits need to be purchased as per the need)*
144
- * Language Translation Support
145
  * **Multiple Login Options:** Username + password + two factor Authentication (or) Username + two factor authentication i.e. Passwordless login.
146
  * **Backup Methods:** KBA(Security Questions), OTP Over Email, Backup Codes
147
- * Multisite compatible.
148
  * Email notification to users asking them to set up Google Authenticator - Two Factor Authentication (2FA).
149
  * User role based redirection after Login, Custom Security Questions (KBA), Customize account name in Google Authenticator app.
150
  * Enable Two Factor Authentication (2FA) for specific Users/User Roles
@@ -154,13 +155,22 @@ Google Authenticator - Two factor authentication( 2 Factor ) is available for al
154
  * **Brute force attack prevention, IP Blocking & User login Monitorning. **
155
  * File protection & strong password
156
  * Monitorning current two factor authentication (2 Factor) method of all the users in the plugin.
157
- = PASSWORDLESS LOGIN =
158
- Passwordless login is a new way of login in which you and your users can login without entering the password. The login can be done by username and 2 factor or only username which can be decided based on the user role. If a role is not allowed for passwordless login they will login with password and username.
 
 
 
 
 
 
159
 
160
  == Prevent Account Sharing Between Users ==
161
- Many video sharing and E-learning platforms want to prevent sharing of account between the users. This can be done using miniOrange Two factor plugin (TFA) with methods like QR code Authentication , Mobile Verification, etc. Also, e-learning portals can use this to their advantage. It can be used on any websites which create and sell courses. It can be integrated with plugins like Learndash.
162
  Other sites like premium video content or any premium content where you want users not to share passwords between friends and Family then you can go for this solution. Multiple two factor authentication methods are supported to achieve prevent account sharing.
163
 
 
 
 
164
  = Additional Features other than the two factor authentication ( 2FA ) =
165
  * **Complete Web Security suite to protect wordpress from any attacks**
166
  * **Web Application Firewall (WAF) : Wordpress Firewall to protect your site**
@@ -184,12 +194,12 @@ Other sites like premium video content or any premium content where you want use
184
  * **Reporting**
185
  * **Audit Log**
186
 
187
- Check all the features here: [miniOrange Website](https://security.miniorange.com/)
188
 
189
  = Why do you need to register? =
190
 
191
  miniOrange Two factor authentication Plugin (TFA) uses miniOrange APIs to communicate between your WP and miniOrange. To keep this communication secure, we ask you to register and assign you API keys specific to your account. This way your account and users calls can be only accessed by API keys assigned to you.
192
- Adding to this, you can also use the same account on multiple applications and your users do not have to maintain multiple accounts or 2 factor like Google Authenticator. Single code generated in Google Authenticator will be enough to login to all sites. With this you can also achieve sync of 2 factor authentication on multiple sites.
193
 
194
 
195
  = Add Ons [Applicable for Free and Standard Plans, Inclusive in the Premium Plan] =
@@ -198,7 +208,7 @@ Adding to this, you can also use the same account on multiple applications and y
198
  * Remember Device to skip the two factor authentication ( 2 Factor ) from the trusted devices.
199
  * Set Device Limit for the users to login
200
  * IP Restriction: Limit users to login from specific IPs
201
- * Personalization Add-on Features to customize your 2 factor authentication pages
202
  * Custom UI of Two Factor Authentication (2FA) popups
203
  * Custom Email and SMS Templates
204
  * Customize 'Powered by' Logo on two factor authentication page
@@ -209,7 +219,7 @@ Adding to this, you can also use the same account on multiple applications and y
209
  * Option to turn on/off 2 factor (two factor authentication) by user
210
  * Option to configure the Google Authenticator and Security Questions by user
211
  * Option to 'Enable Remember Device' from a custom login form to skip 2 factor for trusted devices.
212
- * On-Demand ShortCodes for specific functionalities ( like for enabling 2FA (2 Factor authentication) for specific pages)
213
 
214
  = Apps Supported by the two factor authentication plugin =
215
  * Google Authenticator
@@ -389,27 +399,31 @@ miniOrange authentication service has 15+ authentication methods.One time passco
389
 
390
  == Changelog ==
391
 
 
 
 
 
392
  = 5.4.31=
393
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
394
  * OTP over Email as two factor fix
395
  * Low Email transaction alert fix
396
 
397
  = 5.4.30=
398
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
399
  * Feedback changes
400
 
401
  = 5.4.29 =
402
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
403
  * Session independent Google Authenticator
404
  * Session independent KBA
405
  * Feedback improvement for two factor authentication plugin
406
 
407
  = 5.4.28 =
408
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
409
  * New year sale update
410
 
411
  = 5.4.27 =
412
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
413
  * New year sale
414
  * WordPress 5.6 compatibility fix
415
  * WAF fixes
@@ -418,21 +432,21 @@ miniOrange authentication service has 15+ authentication methods.One time passco
418
  * New feature release notification
419
 
420
  = 5.4.26 =
421
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
422
  * Christmas Offer
423
 
424
  = 5.4.25 =
425
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
426
  * OTP over Telegram Fixes
427
 
428
  = 5.4.24 =
429
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
430
  * OTP over Whatsapp
431
  * OTP over Telegram
432
  * Feedback form changes
433
 
434
  = 5.4.23 =
435
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
436
  * Call support with technical team
437
  * Email and SMS transaction sync
438
  * Feedback form on network deactivate
@@ -440,7 +454,7 @@ miniOrange authentication service has 15+ authentication methods.One time passco
440
  * 2FA added for superadmin role
441
 
442
  = 5.4.22 =
443
- * Google Authenticator - Two Factor Authentication (2FA, OTP) :
444
  * Backup Codes
445
  * Sanitization and JS improvements
446
  * SMS and Email Sync
@@ -448,11 +462,11 @@ miniOrange authentication service has 15+ authentication methods.One time passco
448
  * Telegram based Two factor in Premium plugin
449
 
450
  = 5.4.21 =
451
- * Google Authenticator - Two Factor Authentication (2FA, SMS) :
452
  * Sanitization of some input values.
453
 
454
  = 5.4.20 =
455
- * Google Authenticator - Two Factor Authentication (2FA, SMS) :
456
  * Google Authenticator Qr code fix.
457
  * My theme login Login fix.
458
 
1
  === Google Authenticator - WordPress Two Factor Authentication (2FA , MFA) ===
2
 
3
  Contributors: cyberlord92, twofactor, hsn97
4
+ Tags: google authenticator, two factor authentication, OTP , 2FA, two-factor, 2-factor authentication, two-step verification, two factor, OTP, mobile verification, two factor, Two step verification, TFA, MFA, 2 factor authentication, Multi factor authentication, Remember Device, OTP,WordPress otp, two step authentication,Clef,SMS, email, signup security, two factor auth, Mobile Authentication, strong authentication, 2 step authentication, mobile verification,Multifactor authentication, passwordless login, one time passcode, soft token Authentication, QR Code Authentication, email verification, KBA, Security Questions,2FA, login OTP, login with SMS, mobile login, phone login, OTP login, mobile verification,knowledge based authentication,authy, authy two factor,yubico,Two-Factor Authentication,WordPress otp, security,user security, ​Twilio WordPress, SMS gateway, Solutions Infini, FIDO, FIDO2, FIDO 2, Webauthn, Usernameless login ,Clickatell, BulkSMS, MSG91, Nexmo, SMS Country, message, woocommerce, website security, login security, multi factor authentication, multi factor,wordfence, IP Blocking, IP Whitelisting, login Audits, woocommerce, SMS login, passwordless login, auth, login with OTP WordPress, OTP Over SMS and Email, two-step authentication, Mobile Authentication, passwordless login, login without password, passwordless authentication, secure login, temporary login, temporary access, one time passcode, email verification, security, website security, login security, multi-factor authentication, woocommerce, smartphone, WordPress otp, register with OTP, user OTP verification, SMS OTP, OTP Email, registration with OTP verification, registration verification,smartphone authentication, Login with fingerprint, faceID, touchID
5
  Donate link: https://miniorange.com/
6
  Requires at least: 3.0.1
7
+ Tested up to: 5.7
8
  Requires PHP: 5.3.0
9
+ Stable tag: 5.4.32
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
13
+ Google Authenticator, Two Factor Authentication (2 Factor), OTP verificaion - SMS and Email, two-step verificaion ,Apps like Microsoft, Duo, LastPass & more on login and Registration for all forms. Google Authenticator also Supports QR Code, Push Notification and Security Questions along with the Google Authenticator itself. Google authenticator plugin can also be used for multi factor authentication.
14
 
15
  == Description ==
16
 
17
+ Google Authenticator - Two Factor Authentication (2FA) plugin provides a completely Secure login to your WordPress website. Google Authenticator- Two Factor Authentication (2FA) is a FREE, Simple & very easy to setup plugin. Google Authenticator provides two factor authentication (2FA, MFA) whenever login to your WordPress website ensuring no unauthorised access to your website. Google Authenticator can be configured for any TOTP based Authentication Method for providing addtional layer of security of Two Factor Authentication(multi factor authentication).
18
 
19
+ = User Identity Verification or OTP Verification (Two Factor Authentication) =
20
+ Login and Registration: Verify users on login and Registration with different authentication methods like Google Authenticator, SMS Verification, Email, Authy Authenticator, Duo Authenticator, Microsoft Authenticator, TOTP Based Authenticator, Security Questions and many others. Easy OTP Verification with SMS Verification and Email Verification. We provide complete two factor authentication security.
21
 
22
+ = Google Authenticator and other 2 Factor ( 2FA, Two Factor Authentication ) sync on multiple websites =
23
  You would not need to configure Google Authenticator and other Two Factor Authentication ( 2FA ) methods from second site onword. Just login with miniOrange account and your 2FA will automatically get set. This is available for Google Authenticator, Duo Authenticator, Microsoft Authenticator, Securty Questions, LastPass, Authy, miniOrange methods, OTP over SMS, OTP over Email. It is supported only if you are using our cloud services of 2 Factor.
24
 
25
+ == Plugin Integrations and Support for all methods of two factor authentication like Google Authenticator ==
26
  * [Woocommerce](https://wordpress.org/plugins/woocommerce/) (Login Woocommerce using Google Authenticator - Two Factor Authentication (2FA))
27
  * [BuddyPress form](https://wordpress.org/plugins/buddypress/) (Login BuddyPress using Google Authenticator - Two Factor Authentication (2FA))
28
  * [bbpress form](https://wordpress.org/plugins/bbpress/) (Login bbpress using Google Authenticator - Two Factor Authentication (2FA))
45
  * [RegistrationMagic – Custom Registration Forms](https://wordpress.org/plugins/custom-registration-form-builder-with-submission-manager/) (Register and Login RegistrationMagic – Custom Registration using Google Authenticator - Two Factor Authentication (2FA))
46
  * And many more
47
 
48
+ = Third Party Custom SMS Gateway for OTP Over SMS (two factor authentication) =
49
  Premium plugin supports any third party custom SMS Gateway. If you don't have your own SMS gateway you can use miniOrange gateway. Send SMS all over the world.
50
  * Some Famous Gateways Supported:
51
  * Twilio : [Twilio](https://www.twilio.com/)
57
 
58
  Others not listed gateway can be tested on our site, Test your Gateway: [Custom Gateway](https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/admin/customer/smsconfig)
59
 
60
+ = All Registartion Forms Supported for OTP verification and two factor authentication =
61
  Google Authenticator - Two factor authentication( 2 Factor ) is available for all Forms. You can enable OTP Verification on all Registration forms and Google Authenticator, Security Questions, Prevent Account Sharing, Push Notifications on all the Login forms to verify users. Use this shortcode for Registration([mo2f_enable_register]). Settings in <b>Two Factor -> Registration Forms</b>.
62
 
63
 
64
  = FREE Plugin Features =
65
  * Simplified & easy user interface to setup Google Authenticator and other Two Factor Authentication ( 2FA ) methods.
66
  * Google Authenticator - Two Factor Authentication (2FA) for **3 User** forever FREE!
67
+ * **Variety of Two Factor Authentication Methods:** Any App supporting TOTP algorithm like Google Authenticator, Authy Authenticator, LastPass Authenticator, Microsoft Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) are supported in the plugin for multi factor authentication.
68
  * Includes Language Translation Support. Supports a wide variety of languages for all methods of 2 factor like Google Authenticator
69
  * Passwordless login or login with phone number, supported for Google Authenticator and other 2 Factor authentication methods.
70
+ * This plugin Supports standard TOTP + HOTP protocols for Authentication Methods. Any TOTP protocol based authenticator app can be configured using Google Authenticator option in the plugin for two factor authentication.
71
  * Two Factor Authentication (2FA) allows authentication on login page itself for Google Authenticator & miniOrange Soft Token.
72
+ * Brute force attack prevention & IP Blocking along with two factor authentication.
73
  * User login Monitorning with and without two-factor authentication(2FA)
74
  * RCP Login and Registration Suppport with all login 2 factor methods like Google Authenticator, OTP Over SMS, QR code Authentication, login with Email for Login.
75
  * OTP Verification of Ulimate Member Registartion form with methods like OTP Over SMS and Email, QR code Authentication.
76
+ * Recovery codes in case you are locked out for all Two Factor Authentication (TFA) methods like Google Authenticator, SMS verification.
77
+ * Supports multi factor authentication for methods such as Google authenticator, OTP over Email, OTP over SMS, QR code authentication and many more.
78
 
79
  = Standard Lite Plugin Features =
80
 
81
  * Google Authenticator - Two Factor Authentication (2FA) for all users and all user roles *( Site-based pricing )*
82
  * **Available Two Factor Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, Security Questions(KBA), OTP Over Email, OTP Over SMS, Email Verification. *( SMS credits need to be purchased as per the need)*
83
+ * Includes language Translation Support. Supports wide variety of languages for two factor auhthentication.
84
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
85
  * **Unlimitted Email transactions:** Unlimitted Email transactions with your SMTP server.
86
  * **Backup Method:** KBA(Security Questions) For all TFA methods like Google Authenticator, etc.
87
+ * Multisite compatible for all WordPress 2FA methods.
88
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
89
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
90
 
92
 
93
  * Google Authenticator - Two Factor Authentication (2FA) for all users and all user roles *( Site-based pricing )*
94
  * **Available Two Factor Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, Security Questions(KBA), OTP Over Email, OTP Over SMS, Email Verification, Mobile Verification. *( SMS credits need to be purchased as per the need)*
95
+ * Includes language Translation Support. Supports wide variety of languages for two factor auhthentication.
96
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
97
  * **Unlimitted Email transactions:** Unlimitted Email transactions with your SMTP server.
98
  * **Backup Method:** KBA(Security Questions) , OTP Over Email, Backup codes For all Two Factor Authentication ( TFA ) methods like Google Authenticator, etc.
99
+ * Multisite compatible for all WordPress 2FA methods.
100
  * Two Factor Authentication ( TFA ) for Custom login forms like User Pro, login with ajax, Theme my login, etc with all authentication methods like Google Authenticator, mobile Verification with SMS, etc.
101
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
102
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
113
 
114
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
115
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification. *( SMS credits need to be purchased as per the need)*
116
+ * Includes language Translation Support. Supports wide variety of languages for two factor auhthentication.
117
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login. [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
118
  * **Backup Method:** KBA(Security Questions)
119
+ * Multisite compatible for all WordPress 2FA methods.
120
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name)
121
  * Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions)
122
 
124
 
125
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
126
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification, Hardware Token, Whatsapp based 2fa(Add-on), Telegram Based 2fa. *( SMS and Email credits need to be purchased as per the need)*
127
+ * Language Translation Support for two factor auhthentication.
128
  * **Multiple Login Options:** Username + password + two-factor (or) Username + two-factor i.e. Passwordless login [Guide](https://docs.miniorange.com/documentation/login-username-2nd-factor-2)
129
  * **Backup Methods:** KBA(Security Questions), OTP Over Email, Backup Codes [Guide](https://docs.miniorange.com/documentation/want-configure-backup-methods-users-can-configure-case-locked-site-not-able-log)
130
+ * Multisite compatible for all WordPress 2FA methods.
131
  * Force Two factor authentication for users [Guide](https://docs.miniorange.com/documentation/enforce-2fa-users)
132
  * Email notification to users asking them to set up Two Factor Authentication (2FA) [Guide](https://docs.miniorange.com/documentation/want-send-email-notification-users-setting-2-factor)
133
  * User role based redirection after Login [Guide](https://docs.miniorange.com/documentation/custom-redirect-login-url), Custom Security Questions (KBA) [Guide](https://docs.miniorange.com/documentation/custom-security-questions), Customize account name in Google Authenticator app [Guide](https://docs.miniorange.com/documentation/google-authenticator-app-name).
142
 
143
  * Google Authenticator - Two Factor Authentication (2FA) for Users as per the upgrade *( User-based pricing )*
144
  * **Available Authentication Methods:** Google Authenticator, Authy Authenticator, Microsoft Authenticator, LastPass Authenticator, QR Code, Push Notification, Soft Token, Security Questions(KBA), OTP Over Email, OTP Over SMS, OTP Over SMS and Email, Email Verification, Hardware Token. *( SMS and Email credits need to be purchased as per the need)*
145
+ * Language Translation Support for two factor authenticaion.
146
  * **Multiple Login Options:** Username + password + two factor Authentication (or) Username + two factor authentication i.e. Passwordless login.
147
  * **Backup Methods:** KBA(Security Questions), OTP Over Email, Backup Codes
148
+ * Multisite compatible for all WordPress 2FA methods.
149
  * Email notification to users asking them to set up Google Authenticator - Two Factor Authentication (2FA).
150
  * User role based redirection after Login, Custom Security Questions (KBA), Customize account name in Google Authenticator app.
151
  * Enable Two Factor Authentication (2FA) for specific Users/User Roles
155
  * **Brute force attack prevention, IP Blocking & User login Monitorning. **
156
  * File protection & strong password
157
  * Monitorning current two factor authentication (2 Factor) method of all the users in the plugin.
158
+ = PASSWORDLESS LOGIN ( login without password) =
159
+ Passwordless login is a new way of login in which you and your users can login without entering the password. The login can be done by username and 2 factor or only username which can be decided based on the user role. If a role is not allowed for passwordless login they will login with password and username. miniOrange supports many two factor authentication methods for passwordless login. You can use google authenticator, webauthn, fingerprint login, otp over sms and email for login without password.
160
+
161
+ = WebAuthn (FIDO2) Passwordless login =
162
+ WebAuthn is a browser-based API that allows for web applications to simplify and secure user authentication by using registered devices (phones, laptops, etc) as factors. It uses public key cryptography to protect users from advanced phishing attacks. It will allow you to provide your users an option for usernameless login. With the help of webauthn your users can login with fingerprint, FaceID, TouchID, etc.
163
+
164
+ = Device restriction with webauthn =
165
+ Webauthn allows you to restrict the number of devices per user. You can allow a user any number of devices they can use to login to your website. Webauthn also covers passwordless and usernameless login in which your users can login from the allowed device without password and username.
166
 
167
  == Prevent Account Sharing Between Users ==
168
+ Many video sharing and E-learning platforms want to prevent sharing of account between the users. This can be done using miniOrange Two factor plugin (TFA) with WordPress 2FA methods like QR code Authentication , Mobile Verification, etc. Also, e-learning portals can use this to their advantage. It can be used on any websites which create and sell courses. It can be integrated with plugins like Learndash.
169
  Other sites like premium video content or any premium content where you want users not to share passwords between friends and Family then you can go for this solution. Multiple two factor authentication methods are supported to achieve prevent account sharing.
170
 
171
+ == Multi factor authentication ( MFA ) ==
172
+ You can configure multiple WordPress 2FA methods like google authenticator, OTP over Email, OTP over SMS, etc and choose which method do you want to login to your website from a list of configured methods. Multi factor authentication is helpful for cases such as when you do not have your phone and cannot access your TOTP app for login. You can then use other method like OTP over Email to login.
173
+
174
  = Additional Features other than the two factor authentication ( 2FA ) =
175
  * **Complete Web Security suite to protect wordpress from any attacks**
176
  * **Web Application Firewall (WAF) : Wordpress Firewall to protect your site**
194
  * **Reporting**
195
  * **Audit Log**
196
 
197
+ Check all the features other than two factor authentication here: [miniOrange Website](https://security.miniorange.com/)
198
 
199
  = Why do you need to register? =
200
 
201
  miniOrange Two factor authentication Plugin (TFA) uses miniOrange APIs to communicate between your WP and miniOrange. To keep this communication secure, we ask you to register and assign you API keys specific to your account. This way your account and users calls can be only accessed by API keys assigned to you.
202
+ Adding to this, you can also use the same account on multiple applications and your users do not have to maintain multiple accounts or WordPress 2FA like Google Authenticator. Single code generated in Google Authenticator will be enough to login to all sites. With this you can also achieve sync of two factor authentication on multiple sites.
203
 
204
 
205
  = Add Ons [Applicable for Free and Standard Plans, Inclusive in the Premium Plan] =
208
  * Remember Device to skip the two factor authentication ( 2 Factor ) from the trusted devices.
209
  * Set Device Limit for the users to login
210
  * IP Restriction: Limit users to login from specific IPs
211
+ * Personalization Add-on Features to customize your two factor authentication pages
212
  * Custom UI of Two Factor Authentication (2FA) popups
213
  * Custom Email and SMS Templates
214
  * Customize 'Powered by' Logo on two factor authentication page
219
  * Option to turn on/off 2 factor (two factor authentication) by user
220
  * Option to configure the Google Authenticator and Security Questions by user
221
  * Option to 'Enable Remember Device' from a custom login form to skip 2 factor for trusted devices.
222
+ * On-Demand ShortCodes for specific functionalities ( like for enabling WordPress 2FA (Two Factor authentication) for specific pages)
223
 
224
  = Apps Supported by the two factor authentication plugin =
225
  * Google Authenticator
399
 
400
  == Changelog ==
401
 
402
+ = 5.4.32=
403
+ * Google Authenticator – Two Factor Authentication (2FA, TFA) :
404
+ * Replaced sessions with transient.
405
+
406
  = 5.4.31=
407
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
408
  * OTP over Email as two factor fix
409
  * Low Email transaction alert fix
410
 
411
  = 5.4.30=
412
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
413
  * Feedback changes
414
 
415
  = 5.4.29 =
416
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
417
  * Session independent Google Authenticator
418
  * Session independent KBA
419
  * Feedback improvement for two factor authentication plugin
420
 
421
  = 5.4.28 =
422
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
423
  * New year sale update
424
 
425
  = 5.4.27 =
426
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
427
  * New year sale
428
  * WordPress 5.6 compatibility fix
429
  * WAF fixes
432
  * New feature release notification
433
 
434
  = 5.4.26 =
435
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
436
  * Christmas Offer
437
 
438
  = 5.4.25 =
439
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
440
  * OTP over Telegram Fixes
441
 
442
  = 5.4.24 =
443
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
444
  * OTP over Whatsapp
445
  * OTP over Telegram
446
  * Feedback form changes
447
 
448
  = 5.4.23 =
449
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
450
  * Call support with technical team
451
  * Email and SMS transaction sync
452
  * Feedback form on network deactivate
454
  * 2FA added for superadmin role
455
 
456
  = 5.4.22 =
457
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
458
  * Backup Codes
459
  * Sanitization and JS improvements
460
  * SMS and Email Sync
462
  * Telegram based Two factor in Premium plugin
463
 
464
  = 5.4.21 =
465
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
466
  * Sanitization of some input values.
467
 
468
  = 5.4.20 =
469
+ * Google Authenticator - Two Factor Authentication (2FA, TFA) :
470
  * Google Authenticator Qr code fix.
471
  * My theme login Login fix.
472
 
views/malware_scanner/scan_summary_view.php CHANGED
@@ -446,7 +446,7 @@ function mo_wpns_start_scan(){
446
  }else{
447
  jQuery('#mo_scan_message').hide();
448
  jQuery('#mo_scan_message').empty();
449
- if(response['total'] === false || response['total'] == 0){
450
  var width = 0;
451
  }else{
452
  var width= (response['scanned']/response['total'])*100;
446
  }else{
447
  jQuery('#mo_scan_message').hide();
448
  jQuery('#mo_scan_message').empty();
449
+ if(response['total'] === false || response['total'] == 0 || response['total'] == null){
450
  var width = 0;
451
  }else{
452
  var width= (response['scanned']/response['total'])*100;
views/request_christmas_offer.php DELETED
@@ -1,36 +0,0 @@
1
- <div class="mo_wpns_divided_layout">
2
- <div class="mo_wpns_setting_layout mo2f_christmas_contact_us_layout">
3
- <h3> Request For Christmas Offer : <div style="float: right;">
4
- <?php
5
- echo '<a class="mo_wpns_button mo_wpns_button1 mo2f_christmas_contact_us_button" href="'.$two_fa.'">Back</a>';
6
- ?>
7
- </div></h3>
8
- <form method="post">
9
- <input type="hidden" name="option" value="mo_2FA_christmas_request_form" />
10
- <input type="hidden" name="nonce" value="<?php echo wp_create_nonce('mo2f-Request-christmas')?>">
11
- <table cellpadding="4" cellspacing="4">
12
- <tr>
13
- <td><strong>Usecase : </strong></td>
14
- <td>
15
- <textarea type="text" name="mo_2FA_christmas_usecase" style="resize: vertical; width:350px; height:100px;" rows="4" placeholder="Write us about your usecase" required value=""></textarea>
16
- </td>
17
-
18
-
19
- </tr>
20
- <tr>
21
- <td>
22
- </td>
23
-
24
- </tr>
25
- <tr>
26
- <td><strong>Email ID : </strong></td>
27
- <td><input required type="email" name="mo_2FA_christmas_email" placeholder="Email id" value="" /></td>
28
- </tr>
29
-
30
- </table>
31
- <div style="padding-top: 10px;">
32
- <input type="submit" name="submit" value="Submit Request" class="mo_wpns_button mo_wpns_button1 mo2f_christmas_contact_us_button" />
33
- </div>
34
- </form>
35
- </div>
36
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/test/test_twofa_miniorange_push_notification.php CHANGED
@@ -40,7 +40,7 @@
40
  pollMobileValidation();
41
 
42
  function pollMobileValidation() {
43
- var transId = "<?php echo $_SESSION['mo2f_transactionId']; ?>";
44
  var jsonString = "{\"txId\":\"" + transId + "\"}";
45
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
46
 
40
  pollMobileValidation();
41
 
42
  function pollMobileValidation() {
43
+ var transId = "<?php echo get_user_meta($user->ID, 'mo2f_transactionId', true); ?>";
44
  var jsonString = "{\"txId\":\"" + transId + "\"}";
45
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
46
 
views/twofa/setup/setup_google_authenticator.php CHANGED
@@ -1,9 +1,6 @@
1
  <?php
2
 
3
  function mo2f_configure_google_authenticator( $user ) {
4
- // $mo2f_google_auth = isset( $_SESSION['mo2f_google_auth'] ) ? $_SESSION['mo2f_google_auth'] : null;
5
- // $data = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_qrCode'] : null;
6
- // $ga_secret = isset( $_SESSION['mo2f_google_auth'] ) ? $mo2f_google_auth['ga_secret'] : null;
7
  $mo2f_google_auth = get_user_meta($user->ID, 'mo2f_google_auth', true);
8
  $data = isset($mo2f_google_auth['ga_qrCode']) ? $mo2f_google_auth['ga_qrCode'] : null;
9
  $ga_secret = isset($mo2f_google_auth['ga_secret']) ? $mo2f_google_auth['ga_secret'] : null;
1
  <?php
2
 
3
  function mo2f_configure_google_authenticator( $user ) {
 
 
 
4
  $mo2f_google_auth = get_user_meta($user->ID, 'mo2f_google_auth', true);
5
  $data = isset($mo2f_google_auth['ga_qrCode']) ? $mo2f_google_auth['ga_qrCode'] : null;
6
  $ga_secret = isset($mo2f_google_auth['ga_secret']) ? $mo2f_google_auth['ga_secret'] : null;
views/twofa/setup/setup_miniorange_authenticator.php CHANGED
@@ -1,6 +1,12 @@
1
  <?php
2
 
3
- function mo2f_configure_miniorange_authenticator($user){?>
 
 
 
 
 
 
4
  <div id="mo2f_width">
5
  <?php $mobile_reg_status = get_user_meta($user->ID,'mobile_registration_status',true);
6
  if(!$mobile_reg_status) {
@@ -12,7 +18,8 @@ function mo2f_configure_miniorange_authenticator($user){?>
12
  <hr>
13
  <form name="f" method="post" action="">
14
  <input type="hidden" name="option" value="mo_auth_refresh_mobile_qrcode" />
15
- <input type="hidden" name="mo_auth_refresh_mobile_qrcode_nonce" value="<?php echo wp_create_nonce( "mo-auth-refresh-mobile-qrcode-nonce" ) ?>"/>
 
16
  <?php if($mobile_reg_status) { ?>
17
  <div id="reconfigurePhone">
18
  <a data-toggle="collapse" href="#mo2f_show_download_app" aria-expanded="false">
@@ -24,41 +31,43 @@ function mo2f_configure_miniorange_authenticator($user){?>
24
 
25
  <input type="button" name="back" id="go_back" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Back');?>" />
26
 
27
- <input type="submit" name="submit" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Reconfigure your phone');?>" />
28
- </div>
29
- <?php } else {?>
30
- <div id="configurePhone" style="padding:20px;">
31
- <input type="button" name="back" id="go_back" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Back');?>" />
32
- <input type="submit" name="submit" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Configure your phone');?>" />
33
- </div>
34
- <?php } ?>
35
- </form>
36
- <?php if(isset($_SESSION[ 'mo2f_show_qr_code' ]) && $_SESSION[ 'mo2f_show_qr_code' ]=='MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST[ 'option']) && $_POST[ 'option']=='mo_auth_refresh_mobile_qrcode' ){
37
- initialize_mobile_registration();
38
- if($mobile_reg_status) { ?>
39
- <script>
40
- jQuery("#mo2f_app_div").show();
41
- </script>
42
- <?php } else{ ?>
 
 
 
 
 
 
 
 
 
 
 
 
43
  <script>
44
- jQuery("#mo2f_app_div").hide();
 
 
45
  </script>
46
- <?php }
47
- } else{ ?>
48
- <br>
49
- <form name="f" method="post" action="" id="mo2f_go_back_form">
50
- <input type="hidden" name="option" value="mo2f_go_back" />
51
- <input type="hidden" name="mo2f_go_back_nonce" value="<?php echo wp_create_nonce( "mo2f-go-back-nonce" ) ?>"/>
52
- </form>
53
- <script>
54
- jQuery('#go_back').click(function() {
55
- jQuery('#mo2f_go_back_form').submit();
56
- });
57
- </script>
58
- <?php } ?>
59
- </div>
60
- <?php
61
- }
62
 
63
  function download_instruction_for_mobile_app( $mobile_reg_status){ ?>
64
  <div id="mo2f_app_div" class="mo_margin_left">
@@ -113,8 +122,9 @@ function download_instruction_for_mobile_app( $mobile_reg_status){ ?>
113
  </div>
114
  <?php
115
  }
116
- function initialize_mobile_registration() {
117
- $data=$_SESSION[ 'mo2f_qrCode' ]; ?>
 
118
  <div style="padding: 20px;">
119
  <p>
120
  <?php echo mo2f_lt( 'Open your miniOrange');?><b> <?php echo mo2f_lt('Authenticator');?></b> app and
@@ -187,7 +197,7 @@ function initialize_mobile_registration() {
187
  pollMobileRegistration();
188
 
189
  function pollMobileRegistration() {
190
- var transId = "<?php echo $_SESSION[ 'mo2f_transactionId' ]; ?>";
191
  var jsonString = "{\"txId\":\"" + transId + "\"}";
192
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/registration-status";
193
  jQuery.ajax({
1
  <?php
2
 
3
+ function mo2f_configure_miniorange_authenticator($user){
4
+ if(isset($_POST) && isset($_POST['mo2f_session_id'])){
5
+ $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
6
+ }else{
7
+ $session_id_encrypt = MO2f_Utility::random_str(20);
8
+ }
9
+ ?>
10
  <div id="mo2f_width">
11
  <?php $mobile_reg_status = get_user_meta($user->ID,'mobile_registration_status',true);
12
  if(!$mobile_reg_status) {
18
  <hr>
19
  <form name="f" method="post" action="">
20
  <input type="hidden" name="option" value="mo_auth_refresh_mobile_qrcode" />
21
+ <input type="hidden" name="mo2f_session_id" value="<?php echo $session_id_encrypt; ?>" />
22
+ <input type="hidden" name="mo_auth_refresh_mobile_qrcode_nonce" value="<?php echo wp_create_nonce( "mo-auth-refresh-mobile-qrcode-nonce" ) ?>"/>
23
  <?php if($mobile_reg_status) { ?>
24
  <div id="reconfigurePhone">
25
  <a data-toggle="collapse" href="#mo2f_show_download_app" aria-expanded="false">
31
 
32
  <input type="button" name="back" id="go_back" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Back');?>" />
33
 
34
+ <input type="submit" name="submit" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Reconfigure your phone');?>" />
35
+ </div>
36
+ <?php } else {?>
37
+ <div id="configurePhone" style="padding:20px;">
38
+ <input type="button" name="back" id="go_back" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Back');?>" />
39
+ <input type="submit" name="submit" class="mo_wpns_button mo_wpns_button1" value="<?php echo mo2f_lt('Configure your phone');?>" />
40
+ </div>
41
+ <?php } ?>
42
+ </form>
43
+ <?php
44
+ $mo2f_show_qr_code = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_show_qr_code');
45
+ if(isset($mo2f_show_qr_code) && $mo2f_show_qr_code=='MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST[ 'option']) && $_POST[ 'option']=='mo_auth_refresh_mobile_qrcode' ){
46
+ initialize_mobile_registration($session_id_encrypt);
47
+ if($mobile_reg_status) { ?>
48
+ <script>
49
+ jQuery("#mo2f_app_div").show();
50
+ </script>
51
+ <?php } else{ ?>
52
+ <script>
53
+ jQuery("#mo2f_app_div").hide();
54
+ </script>
55
+ <?php }
56
+ } else{ ?>
57
+ <br>
58
+ <form name="f" method="post" action="" id="mo2f_go_back_form">
59
+ <input type="hidden" name="option" value="mo2f_go_back" />
60
+ <input type="hidden" name="mo2f_go_back_nonce" value="<?php echo wp_create_nonce( "mo2f-go-back-nonce" ) ?>"/>
61
+ </form>
62
  <script>
63
+ jQuery('#go_back').click(function() {
64
+ jQuery('#mo2f_go_back_form').submit();
65
+ });
66
  </script>
67
+ <?php } ?>
68
+ </div>
69
+ <?php
70
+ }
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
  function download_instruction_for_mobile_app( $mobile_reg_status){ ?>
73
  <div id="mo2f_app_div" class="mo_margin_left">
122
  </div>
123
  <?php
124
  }
125
+ function initialize_mobile_registration($session_id_encrypt = null) {
126
+ $data = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_qrCode');
127
+ ?>
128
  <div style="padding: 20px;">
129
  <p>
130
  <?php echo mo2f_lt( 'Open your miniOrange');?><b> <?php echo mo2f_lt('Authenticator');?></b> app and
197
  pollMobileRegistration();
198
 
199
  function pollMobileRegistration() {
200
+ var transId = "<?php echo MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId'); ?>";
201
  var jsonString = "{\"txId\":\"" + transId + "\"}";
202
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/registration-status";
203
  jQuery.ajax({
views/twofa/setup/setup_otp_over_sms.php CHANGED
@@ -4,6 +4,12 @@ function mo2f_configure_otp_over_sms( $user ) {
4
  global $Mo2fdbQueries;
5
  $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
6
  $user_phone = $mo2f_user_phone ? $mo2f_user_phone : get_option( 'user_phone_temp' );
 
 
 
 
 
 
7
 
8
  ?>
9
 
@@ -13,6 +19,7 @@ function mo2f_configure_otp_over_sms( $user ) {
13
  <hr>
14
  <form name="f" method="post" action="" id="mo2f_verifyphone_form">
15
  <input type="hidden" name="option" value="mo2f_configure_otp_over_sms_send_otp"/>
 
16
  <input type="hidden" name="mo2f_configure_otp_over_sms_send_otp_nonce"
17
  value="<?php echo wp_create_nonce( "mo2f-configure-otp-over-sms-send-otp-nonce" ) ?>"/>
18
 
@@ -26,6 +33,7 @@ function mo2f_configure_otp_over_sms( $user ) {
26
  </form>
27
  <form name="f" method="post" action="" id="mo2f_validateotp_form">
28
  <input type="hidden" name="option" value="mo2f_configure_otp_over_sms_validate"/>
 
29
  <input type="hidden" name="mo2f_configure_otp_over_sms_validate_nonce"
30
  value="<?php echo wp_create_nonce( "mo2f-configure-otp-over-sms-validate-nonce" ) ?>"/>
31
  <p><?php echo mo2f_lt( 'Enter One Time Passcode' ); ?></p>
4
  global $Mo2fdbQueries;
5
  $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
6
  $user_phone = $mo2f_user_phone ? $mo2f_user_phone : get_option( 'user_phone_temp' );
7
+ if(isset($_POST) && isset($_POST['mo2f_session_id'])){
8
+ $session_id_encrypt = sanitize_text_field($_POST['mo2f_session_id']);
9
+ }else{
10
+ $pass2fa_login_session = new Miniorange_Password_2Factor_Login();
11
+ $session_id_encrypt = $pass2fa_login_session->create_session();
12
+ }
13
 
14
  ?>
15
 
19
  <hr>
20
  <form name="f" method="post" action="" id="mo2f_verifyphone_form">
21
  <input type="hidden" name="option" value="mo2f_configure_otp_over_sms_send_otp"/>
22
+ <input type="hidden" name="mo2f_session_id" value="<?php echo $session_id_encrypt ?>"/>
23
  <input type="hidden" name="mo2f_configure_otp_over_sms_send_otp_nonce"
24
  value="<?php echo wp_create_nonce( "mo2f-configure-otp-over-sms-send-otp-nonce" ) ?>"/>
25
 
33
  </form>
34
  <form name="f" method="post" action="" id="mo2f_validateotp_form">
35
  <input type="hidden" name="option" value="mo2f_configure_otp_over_sms_validate"/>
36
+ <input type="hidden" name="mo2f_session_id" value="<?php echo $session_id_encrypt ?>"/>
37
  <input type="hidden" name="mo2f_configure_otp_over_sms_validate_nonce"
38
  value="<?php echo wp_create_nonce( "mo2f-configure-otp-over-sms-validate-nonce" ) ?>"/>
39
  <p><?php echo mo2f_lt( 'Enter One Time Passcode' ); ?></p>
views/twofa/test/test_twofa_email_verification.php CHANGED
@@ -1,11 +1,8 @@
1
  <?php
2
- function mo2f_test_email_verification() {
3
  $mo2f_dirName = dirname(__FILE__);
4
  $mo2f_dirName = explode('wp-content', $mo2f_dirName);
5
  $mo2f_dirName = explode('views', $mo2f_dirName[1]);
6
-
7
- $checkEV = get_site_option('siteurl').DIRECTORY_SEPARATOR."wp-content".$mo2f_dirName[0]."handler".DIRECTORY_SEPARATOR."two_fa_pass2login.php";
8
- $checkEV = 'http://localhost/onpremchanges/wordpress\wp-content\plugins\miniorange-2-factor-authentication\viewshandler\two_fa_pass2login.php';
9
  ?>
10
 
11
  <h3><?php echo mo2f_lt( 'Test Email Verification' ); ?></h3>
@@ -34,7 +31,7 @@
34
  <input type="hidden" name="option" value="mo2f_out_of_band_success"/>
35
  <input type="hidden" name="mo2f_out_of_band_success_nonce"
36
  value="<?php echo wp_create_nonce( "mo2f-out-of-band-success-nonce" ) ?>"/>
37
- <input type="hidden" name="TxidEmail" value="<?php echo $_SESSION['txid']; ?>"/>
38
  </form>
39
  <form name="f" method="post" id="mo2f_out_of_band_error_form" action="">
40
  <input type="hidden" name="option" value="mo2f_out_of_band_error"/>
@@ -52,10 +49,8 @@
52
 
53
  if(MO2F_IS_ONPREM)
54
  {
55
- $otpToken = isset($_SESSION['otpToken']) ? $_SESSION['otpToken'] : '';
56
- $txid = isset($_SESSION["txid"]) ? $_SESSION["txid"] : '';
57
-
58
-
59
  ?>
60
  <script type="text/javascript">
61
  var timeout;
@@ -88,7 +83,7 @@
88
  }
89
  else
90
  {
91
- $mo2f_transactionId = isset($_SESSION['mo2f_transactionId']) ? $_SESSION['mo2f_transactionId'] : '';
92
 
93
  ?>
94
  <script type="text/javascript">
1
  <?php
2
+ function mo2f_test_email_verification($user = null) {
3
  $mo2f_dirName = dirname(__FILE__);
4
  $mo2f_dirName = explode('wp-content', $mo2f_dirName);
5
  $mo2f_dirName = explode('views', $mo2f_dirName[1]);
 
 
 
6
  ?>
7
 
8
  <h3><?php echo mo2f_lt( 'Test Email Verification' ); ?></h3>
31
  <input type="hidden" name="option" value="mo2f_out_of_band_success"/>
32
  <input type="hidden" name="mo2f_out_of_band_success_nonce"
33
  value="<?php echo wp_create_nonce( "mo2f-out-of-band-success-nonce" ) ?>"/>
34
+ <input type="hidden" name="TxidEmail" value="<?php echo get_user_meta($user->ID, 'mo2f_transactionId', true); ?>"/>
35
  </form>
36
  <form name="f" method="post" id="mo2f_out_of_band_error_form" action="">
37
  <input type="hidden" name="option" value="mo2f_out_of_band_error"/>
49
 
50
  if(MO2F_IS_ONPREM)
51
  {
52
+ $otpToken = get_user_meta($user->ID, 'otpToken', true);
53
+ $txid = get_user_meta($user->ID, 'mo2f_transactionId', true);
 
 
54
  ?>
55
  <script type="text/javascript">
56
  var timeout;
83
  }
84
  else
85
  {
86
+ $mo2f_transactionId = get_user_meta($user->ID, 'mo2f_transactionId', true);
87
 
88
  ?>
89
  <script type="text/javascript">
views/twofa/test/test_twofa_miniorange_push_notification.php CHANGED
@@ -40,7 +40,7 @@
40
  pollMobileValidation();
41
 
42
  function pollMobileValidation() {
43
- var transId = "<?php echo $_SESSION['mo2f_transactionId']; ?>";
44
  var jsonString = "{\"txId\":\"" + transId + "\"}";
45
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
46
 
40
  pollMobileValidation();
41
 
42
  function pollMobileValidation() {
43
+ var transId = "<?php echo get_user_meta($user->ID, 'mo2f_transactionId', true); ?>";
44
  var jsonString = "{\"txId\":\"" + transId + "\"}";
45
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
46
 
views/twofa/test/test_twofa_miniorange_qrcode_authentication.php CHANGED
@@ -26,7 +26,7 @@ function mo2f_test_miniorange_qr_code_authentication( $user ) {
26
  <table class="mo2f_settings_table">
27
  <div id="qr-success"></div>
28
  <div id="displayQrCode" >
29
- <br><?php echo '<img style="width:165px;" src="data:image/jpg;base64,' . $_SESSION['mo2f_qrCode'] . '" />'; ?>
30
  </div>
31
 
32
  </table>
@@ -57,7 +57,7 @@ function mo2f_test_miniorange_qr_code_authentication( $user ) {
57
  pollMobileValidation();
58
 
59
  function pollMobileValidation() {
60
- var transId = "<?php echo $_SESSION['mo2f_transactionId']; ?>";
61
  var jsonString = "{\"txId\":\"" + transId + "\"}";
62
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
63
 
26
  <table class="mo2f_settings_table">
27
  <div id="qr-success"></div>
28
  <div id="displayQrCode" >
29
+ <br><?php echo '<img style="width:165px;" src="data:image/jpg;base64,' . get_user_meta($user->ID, 'mo2f_qrCode', true) . '" />'; ?>
30
  </div>
31
 
32
  </table>
57
  pollMobileValidation();
58
 
59
  function pollMobileValidation() {
60
+ var transId = "<?php echo get_user_meta($user->ID, 'mo2f_transactionId', true); ?>";
61
  var jsonString = "{\"txId\":\"" + transId + "\"}";
62
  var postUrl = "<?php echo MO_HOST_NAME; ?>" + "/moas/api/auth/auth-status";
63