get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
if ( $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' ) {
$app_type = get_user_meta( $user->ID, 'mo2f_external_app_type', true );
if ( $app_type == 'Google Authenticator' ) {
$selectedMethod = 'Google Authenticator';
} elseif ( $app_type == 'Authy Authenticator' ) {
$selectedMethod = 'Authy Authenticator';
} else {
$selectedMethod = 'Google Authenticator';
update_user_meta( $user->ID, 'mo2f_external_app_type', $selectedMethod );
}
$testMethod = $selectedMethod;
} else {
$selectedMethod = molms_decode_2_factor( $mo2f_second_factor, "servertowpdb" );
$testMethod = $selectedMethod;
}
if ( $testMethod == 'NONE' ) {
$testMethod = "Not Configured";
}
if ( $selectedMethod != 'NONE' and ! MOLMS_IS_ONPREM ) {
$molms_db_queries->update_user_details(
$user->ID,
array(
'mo2f_configured_2FA_method' => $selectedMethod,
'mo2f_' . str_replace( ' ', '', $selectedMethod ) . '_config_status' => true
)
);
update_site_option( 'mo2f_configured_2_factor_method', $selectedMethod );
}
if ( $configured_2FA_method == "OTP Over SMS" ) {
update_site_option( 'mo2f_show_sms_transaction_message', 1 );
} else {
update_site_option( 'mo2f_show_sms_transaction_message', 0 );
}
$is_customer_admin = current_user_can( 'manage_options' );
$can_display_admin_features = ! $is_customer_admin_registered || $is_customer_admin ? true : false;
$is_customer_registered = $molms_db_queries->get_user_detail( 'user_registration_with_miniorange', $user->ID ) == 'SUCCESS' ? true : false;
if ( get_user_meta( $user->ID, 'configure_2FA', true ) ) {
$current_selected_method = get_user_meta( $user->ID, 'mo2f_2FA_method_to_configure', true );
echo '
';
molms_show_2FA_configuration_screen( $user, $current_selected_method );
echo '
';
} elseif ( get_user_meta( $user->ID, 'test_2FA', true ) ) {
$current_selected_method = get_user_meta( $user->ID, 'mo2f_2FA_method_to_test', true );
echo '';
molms_show_2FA_test_screen( $user, $current_selected_method );
echo '
';
} elseif ( get_user_meta( $user->ID, 'register_account_popup', true ) && $can_display_admin_features ) {
molms_display_customer_registration_forms( $user );
} else {
$is_NC = molms_Utility::get_mo2f_db_option( 'mo2f_is_NC', 'get_site_option' );
$free_plan_existing_user = array(
"Email Verification",
"Security Questions",
"OTP Over SMS",
"OTP Over Email",
"miniOrange QR Code Authentication",
"miniOrange Soft Token",
"miniOrange Push Notification",
"Google Authenticator",
"Authy Authenticator"
);
$free_plan_new_user = array(
"Google Authenticator",
"Security Questions",
"OTP Over SMS",
"OTP Over Email",
"miniOrange Soft Token",
"miniOrange QR Code Authentication",
"miniOrange Push Notification"
);
$standard_plan_existing_user = array(
"",
"OTP Over Email",
"OTP Over SMS and Email"
);
$standard_plan_new_user = array(
"",
"Email Verification",
"OTP Over SMS",
"OTP Over Email",
"OTP Over SMS and Email",
"Authy Authenticator"
);
$premium_plan = array(
"Hardware Token"
);
if ( MOLMS_IS_ONPREM ) {
$free_plan_existing_user = array(
"Email Verification",
"Security Questions",
"OTP Over SMS",
"OTP Over Email",
"Google Authenticator",
"miniOrange QR Code Authentication",
"miniOrange Soft Token",
"miniOrange Push Notification"
);
$free_plan_new_user = array(
"Google Authenticator",
"Security Questions",
"OTP Over SMS",
"OTP Over Email",
"miniOrange QR Code Authentication",
"miniOrange Soft Token",
"miniOrange Push Notification",
);
$premium_plan = array(
"Hardware Token",
"Authy Authenticator"
);
$standard_plan_existing_user = array(
"",
"OTP Over SMS and Email",
);
$standard_plan_new_user = array(
"",
"Email Verification",
"OTP Over SMS and Email"
);
}
$free_plan_methods_existing_user = array_chunk( $free_plan_existing_user, 3 );
$free_plan_methods_new_user = array_chunk( $free_plan_new_user, 3 );
$standard_plan_methods_existing_user = array_chunk( $standard_plan_existing_user, 3 );
$standard_plan_methods_new_user = array_chunk( $standard_plan_new_user, 3 );
$premium_plan_methods_existing_user = array_chunk( array_merge( $standard_plan_existing_user, $premium_plan ), 3 );
$premium_plan_methods_new_user = array_chunk( array_merge( $standard_plan_new_user, $premium_plan ), 3 );
$showOTP = false;
if ( MOLMS_IS_ONPREM ) {
$selectedMethod = $molms_db_queries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
$is_customer_registered = true;
$testMethod = $selectedMethod;
if ( $selectedMethod == '' ) {
$selectedMethod = 'NONE';
$testMethod = 'Not Configured';
}
if ( $selectedMethod == "Google Authenticator" ) {
$currentTimeSlice = floor( time() / 30 );
include_once $molms_dirName . DIRECTORY_SEPARATOR . 'handler' . DIRECTORY_SEPARATOR . 'twofa' . DIRECTORY_SEPARATOR . 'gaonprem.php';
$gauth_obj = new molms_Google_auth_onpremise();
$secret = $gauth_obj->mo_GAuth_get_secret( $user->ID );
$i = get_site_option( 'mo2f_time_slice', 0 );
$otpcode = $gauth_obj->getCode( $secret, $currentTimeSlice + $i );
$showOTP = true;
}
} ?>