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

Version Description

Download this release

Release Info

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

Code changes from version 5.4.38 to 5.4.39

api/class-customer-common-setup.php CHANGED
@@ -1,412 +1,412 @@
1
- <?php
2
- /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
- * Copyright (C) 2015 miniOrange
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>
17
- * @package miniOrange OAuth
18
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
- */
20
-
21
- /**
22
- * This library is miniOrange Authentication Service.
23
- * Contains Request Calls to Customer service.
24
- **/
25
-
26
- include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'mo2f_api.php';
27
-
28
- class Customer_Cloud_Setup {
29
-
30
- public $email;
31
- public $phone;
32
- public $customerKey;
33
- public $transactionId;
34
-
35
- private $auth_mode = 2; // miniorange test or not
36
- private $https_mode = false; // website http or https
37
-
38
-
39
- function check_customer() {
40
- $url = MO_HOST_NAME . "/moas/rest/customer/check-if-exists";
41
- $email = get_option( "mo2f_email" );
42
- $mo2fApi= new Mo2f_Api();
43
- $fields = array (
44
- 'email' => $email
45
- );
46
- $field_string = json_encode ( $fields );
47
-
48
- $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
49
-
50
- $response = $mo2fApi->make_curl_call( $url, $field_string );
51
- return $response;
52
-
53
- }
54
-
55
- function guest_audit() {
56
- $url = MO_HOST_NAME . "/moas/rest/customer/guest-audit";
57
- $email = get_option( "mo2f_email" );
58
-
59
- $user = wp_get_current_user();
60
-
61
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
62
- if (empty($email))
63
- $email = $user->user_email;
64
- }
65
-
66
- $mo2fApi= new Mo2f_Api();
67
- $MoWpnsUtility = new MoWpnsUtility();
68
- $company = get_option( 'mo2f_admin_company' ) != '' ? get_option( 'mo2f_admin_company' ) : $_SERVER['SERVER_NAME'];
69
- $applicationName='Wordpress Two Factor; Multisite: '.is_multisite().' '.$MoWpnsUtility->checkPlugins();
70
- $fields = array (
71
- 'emailAddress' => $email,
72
- 'companyName'=>$company,
73
- 'cmsName'=>"WP",
74
- 'applicationType'=>'Two Factor Upgrade',
75
- 'applicationName'=>$applicationName,
76
- 'pluginVersion'=>MO2F_VERSION,
77
- 'inUse'=>$MoWpnsUtility->getFeatureStatus()
78
- );
79
-
80
-
81
-
82
- $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
83
-
84
- $field_string = json_encode ( $fields );
85
-
86
- $response = $mo2fApi->make_curl_call( $url, $field_string,$headers );
87
- return $response;
88
-
89
- }
90
-
91
- function send_email_alert( $email, $phone, $message ) {
92
-
93
- $url = MO_HOST_NAME . '/moas/api/notify/send';
94
-
95
- $mo2fApi= new Mo2f_Api();
96
- $customerKey = "16555";
97
- $apiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
98
-
99
- $currentTimeInMillis = $mo2fApi->get_timestamp();
100
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
101
- $hashValue = hash( "sha512", $stringToHash );
102
- $fromEmail = $email;
103
- $subject = "WordPress 2FA Plugin Feedback - " . $email;
104
-
105
- global $user;
106
- $user = wp_get_current_user();
107
- $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
108
- $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
109
-
110
-
111
- $customer_feature = "";
112
-
113
- if ( $is_ec_with_1_user ) {
114
- $customer_feature = "V1";
115
- }else if ( $is_nc_with_1_user ) {
116
- $customer_feature = "V3";
117
- }
118
-
119
- $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
120
-
121
- $content = '<div >First Name :' . $user->user_firstname . '<br><br>Last Name :' . $user->user_lastname . ' <br><br>Company :<a href="' . $_SERVER['SERVER_NAME'] . '" target="_blank" >' . $_SERVER['SERVER_NAME'] . '</a><br><br>Phone Number :' . $phone . '<br><br>Email :<a href="mailto:' . $fromEmail . '" target="_blank">' . $fromEmail . '</a><br><br>Query :' . $query . '</div>';
122
-
123
- $fields = array(
124
- 'customerKey' => $customerKey,
125
- 'sendEmail' => true,
126
- 'email' => array(
127
- 'customerKey' => $customerKey,
128
- 'fromEmail' => $fromEmail,
129
- 'fromName' => 'Xecurify',
130
- 'toEmail' => '2fasupport@xecurify.com',
131
- 'toName' => '2fasupport@xecurify.com',
132
- 'subject' => $subject,
133
- 'content' => $content
134
- ),
135
- );
136
- $field_string = json_encode( $fields );
137
-
138
- $headers = $mo2fApi->get_http_header_array();
139
-
140
- $response = $mo2fApi->make_curl_call( $url, $field_string, $headers );
141
- return $response;
142
-
143
-
144
- }
145
-
146
- function create_customer() {
147
- global $Mo2fdbQueries;
148
- if ( ! MO2f_Utility::is_curl_installed() ) {
149
- $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
150
-
151
- return json_encode( array( "status" => 'ERROR', "message" => $message ) );
152
- }
153
-
154
- $url = MO_HOST_NAME . '/moas/rest/customer/add';
155
- $mo2fApi= new Mo2f_Api();
156
- global $user;
157
- $user = wp_get_current_user();
158
- $this->email = get_option( 'mo2f_email' );
159
- $this->phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
160
- $password = get_option( 'mo2f_password' );
161
- $company = get_option( 'mo2f_admin_company' ) != '' ? get_option( 'mo2f_admin_company' ) : $_SERVER['SERVER_NAME'];
162
-
163
- $fields = array(
164
- 'companyName' => $company,
165
- 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin',
166
- 'productInterest' => 'API_2FA',
167
- 'email' => $this->email,
168
- 'phone' => $this->phone,
169
- 'password' => $password
170
- );
171
- $field_string = json_encode( $fields );
172
- $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
173
-
174
- $content = $mo2fApi->make_curl_call( $url, $field_string );
175
-
176
- return $content;
177
- }
178
-
179
-
180
- function get_customer_key() {
181
- if ( ! MO2f_Utility::is_curl_installed() ) {
182
- $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
183
-
184
- return json_encode( array( "status" => 'ERROR', "message" => $message ) );
185
- }
186
-
187
- $url = MO_HOST_NAME . "/moas/rest/customer/key";
188
-
189
- $email = get_option( "mo2f_email" );
190
- $password = get_option( "mo2f_password" );
191
- $mo2fApi= new Mo2f_Api();
192
- $fields = array(
193
- 'email' => $email,
194
- 'password' => $password
195
- );
196
- $field_string = json_encode( $fields );
197
-
198
- $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
199
-
200
- $content = $mo2fApi->make_curl_call( $url, $field_string );
201
-
202
- return $content;
203
- }
204
-
205
-
206
- function send_otp_token( $uKey, $authType, $cKey, $apiKey, $currentuser=null ) {
207
-
208
- if ( ! MO2f_Utility::is_curl_installed()) {
209
- $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
210
-
211
- return json_encode( array( "status" => 'ERROR', "message" => $message ) );
212
- }
213
-
214
- $url = MO_HOST_NAME . '/moas/api/auth/challenge';
215
- $mo2fApi = new Mo2f_Api();
216
- /* The customer Key provided to you */
217
- $customerKey = $cKey;
218
-
219
- /* The customer API Key provided to you */
220
- $apiKey = $apiKey;
221
-
222
- /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
223
- $currentTimeInMillis = $mo2fApi->get_timestamp();
224
-
225
- /* Creating the Hash using SHA-512 algorithm */
226
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
227
- $hashValue = hash( "sha512", $stringToHash );
228
-
229
- $headers = $mo2fApi->get_http_header_array();
230
-
231
- $fields = '';
232
- if ( $authType == 'EMAIL' || $authType == 'OTP Over Email' || $authType == 'OUT OF BAND EMAIL' ) {
233
- $fields = array(
234
- 'customerKey' => $customerKey,
235
- 'email' => $uKey,
236
- 'authType' => $authType,
237
- 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
238
- );
239
- } else if ( $authType == 'SMS' ) {
240
- $authType = "SMS";
241
- $fields = array(
242
- 'customerKey' => $customerKey,
243
- 'phone' => $uKey,
244
- 'authType' => $authType
245
- );
246
- } else {
247
- $fields = array(
248
- 'customerKey' => $customerKey,
249
- 'username' => $uKey,
250
- 'authType' => $authType,
251
- 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
252
- );
253
- }
254
-
255
- $field_string = json_encode( $fields );
256
-
257
- $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
258
-
259
- $content1 = json_decode($content,true);
260
-
261
- if ( $content1['status'] == "SUCCESS" ) {
262
- if(get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z') == 4 && $authType == 'SMS'){
263
- Miniorange_Authentication::low_otp_alert("sms");
264
- }
265
- if(get_site_option('cmVtYWluaW5nT1RQ') == 5 && $authType == 'OTP Over Email'){
266
- Miniorange_Authentication::low_otp_alert("email");
267
- }
268
- }
269
-
270
- return $content;
271
- }
272
-
273
-
274
-
275
-
276
- function get_customer_transactions( $cKey, $apiKey ,$license_type) {
277
-
278
- $url = MO_HOST_NAME . '/moas/rest/customer/license';
279
-
280
- $customerKey = $cKey;
281
- $apiKey = $apiKey;
282
- $mo2fApi= new Mo2f_Api();
283
- $currentTimeInMillis = $mo2fApi->get_timestamp();
284
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
285
- $hashValue = hash( "sha512", $stringToHash );
286
-
287
- $fields = '';
288
- $fields = array(
289
- 'customerId' => $customerKey,
290
- 'applicationName' => 'WP_OTP_VERIFICATION_PLUGIN',
291
- 'licenseType' => $license_type
292
- );
293
-
294
- $field_string = json_encode( $fields );
295
-
296
- $headers = $mo2fApi->get_http_header_array();
297
-
298
- $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
299
-
300
-
301
- return $content;
302
- }
303
-
304
-
305
- function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null) {
306
- $content='';
307
- if ( ! MO2f_Utility::is_curl_installed() ) {
308
- $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
309
-
310
- return json_encode( array( "status" => 'ERROR', "message" => $message ) );
311
- }
312
-
313
- $url = MO_HOST_NAME . '/moas/api/auth/validate';
314
- $mo2fApi= new Mo2f_Api();
315
- /* The customer Key provided to you */
316
- $customerKey = $cKey;
317
-
318
- /* The customer API Key provided to you */
319
- $apiKey = $customerApiKey;
320
-
321
- /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
322
- $currentTimeInMillis = $mo2fApi->get_timestamp();
323
-
324
- /* Creating the Hash using SHA-512 algorithm */
325
- $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
326
- $hashValue = hash( "sha512", $stringToHash );
327
-
328
- $headers = $mo2fApi->get_http_header_array();
329
- $fields = '';
330
- if ( $authType == 'SOFT TOKEN' || $authType == 'GOOGLE AUTHENTICATOR' ) {
331
- /*check for soft token*/
332
- $fields = array(
333
- 'customerKey' => $customerKey,
334
- 'username' => $username,
335
- 'token' => $otpToken,
336
- 'authType' => $authType
337
- );
338
- } else if ( $authType == 'KBA' ) {
339
- $fields = array(
340
- 'txId' => $transactionId,
341
- 'answers' => array(
342
- array(
343
- 'question' => $otpToken[0],
344
- 'answer' => $otpToken[1]
345
- ),
346
- array(
347
- 'question' => $otpToken[2],
348
- 'answer' => $otpToken[3]
349
- )
350
- )
351
- );
352
-
353
- } else {
354
- //*check for otp over sms/email
355
- $fields = array(
356
- 'txId' => $transactionId,
357
- 'token' => $otpToken
358
- );
359
- }
360
- $field_string = json_encode( $fields );
361
-
362
-
363
- $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
364
- return $content;
365
- }
366
-
367
- function submit_contact_us( $q_email, $q_phone, $query ) {
368
- if ( ! MO2f_Utility::is_curl_installed() ) {
369
- $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
370
-
371
- return json_encode( array( "status" => 'ERROR', "message" => $message ) );
372
- }
373
-
374
- $url = MO_HOST_NAME . "/moas/rest/customer/contact-us";
375
- global $user;
376
- $user = wp_get_current_user();
377
- $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
378
- $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
379
-
380
- $mo2fApi= new Mo2f_Api();
381
- $customer_feature = "";
382
-
383
- if ( $is_ec_with_1_user ) {
384
- $customer_feature = "V1";
385
- } else if ( $is_nc_with_1_user ) {
386
- $customer_feature = "V3";
387
- }
388
- global $moWpnsUtility;
389
-
390
- $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
391
- $fields = array(
392
- 'firstName' => $user->user_firstname,
393
- 'lastName' => $user->user_lastname,
394
- 'company' => $_SERVER['SERVER_NAME'],
395
- 'email' => $q_email,
396
- 'ccEmail' => '2fasupport@xecurify.com',
397
- 'phone' => $q_phone,
398
- 'query' => $query
399
- );
400
- $field_string = json_encode( $fields );
401
-
402
- $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
403
-
404
- $content = $mo2fApi->make_curl_call( $url, $field_string );
405
-
406
- return true;
407
- }
408
-
409
- }
410
-
411
-
412
- ?>
1
+ <?php
2
+ /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
+ * Copyright (C) 2015 miniOrange
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
17
+ * @package miniOrange OAuth
18
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
+ */
20
+
21
+ /**
22
+ * This library is miniOrange Authentication Service.
23
+ * Contains Request Calls to Customer service.
24
+ **/
25
+
26
+ include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'mo2f_api.php';
27
+
28
+ class Customer_Cloud_Setup {
29
+
30
+ public $email;
31
+ public $phone;
32
+ public $customerKey;
33
+ public $transactionId;
34
+
35
+ private $auth_mode = 2; // miniorange test or not
36
+ private $https_mode = false; // website http or https
37
+
38
+
39
+ function check_customer() {
40
+ $url = MO_HOST_NAME . "/moas/rest/customer/check-if-exists";
41
+ $email = get_option( "mo2f_email" );
42
+ $mo2fApi= new Mo2f_Api();
43
+ $fields = array (
44
+ 'email' => $email
45
+ );
46
+ $field_string = json_encode ( $fields );
47
+
48
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
49
+
50
+ $response = $mo2fApi->make_curl_call( $url, $field_string );
51
+ return $response;
52
+
53
+ }
54
+
55
+ function guest_audit() {
56
+ $url = MO_HOST_NAME . "/moas/rest/customer/guest-audit";
57
+ $email = get_option( "mo2f_email" );
58
+
59
+ $user = wp_get_current_user();
60
+
61
+ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
62
+ if (empty($email))
63
+ $email = $user->user_email;
64
+ }
65
+
66
+ $mo2fApi= new Mo2f_Api();
67
+ $MoWpnsUtility = new MoWpnsUtility();
68
+ $company = get_option( 'mo2f_admin_company' ) != '' ? get_option( 'mo2f_admin_company' ) : $_SERVER['SERVER_NAME'];
69
+ $applicationName='Wordpress Two Factor; Multisite: '.is_multisite().' '.$MoWpnsUtility->checkPlugins();
70
+ $fields = array (
71
+ 'emailAddress' => $email,
72
+ 'companyName'=>$company,
73
+ 'cmsName'=>"WP",
74
+ 'applicationType'=>'Two Factor Upgrade',
75
+ 'applicationName'=>$applicationName,
76
+ 'pluginVersion'=>MO2F_VERSION,
77
+ 'inUse'=>$MoWpnsUtility->getFeatureStatus()
78
+ );
79
+
80
+
81
+
82
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
83
+
84
+ $field_string = json_encode ( $fields );
85
+
86
+ $response = $mo2fApi->make_curl_call( $url, $field_string,$headers );
87
+ return $response;
88
+
89
+ }
90
+
91
+ function send_email_alert( $email, $phone, $message ) {
92
+
93
+ $url = MO_HOST_NAME . '/moas/api/notify/send';
94
+
95
+ $mo2fApi= new Mo2f_Api();
96
+ $customerKey = "16555";
97
+ $apiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
98
+
99
+ $currentTimeInMillis = $mo2fApi->get_timestamp();
100
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
101
+ $hashValue = hash( "sha512", $stringToHash );
102
+ $fromEmail = $email;
103
+ $subject = "WordPress 2FA Plugin Feedback - " . $email;
104
+
105
+ global $user;
106
+ $user = wp_get_current_user();
107
+ $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
108
+ $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
109
+
110
+
111
+ $customer_feature = "";
112
+
113
+ if ( $is_ec_with_1_user ) {
114
+ $customer_feature = "V1";
115
+ }else if ( $is_nc_with_1_user ) {
116
+ $customer_feature = "V3";
117
+ }
118
+
119
+ $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
120
+
121
+ $content = '<div >First Name :' . $user->user_firstname . '<br><br>Last Name :' . $user->user_lastname . ' <br><br>Company :<a href="' . $_SERVER['SERVER_NAME'] . '" target="_blank" >' . $_SERVER['SERVER_NAME'] . '</a><br><br>Phone Number :' . $phone . '<br><br>Email :<a href="mailto:' . $fromEmail . '" target="_blank">' . $fromEmail . '</a><br><br>Query :' . $query . '</div>';
122
+
123
+ $fields = array(
124
+ 'customerKey' => $customerKey,
125
+ 'sendEmail' => true,
126
+ 'email' => array(
127
+ 'customerKey' => $customerKey,
128
+ 'fromEmail' => $fromEmail,
129
+ 'fromName' => 'Xecurify',
130
+ 'toEmail' => '2fasupport@xecurify.com',
131
+ 'toName' => '2fasupport@xecurify.com',
132
+ 'subject' => $subject,
133
+ 'content' => $content
134
+ ),
135
+ );
136
+ $field_string = json_encode( $fields );
137
+
138
+ $headers = $mo2fApi->get_http_header_array();
139
+
140
+ $response = $mo2fApi->make_curl_call( $url, $field_string, $headers );
141
+ return $response;
142
+
143
+
144
+ }
145
+
146
+ function create_customer() {
147
+ global $Mo2fdbQueries;
148
+ if ( ! MO2f_Utility::is_curl_installed() ) {
149
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
150
+
151
+ return json_encode( array( "status" => 'ERROR', "message" => $message ) );
152
+ }
153
+
154
+ $url = MO_HOST_NAME . '/moas/rest/customer/add';
155
+ $mo2fApi= new Mo2f_Api();
156
+ global $user;
157
+ $user = wp_get_current_user();
158
+ $this->email = get_option( 'mo2f_email' );
159
+ $this->phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
160
+ $password = get_option( 'mo2f_password' );
161
+ $company = get_option( 'mo2f_admin_company' ) != '' ? get_option( 'mo2f_admin_company' ) : $_SERVER['SERVER_NAME'];
162
+
163
+ $fields = array(
164
+ 'companyName' => $company,
165
+ 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin',
166
+ 'productInterest' => 'API_2FA',
167
+ 'email' => $this->email,
168
+ 'phone' => $this->phone,
169
+ 'password' => $password
170
+ );
171
+ $field_string = json_encode( $fields );
172
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
173
+
174
+ $content = $mo2fApi->make_curl_call( $url, $field_string );
175
+
176
+ return $content;
177
+ }
178
+
179
+
180
+ function get_customer_key() {
181
+ if ( ! MO2f_Utility::is_curl_installed() ) {
182
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
183
+
184
+ return json_encode( array( "status" => 'ERROR', "message" => $message ) );
185
+ }
186
+
187
+ $url = MO_HOST_NAME . "/moas/rest/customer/key";
188
+
189
+ $email = get_option( "mo2f_email" );
190
+ $password = get_option( "mo2f_password" );
191
+ $mo2fApi= new Mo2f_Api();
192
+ $fields = array(
193
+ 'email' => $email,
194
+ 'password' => $password
195
+ );
196
+ $field_string = json_encode( $fields );
197
+
198
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
199
+
200
+ $content = $mo2fApi->make_curl_call( $url, $field_string );
201
+
202
+ return $content;
203
+ }
204
+
205
+
206
+ function send_otp_token( $uKey, $authType, $cKey, $apiKey, $currentuser=null ) {
207
+
208
+ if ( ! MO2f_Utility::is_curl_installed()) {
209
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
210
+
211
+ return json_encode( array( "status" => 'ERROR', "message" => $message ) );
212
+ }
213
+
214
+ $url = MO_HOST_NAME . '/moas/api/auth/challenge';
215
+ $mo2fApi = new Mo2f_Api();
216
+ /* The customer Key provided to you */
217
+ $customerKey = $cKey;
218
+
219
+ /* The customer API Key provided to you */
220
+ $apiKey = $apiKey;
221
+
222
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
223
+ $currentTimeInMillis = $mo2fApi->get_timestamp();
224
+
225
+ /* Creating the Hash using SHA-512 algorithm */
226
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
227
+ $hashValue = hash( "sha512", $stringToHash );
228
+
229
+ $headers = $mo2fApi->get_http_header_array();
230
+
231
+ $fields = '';
232
+ if ( $authType == 'EMAIL' || $authType == 'OTP Over Email' || $authType == 'OUT OF BAND EMAIL' ) {
233
+ $fields = array(
234
+ 'customerKey' => $customerKey,
235
+ 'email' => $uKey,
236
+ 'authType' => $authType,
237
+ 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
238
+ );
239
+ } else if ( $authType == 'SMS' ) {
240
+ $authType = "SMS";
241
+ $fields = array(
242
+ 'customerKey' => $customerKey,
243
+ 'phone' => $uKey,
244
+ 'authType' => $authType
245
+ );
246
+ } else {
247
+ $fields = array(
248
+ 'customerKey' => $customerKey,
249
+ 'username' => $uKey,
250
+ 'authType' => $authType,
251
+ 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
252
+ );
253
+ }
254
+
255
+ $field_string = json_encode( $fields );
256
+
257
+ $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
258
+
259
+ $content1 = json_decode($content,true);
260
+
261
+ if ( $content1['status'] == "SUCCESS" ) {
262
+ if(get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z') == 4 && $authType == 'SMS'){
263
+ Miniorange_Authentication::low_otp_alert("sms");
264
+ }
265
+ if(get_site_option('cmVtYWluaW5nT1RQ') == 5 && $authType == 'OTP Over Email'){
266
+ Miniorange_Authentication::low_otp_alert("email");
267
+ }
268
+ }
269
+
270
+ return $content;
271
+ }
272
+
273
+
274
+
275
+
276
+ function get_customer_transactions( $cKey, $apiKey ,$license_type) {
277
+
278
+ $url = MO_HOST_NAME . '/moas/rest/customer/license';
279
+
280
+ $customerKey = $cKey;
281
+ $apiKey = $apiKey;
282
+ $mo2fApi= new Mo2f_Api();
283
+ $currentTimeInMillis = $mo2fApi->get_timestamp();
284
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
285
+ $hashValue = hash( "sha512", $stringToHash );
286
+
287
+ $fields = '';
288
+ $fields = array(
289
+ 'customerId' => $customerKey,
290
+ 'applicationName' => 'WP_OTP_VERIFICATION_PLUGIN',
291
+ 'licenseType' => $license_type
292
+ );
293
+
294
+ $field_string = json_encode( $fields );
295
+
296
+ $headers = $mo2fApi->get_http_header_array();
297
+
298
+ $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
299
+
300
+
301
+ return $content;
302
+ }
303
+
304
+
305
+ function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null) {
306
+ $content='';
307
+ if ( ! MO2f_Utility::is_curl_installed() ) {
308
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
309
+
310
+ return json_encode( array( "status" => 'ERROR', "message" => $message ) );
311
+ }
312
+
313
+ $url = MO_HOST_NAME . '/moas/api/auth/validate';
314
+ $mo2fApi= new Mo2f_Api();
315
+ /* The customer Key provided to you */
316
+ $customerKey = $cKey;
317
+
318
+ /* The customer API Key provided to you */
319
+ $apiKey = $customerApiKey;
320
+
321
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
322
+ $currentTimeInMillis = $mo2fApi->get_timestamp();
323
+
324
+ /* Creating the Hash using SHA-512 algorithm */
325
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
326
+ $hashValue = hash( "sha512", $stringToHash );
327
+
328
+ $headers = $mo2fApi->get_http_header_array();
329
+ $fields = '';
330
+ if ( $authType == 'SOFT TOKEN' || $authType == 'GOOGLE AUTHENTICATOR' ) {
331
+ /*check for soft token*/
332
+ $fields = array(
333
+ 'customerKey' => $customerKey,
334
+ 'username' => $username,
335
+ 'token' => $otpToken,
336
+ 'authType' => $authType
337
+ );
338
+ } else if ( $authType == 'KBA' ) {
339
+ $fields = array(
340
+ 'txId' => $transactionId,
341
+ 'answers' => array(
342
+ array(
343
+ 'question' => $otpToken[0],
344
+ 'answer' => $otpToken[1]
345
+ ),
346
+ array(
347
+ 'question' => $otpToken[2],
348
+ 'answer' => $otpToken[3]
349
+ )
350
+ )
351
+ );
352
+
353
+ } else {
354
+ //*check for otp over sms/email
355
+ $fields = array(
356
+ 'txId' => $transactionId,
357
+ 'token' => $otpToken
358
+ );
359
+ }
360
+ $field_string = json_encode( $fields );
361
+
362
+
363
+ $content = $mo2fApi->make_curl_call( $url, $field_string, $headers );
364
+ return $content;
365
+ }
366
+
367
+ function submit_contact_us( $q_email, $q_phone, $query ) {
368
+ if ( ! MO2f_Utility::is_curl_installed() ) {
369
+ $message = 'Please enable curl extension. <a href="admin.php?page=mo_2fa_troubleshooting">Click here</a> for the steps to enable curl.';
370
+
371
+ return json_encode( array( "status" => 'ERROR', "message" => $message ) );
372
+ }
373
+
374
+ $url = MO_HOST_NAME . "/moas/rest/customer/contact-us";
375
+ global $user;
376
+ $user = wp_get_current_user();
377
+ $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
378
+ $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
379
+
380
+ $mo2fApi= new Mo2f_Api();
381
+ $customer_feature = "";
382
+
383
+ if ( $is_ec_with_1_user ) {
384
+ $customer_feature = "V1";
385
+ } else if ( $is_nc_with_1_user ) {
386
+ $customer_feature = "V3";
387
+ }
388
+ global $moWpnsUtility;
389
+
390
+ $query = '[WordPress 2 Factor Authentication Plugin: ' . $customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
391
+ $fields = array(
392
+ 'firstName' => $user->user_firstname,
393
+ 'lastName' => $user->user_lastname,
394
+ 'company' => $_SERVER['SERVER_NAME'],
395
+ 'email' => $q_email,
396
+ 'ccEmail' => '2fasupport@xecurify.com',
397
+ 'phone' => $q_phone,
398
+ 'query' => $query
399
+ );
400
+ $field_string = json_encode( $fields );
401
+
402
+ $headers = array("Content-Type"=>"application/json","charset"=>"UTF-8","Authorization"=>"Basic");
403
+
404
+ $content = $mo2fApi->make_curl_call( $url, $field_string );
405
+
406
+ return true;
407
+ }
408
+
409
+ }
410
+
411
+
412
+ ?>
api/class-customer-onprem-setup.php CHANGED
@@ -1,73 +1,73 @@
1
- <?php
2
- /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
- * Copyright (C) 2015 miniOrange
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>
17
- * @package miniOrange OAuth
18
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
- */
20
-
21
- /**
22
- * This library is miniOrange Authentication Service.
23
- * Contains Request Calls to Customer service.
24
- **/
25
-
26
- include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'mo2f_api.php';
27
-
28
- class Customer_Setup extends Customer_Cloud_Setup {
29
-
30
-
31
-
32
- function send_otp_token( $uKey, $authType, $cKey, $apiKey, $currentuser=null ) {
33
-
34
- $cloud_methods = array('MOBILE AUTHENTICATION','PUSH NOTIFICATIONS','SMS');
35
- if(MO2F_IS_ONPREM and !in_array($authType, $cloud_methods)){
36
- include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
37
- $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
38
- if(is_null($currentuser) or !isset($currentuser))
39
- $currentuser = wp_get_current_user();
40
- $content = $mo2fOnPremRedirect->OnpremSendRedirect($uKey,$authType,$currentuser);//change parameters as per your requirement but make sure other methods are not affected.
41
-
42
- }else {
43
-
44
- $content= parent::send_otp_token($uKey, $authType, $cKey, $apiKey, $currentuser=null);
45
-
46
- }
47
-
48
- return $content;
49
- }
50
-
51
-
52
- function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null) {
53
- $content='';
54
- if(MO2F_IS_ONPREM and $authType != 'SOFT TOKEN' and $authType !='OTP Over Email' and $authType != 'SMS' and $authType != 'OTP Over SMS'){
55
- include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
56
- $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
57
- if(!isset($current_user) or is_null($current_user) )
58
- $current_user = wp_get_current_user();
59
- $content = $mo2fOnPremRedirect->OnpremValidateRedirect($authType, $otpToken,$current_user );
60
- //change parameters as per your requirement but make sure other methods are not affected.
61
-
62
- }else{
63
-
64
- $content= parent::validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null);
65
-
66
- }
67
- return $content;
68
- }
69
-
70
-
71
- }
72
-
73
  ?>
1
+ <?php
2
+ /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
+ * Copyright (C) 2015 miniOrange
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
17
+ * @package miniOrange OAuth
18
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
+ */
20
+
21
+ /**
22
+ * This library is miniOrange Authentication Service.
23
+ * Contains Request Calls to Customer service.
24
+ **/
25
+
26
+ include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'mo2f_api.php';
27
+
28
+ class Customer_Setup extends Customer_Cloud_Setup {
29
+
30
+
31
+
32
+ function send_otp_token( $uKey, $authType, $cKey, $apiKey, $currentuser=null ) {
33
+
34
+ $cloud_methods = array('MOBILE AUTHENTICATION','PUSH NOTIFICATIONS','SMS');
35
+ if(MO2F_IS_ONPREM and !in_array($authType, $cloud_methods)){
36
+ include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
37
+ $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
38
+ if(is_null($currentuser) or !isset($currentuser))
39
+ $currentuser = wp_get_current_user();
40
+ $content = $mo2fOnPremRedirect->OnpremSendRedirect($uKey,$authType,$currentuser);//change parameters as per your requirement but make sure other methods are not affected.
41
+
42
+ }else {
43
+
44
+ $content= parent::send_otp_token($uKey, $authType, $cKey, $apiKey, $currentuser=null);
45
+
46
+ }
47
+
48
+ return $content;
49
+ }
50
+
51
+
52
+ function validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null) {
53
+ $content='';
54
+ if(MO2F_IS_ONPREM and $authType != 'SOFT TOKEN' and $authType !='OTP Over Email' and $authType != 'SMS' and $authType != 'OTP Over SMS'){
55
+ include_once dirname(__FILE__).DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
56
+ $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
57
+ if(!isset($current_user) or is_null($current_user) )
58
+ $current_user = wp_get_current_user();
59
+ $content = $mo2fOnPremRedirect->OnpremValidateRedirect($authType, $otpToken,$current_user );
60
+ //change parameters as per your requirement but make sure other methods are not affected.
61
+
62
+ }else{
63
+
64
+ $content= parent::validate_otp_token( $authType, $username, $transactionId, $otpToken, $cKey, $customerApiKey, $current_user =null);
65
+
66
+ }
67
+ return $content;
68
+ }
69
+
70
+
71
+ }
72
+
73
  ?>
controllers/addons.php CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
-
3
- global $moWpnsUtility,$mo2f_dirName;
4
-
5
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'addons.php';
1
+ <?php
2
+
3
+ global $moWpnsUtility,$mo2f_dirName;
4
+
5
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'addons.php';
controllers/backup/backup.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  include $mo2f_dirName. 'views'.DIRECTORY_SEPARATOR.'backup'.DIRECTORY_SEPARATOR.'backup.php';
1
+ <?php
2
  include $mo2f_dirName. 'views'.DIRECTORY_SEPARATOR.'backup'.DIRECTORY_SEPARATOR.'backup.php';
controllers/backup/backup_controller.php CHANGED
@@ -1,2 +1,2 @@
1
- <?php
2
  include_once $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'backup'.DIRECTORY_SEPARATOR.'backup_setting_view.php';
1
+ <?php
2
  include_once $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'backup'.DIRECTORY_SEPARATOR.'backup_setting_view.php';
controllers/content-protection.php CHANGED
@@ -1,95 +1,95 @@
1
- <?php
2
- global $moWpnsUtility,$mo2f_dirName;
3
-
4
- if(current_user_can( 'manage_options' ) && isset($_POST['option']))
5
- {
6
- switch($_POST['option'])
7
- {
8
- case "mo_wpns_content_protection":
9
- wpns_handle_content_protection($_POST); break;
10
- case "mo_wpns_enable_comment_spam_blocking":
11
- wpns_handle_comment_spam_blocking($_POST); break;
12
- case "mo_wpns_enable_comment_recaptcha":
13
- wpns_handle_comment_recaptcha($_POST); break;
14
- case "mo_wpns_comment_recaptcha_settings":
15
- wpns_save_comment_recaptcha($_POST); break;
16
- }
17
- }
18
-
19
-
20
- $protect_wp_config = get_option('mo2f_protect_wp_config') ? "checked" : "";
21
- $protect_wp_uploads = get_option('mo2f_prevent_directory_browsing') ? "checked" : "";
22
- $disable_file_editing = get_option('mo2f_disable_file_editing') ? "checked" : "";
23
- $comment_spam_protect = get_option('mo_wpns_enable_comment_spam_blocking') ? "checked" : "";
24
- $enable_recaptcha = get_option('mo_wpns_enable_comment_recaptcha') ? "checked" : "";
25
- $htaccess_file = get_option('mo2f_htaccess_file') ? "checked" : "";
26
- $restAPI = get_site_option('mo2f_restrict_restAPI') ? "checked" : "";
27
- $test_recaptcha_url = "";
28
- $test_recaptcha_url_v3 = "";
29
- $wp_config = site_url().'/wp-config.php';
30
- $wp_uploads = get_site_url().'/wp-content/uploads';
31
- $plugin_editor = get_site_url().'/wp-admin/plugin-editor.php';
32
- $restAPI_link = rest_url().'wp'.DIRECTORY_SEPARATOR.'v2'.DIRECTORY_SEPARATOR.'users';
33
- $restApiPlugin = 'https:'.DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR.'www.wordpress.org'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'wp-rest-api-authentication';
34
- if($enable_recaptcha)
35
- {
36
- $test_recaptcha_url = add_query_arg( array('option'=>'testrecaptchaconfig'), $_SERVER['REQUEST_URI'] );
37
- $captcha_site_key = get_option('mo_wpns_recaptcha_site_key' );
38
- $captcha_secret_key = get_option('mo_wpns_recaptcha_secret_key');
39
- }
40
-
41
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'content-protection.php';
42
-
43
- /* CONTENT PROTECTION FUNCTIONS */
44
-
45
- //Function to save content protection settings
46
- function wpns_handle_content_protection()
47
- {
48
- isset($_POST['protect_wp_config']) ? update_option('mo2f_protect_wp_config' , sanitize_text_field($_POST['protect_wp_config']) ) : update_option('mo2f_protect_wp_config' ,0);
49
- isset($_POST['prevent_directory_browsing']) ? update_option('mo2f_prevent_directory_browsing', sanitize_text_field($_POST['prevent_directory_browsing'])): update_option('mo2f_prevent_directory_browsing',0);
50
- isset($_POST['disable_file_editing']) ? update_option('mo2f_disable_file_editing' , sanitize_text_field($_POST['disable_file_editing'])) : update_option('mo2f_disable_file_editing' ,0);
51
- isset($_POST['mo2f_htaccess_file']) ? update_option('mo2f_htaccess_file' , sanitize_text_field($_POST['mo2f_htaccess_file'])) : update_option('mo2f_htaccess_file',0);
52
- if(isset($_POST['restrictAPI'])){
53
- update_site_option('mo2f_restrict_restAPI', 1);
54
- }
55
- else{
56
- update_site_option('mo2f_restrict_restAPI',0);
57
- }
58
-
59
-
60
-
61
-
62
- $mo_wpns_htaccess_handler = new MoWpnsHandler();
63
- $mo_wpns_htaccess_handler->update_htaccess_configuration();
64
- do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_PROTECTION_ENABLED'),'SUCCESS');
65
- }
66
-
67
-
68
- //Function to handle comment spam blocking
69
- function wpns_handle_comment_spam_blocking($postvalue)
70
- {
71
- $enable = isset($postvalue['mo_wpns_enable_comment_spam_blocking']) ? true : false;
72
- update_option('mo_wpns_enable_comment_spam_blocking', $enable);
73
- if($enable)
74
- do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_SPAM_BLOCKING'),'SUCCESS');
75
- else
76
- do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_SPAM_BLOCKING_DISABLED'),'ERROR');
77
- }
78
-
79
-
80
- //Function to handle reCAPTCHA for comments
81
- function wpns_handle_comment_recaptcha($postvalue)
82
- {
83
- $enable = isset($postvalue['mo_wpns_enable_comment_recaptcha']) ? true : false;
84
- update_option('mo_wpns_enable_comment_recaptcha', $enable);
85
- if($enable)
86
- do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_RECAPTCHA'),'SUCCESS');
87
- else
88
- do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_RECAPTCHA_DISABLED'),'ERROR');
89
- }
90
-
91
- function wpns_save_comment_recaptcha($postvalue){
92
- update_option('mo_wpns_recaptcha_site_key', $postvalue['mo_wpns_recaptcha_site_key']);
93
- update_option('mo_wpns_recaptcha_secret_key', $postvalue['mo_wpns_recaptcha_secret_key']);
94
- do_action('wpns_show_message',MoWpnsMessages::showMessage('RECAPTCHA_ENABLED'),'SUCCESS');
95
  }
1
+ <?php
2
+ global $moWpnsUtility,$mo2f_dirName;
3
+
4
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']))
5
+ {
6
+ switch($_POST['option'])
7
+ {
8
+ case "mo_wpns_content_protection":
9
+ wpns_handle_content_protection($_POST); break;
10
+ case "mo_wpns_enable_comment_spam_blocking":
11
+ wpns_handle_comment_spam_blocking($_POST); break;
12
+ case "mo_wpns_enable_comment_recaptcha":
13
+ wpns_handle_comment_recaptcha($_POST); break;
14
+ case "mo_wpns_comment_recaptcha_settings":
15
+ wpns_save_comment_recaptcha($_POST); break;
16
+ }
17
+ }
18
+
19
+
20
+ $protect_wp_config = get_option('mo2f_protect_wp_config') ? "checked" : "";
21
+ $protect_wp_uploads = get_option('mo2f_prevent_directory_browsing') ? "checked" : "";
22
+ $disable_file_editing = get_option('mo2f_disable_file_editing') ? "checked" : "";
23
+ $comment_spam_protect = get_option('mo_wpns_enable_comment_spam_blocking') ? "checked" : "";
24
+ $enable_recaptcha = get_option('mo_wpns_enable_comment_recaptcha') ? "checked" : "";
25
+ $htaccess_file = get_option('mo2f_htaccess_file') ? "checked" : "";
26
+ $restAPI = get_site_option('mo2f_restrict_restAPI') ? "checked" : "";
27
+ $test_recaptcha_url = "";
28
+ $test_recaptcha_url_v3 = "";
29
+ $wp_config = site_url().'/wp-config.php';
30
+ $wp_uploads = get_site_url().'/wp-content/uploads';
31
+ $plugin_editor = get_site_url().'/wp-admin/plugin-editor.php';
32
+ $restAPI_link = rest_url().'wp'.DIRECTORY_SEPARATOR.'v2'.DIRECTORY_SEPARATOR.'users';
33
+ $restApiPlugin = 'https:'.DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR.'www.wordpress.org'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.'wp-rest-api-authentication';
34
+ if($enable_recaptcha)
35
+ {
36
+ $test_recaptcha_url = add_query_arg( array('option'=>'testrecaptchaconfig'), $_SERVER['REQUEST_URI'] );
37
+ $captcha_site_key = get_option('mo_wpns_recaptcha_site_key' );
38
+ $captcha_secret_key = get_option('mo_wpns_recaptcha_secret_key');
39
+ }
40
+
41
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'content-protection.php';
42
+
43
+ /* CONTENT PROTECTION FUNCTIONS */
44
+
45
+ //Function to save content protection settings
46
+ function wpns_handle_content_protection()
47
+ {
48
+ isset($_POST['protect_wp_config']) ? update_option('mo2f_protect_wp_config' , sanitize_text_field($_POST['protect_wp_config']) ) : update_option('mo2f_protect_wp_config' ,0);
49
+ isset($_POST['prevent_directory_browsing']) ? update_option('mo2f_prevent_directory_browsing', sanitize_text_field($_POST['prevent_directory_browsing'])): update_option('mo2f_prevent_directory_browsing',0);
50
+ isset($_POST['disable_file_editing']) ? update_option('mo2f_disable_file_editing' , sanitize_text_field($_POST['disable_file_editing'])) : update_option('mo2f_disable_file_editing' ,0);
51
+ isset($_POST['mo2f_htaccess_file']) ? update_option('mo2f_htaccess_file' , sanitize_text_field($_POST['mo2f_htaccess_file'])) : update_option('mo2f_htaccess_file',0);
52
+ if(isset($_POST['restrictAPI'])){
53
+ update_site_option('mo2f_restrict_restAPI', 1);
54
+ }
55
+ else{
56
+ update_site_option('mo2f_restrict_restAPI',0);
57
+ }
58
+
59
+
60
+
61
+
62
+ $mo_wpns_htaccess_handler = new MoWpnsHandler();
63
+ $mo_wpns_htaccess_handler->update_htaccess_configuration();
64
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_PROTECTION_ENABLED'),'SUCCESS');
65
+ }
66
+
67
+
68
+ //Function to handle comment spam blocking
69
+ function wpns_handle_comment_spam_blocking($postvalue)
70
+ {
71
+ $enable = isset($postvalue['mo_wpns_enable_comment_spam_blocking']) ? true : false;
72
+ update_option('mo_wpns_enable_comment_spam_blocking', $enable);
73
+ if($enable)
74
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_SPAM_BLOCKING'),'SUCCESS');
75
+ else
76
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_SPAM_BLOCKING_DISABLED'),'ERROR');
77
+ }
78
+
79
+
80
+ //Function to handle reCAPTCHA for comments
81
+ function wpns_handle_comment_recaptcha($postvalue)
82
+ {
83
+ $enable = isset($postvalue['mo_wpns_enable_comment_recaptcha']) ? true : false;
84
+ update_option('mo_wpns_enable_comment_recaptcha', $enable);
85
+ if($enable)
86
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_RECAPTCHA'),'SUCCESS');
87
+ else
88
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('CONTENT_RECAPTCHA_DISABLED'),'ERROR');
89
+ }
90
+
91
+ function wpns_save_comment_recaptcha($postvalue){
92
+ update_option('mo_wpns_recaptcha_site_key', $postvalue['mo_wpns_recaptcha_site_key']);
93
+ update_option('mo_wpns_recaptcha_secret_key', $postvalue['mo_wpns_recaptcha_secret_key']);
94
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('RECAPTCHA_ENABLED'),'SUCCESS');
95
  }
controllers/ip-blocking.php CHANGED
@@ -1,257 +1,257 @@
1
- <?php
2
-
3
- global $moWpnsUtility,$mo2f_dirName;
4
- $mo_wpns_handler = new MoWpnsHandler();
5
-
6
- if(current_user_can( 'manage_options' ) && isset($_POST['option']))
7
- {
8
- switch($_POST['option'])
9
- {
10
- case "mo_wpns_manual_block_ip":
11
- wpns_handle_manual_block_ip($_POST['IP']); break;
12
- case "mo_wpns_unblock_ip":
13
- wpns_handle_unblock_ip($_POST['id']); break;
14
- case "mo_wpns_whitelist_ip":
15
- wpns_handle_whitelist_ip($_POST['IP']); break;
16
- case "mo_wpns_remove_whitelist":
17
- wpns_handle_remove_whitelist($_POST['id'] ); break;
18
- }
19
- }
20
-
21
- $blockedips = $mo_wpns_handler->get_blocked_ips();
22
- $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
23
- $path = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'loader.gif';
24
- $path = explode('plugins', $path);
25
- $img_loader_url = plugins_url().$path[1];
26
-
27
- $page_url = "";
28
- $license_url = add_query_arg( array('page' => 'mo_2fa_upgrade'), $_SERVER['REQUEST_URI'] );
29
-
30
-
31
- /** IP BLOCKING RELATED FUNCTIONS **/
32
-
33
- // Function to handle Manual Block IP form submit
34
- function wpns_handle_manual_block_ip($ip)
35
- {
36
-
37
- global $moWpnsUtility;
38
-
39
- if( $moWpnsUtility->check_empty_or_null( $ip) )
40
- {
41
- //Improper message
42
- echo("empty IP");
43
- exit;
44
- }
45
- if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/',$ip))
46
- {
47
- echo("INVALID_IP_FORMAT");
48
- exit;
49
- }
50
- else
51
- {
52
- $ipAddress = sanitize_text_field( $ip );
53
- $mo_wpns_config = new MoWpnsHandler();
54
- $isWhitelisted = $mo_wpns_config->is_whitelisted($ipAddress);
55
- if(!$isWhitelisted)
56
- {
57
- if($mo_wpns_config->mo_wpns_is_ip_blocked($ipAddress)){
58
- //Change message
59
- echo("already blocked");
60
- exit;
61
- } else{
62
- $mo_wpns_config->mo_wpns_block_ip($ipAddress, MoWpnsConstants::BLOCKED_BY_ADMIN, true);
63
- //not in structures
64
- ?>
65
- <table id="blockedips_table1" class="display">
66
- <thead><tr><th>IP Address&emsp;&emsp;</th><th>Reason&emsp;&emsp;</th><th>Blocked Until&emsp;&emsp;</th><th>Blocked Date&emsp;&emsp;</th><th>Action&emsp;&emsp;</th></tr></thead>
67
- <tbody>
68
- <?php
69
- $mo_wpns_handler = new MoWpnsHandler();
70
- $blockedips = $mo_wpns_handler->get_blocked_ips();
71
- $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
72
- global $mo2f_dirName;
73
- foreach($blockedips as $blockedip)
74
- {
75
- echo "<tr class='mo_wpns_not_bold'><td>".$blockedip->ip_address."</td><td>".$blockedip->reason."</td><td>";
76
- if(empty($blockedip->blocked_for_time))
77
- echo "<span class=redtext>Permanently</span>";
78
- else
79
- echo date("M j, Y, g:i:s a",$blockedip->blocked_for_time);
80
- echo "</td><td>".date("M j, Y, g:i:s a",$blockedip->created_timestamp)."</td><td><a onclick=unblockip('".$blockedip->id."')>Unblock IP</a></td></tr>";
81
- }
82
- ?>
83
- </tbody>
84
- </table>
85
- <script type="text/javascript">
86
- jQuery("#blockedips_table1").DataTable({
87
- "order": [[ 3, "desc" ]]
88
- });
89
- </script>
90
- <?php
91
- exit;
92
- }
93
- }
94
- else
95
- {
96
- // Change message
97
- echo("IP_IN_WHITELISTED");
98
- exit;
99
- }
100
- }
101
- }
102
-
103
-
104
- // Function to handle Manual Block IP form submit
105
- function wpns_handle_unblock_ip($entryID)
106
- {
107
- global $moWpnsUtility;
108
-
109
- if( $moWpnsUtility->check_empty_or_null($entryID))
110
- {
111
- // Change message
112
- echo("UNKNOWN_ERROR");
113
- exit;
114
- }
115
- else
116
- {
117
- $entryid = sanitize_text_field($entryID);
118
- $mo_wpns_config = new MoWpnsHandler();
119
- $mo_wpns_config->unblock_ip_entry($entryid);
120
- //not is structure
121
- ?>
122
- <table id="blockedips_table1" class="display">
123
- <thead><tr><th>IP Address&emsp;&emsp;</th><th>Reason&emsp;&emsp;</th><th>Blocked Until&emsp;&emsp;</th><th>Blocked Date&emsp;&emsp;</th><th>Action&emsp;&emsp;</th></tr></thead>
124
- <tbody>
125
- <?php
126
- $mo_wpns_handler = new MoWpnsHandler();
127
- $blockedips = $mo_wpns_handler->get_blocked_ips();
128
- $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
129
- global $mo2f_dirName;
130
- foreach($blockedips as $blockedip)
131
- {
132
- echo "<tr class='mo_wpns_not_bold'><td>".$blockedip->ip_address."</td><td>".$blockedip->reason."</td><td>";
133
- if(empty($blockedip->blocked_for_time))
134
- echo "<span class=redtext>Permanently</span>";
135
- else
136
- echo date("M j, Y, g:i:s a",$blockedip->blocked_for_time);
137
- echo "</td><td>".date("M j, Y, g:i:s a",$blockedip->created_timestamp)."</td><td><a onclick=unblockip('".$blockedip->id."')>Unblock IP</a></td></tr>";
138
- }
139
- ?>
140
- </tbody>
141
- </table>
142
- <script type="text/javascript">
143
- jQuery("#blockedips_table1").DataTable({
144
- "order": [[ 3, "desc" ]]
145
- });
146
- </script>
147
- <?php
148
-
149
- exit;
150
- }
151
- }
152
-
153
-
154
- // Function to handle Whitelist IP form submit
155
- function wpns_handle_whitelist_ip($ip)
156
- {
157
- global $moWpnsUtility;
158
- if( $moWpnsUtility->check_empty_or_null($ip))
159
- {
160
- //change message
161
- echo("EMPTY IP");
162
- exit;
163
- }
164
- if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/',$ip))
165
- { //change message
166
- echo("INVALID_IP");
167
- exit;
168
- }
169
- else
170
- {
171
- $ipAddress = sanitize_text_field($ip);
172
- $mo_wpns_config = new MoWpnsHandler();
173
- if($mo_wpns_config->is_whitelisted($ipAddress))
174
- {
175
- //change message
176
- echo("IP_ALREADY_WHITELISTED");
177
- exit;
178
- }
179
- else
180
- {
181
- $mo_wpns_config->whitelist_ip($ip);
182
- //Structures issues
183
- $mo_wpns_handler = new MoWpnsHandler();
184
- $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
185
-
186
- ?>
187
- <table id="whitelistedips_table1" class="display">
188
- <thead><tr><th >IP Address</th><th >Whitelisted Date</th><th >Remove from Whitelist</th></tr></thead>
189
- <tbody>
190
- <?php
191
- foreach($whitelisted_ips as $whitelisted_ip)
192
- {
193
- echo "<tr class='mo_wpns_not_bold'><td>".$whitelisted_ip->ip_address."</td><td>".date("M j, Y, g:i:s a",$whitelisted_ip->created_timestamp)."</td><td><a onclick=removefromwhitelist('".$whitelisted_ip->id."')>Remove</a></td></tr>";
194
- }
195
-
196
-
197
- ?>
198
- </tbody>
199
- </table>
200
- <script type="text/javascript">
201
- jQuery("#whitelistedips_table1").DataTable({
202
- "order": [[ 1, "desc" ]]
203
- });
204
- </script>
205
-
206
- <?php
207
- exit;
208
- }
209
- }
210
- }
211
-
212
-
213
- // Function to handle remove whitelisted IP form submit
214
- function wpns_handle_remove_whitelist($entryID)
215
- {
216
- global $moWpnsUtility;
217
- if( $moWpnsUtility->check_empty_or_null($entryID))
218
- {
219
- //change Message
220
- echo("UNKNOWN_ERROR");
221
- exit;
222
- }
223
- else
224
- {
225
- $entryid = sanitize_text_field($entryID);
226
- $mo_wpns_config = new MoWpnsHandler();
227
- $mo_wpns_config->remove_whitelist_entry($entryid);
228
- //structures
229
- $mo_wpns_handler = new MoWpnsHandler();
230
- $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
231
-
232
- ?>
233
- <table id="whitelistedips_table1" class="display">
234
- <thead><tr><th >IP Address</th><th >Whitelisted Date</th><th >Remove from Whitelist</th></tr></thead>
235
- <tbody>
236
- <?php
237
- foreach($whitelisted_ips as $whitelisted_ip)
238
- {
239
- echo "<tr class='mo_wpns_not_bold'><td>".$whitelisted_ip->ip_address."</td><td>".date("M j, Y, g:i:s a",$whitelisted_ip->created_timestamp)."</td><td><a onclick=removefromwhitelist('".$whitelisted_ip->id."')>Remove</a></td></tr>";
240
- }
241
-
242
-
243
- ?>
244
- </tbody>
245
- </table>
246
- <script type="text/javascript">
247
- jQuery("#whitelistedips_table1").DataTable({
248
- "order": [[ 1, "desc" ]]
249
- });
250
- </script>
251
-
252
- <?php
253
- exit;
254
- }
255
- }
256
-
257
 
1
+ <?php
2
+
3
+ global $moWpnsUtility,$mo2f_dirName;
4
+ $mo_wpns_handler = new MoWpnsHandler();
5
+
6
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']))
7
+ {
8
+ switch($_POST['option'])
9
+ {
10
+ case "mo_wpns_manual_block_ip":
11
+ wpns_handle_manual_block_ip($_POST['IP']); break;
12
+ case "mo_wpns_unblock_ip":
13
+ wpns_handle_unblock_ip($_POST['id']); break;
14
+ case "mo_wpns_whitelist_ip":
15
+ wpns_handle_whitelist_ip($_POST['IP']); break;
16
+ case "mo_wpns_remove_whitelist":
17
+ wpns_handle_remove_whitelist($_POST['id'] ); break;
18
+ }
19
+ }
20
+
21
+ $blockedips = $mo_wpns_handler->get_blocked_ips();
22
+ $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
23
+ $path = dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'loader.gif';
24
+ $path = explode('plugins', $path);
25
+ $img_loader_url = plugins_url().$path[1];
26
+
27
+ $page_url = "";
28
+ $license_url = add_query_arg( array('page' => 'mo_2fa_upgrade'), $_SERVER['REQUEST_URI'] );
29
+
30
+
31
+ /** IP BLOCKING RELATED FUNCTIONS **/
32
+
33
+ // Function to handle Manual Block IP form submit
34
+ function wpns_handle_manual_block_ip($ip)
35
+ {
36
+
37
+ global $moWpnsUtility;
38
+
39
+ if( $moWpnsUtility->check_empty_or_null( $ip) )
40
+ {
41
+ //Improper message
42
+ echo("empty IP");
43
+ exit;
44
+ }
45
+ if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/',$ip))
46
+ {
47
+ echo("INVALID_IP_FORMAT");
48
+ exit;
49
+ }
50
+ else
51
+ {
52
+ $ipAddress = sanitize_text_field( $ip );
53
+ $mo_wpns_config = new MoWpnsHandler();
54
+ $isWhitelisted = $mo_wpns_config->is_whitelisted($ipAddress);
55
+ if(!$isWhitelisted)
56
+ {
57
+ if($mo_wpns_config->mo_wpns_is_ip_blocked($ipAddress)){
58
+ //Change message
59
+ echo("already blocked");
60
+ exit;
61
+ } else{
62
+ $mo_wpns_config->mo_wpns_block_ip($ipAddress, MoWpnsConstants::BLOCKED_BY_ADMIN, true);
63
+ //not in structures
64
+ ?>
65
+ <table id="blockedips_table1" class="display">
66
+ <thead><tr><th>IP Address&emsp;&emsp;</th><th>Reason&emsp;&emsp;</th><th>Blocked Until&emsp;&emsp;</th><th>Blocked Date&emsp;&emsp;</th><th>Action&emsp;&emsp;</th></tr></thead>
67
+ <tbody>
68
+ <?php
69
+ $mo_wpns_handler = new MoWpnsHandler();
70
+ $blockedips = $mo_wpns_handler->get_blocked_ips();
71
+ $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
72
+ global $mo2f_dirName;
73
+ foreach($blockedips as $blockedip)
74
+ {
75
+ echo "<tr class='mo_wpns_not_bold'><td>".$blockedip->ip_address."</td><td>".$blockedip->reason."</td><td>";
76
+ if(empty($blockedip->blocked_for_time))
77
+ echo "<span class=redtext>Permanently</span>";
78
+ else
79
+ echo date("M j, Y, g:i:s a",$blockedip->blocked_for_time);
80
+ echo "</td><td>".date("M j, Y, g:i:s a",$blockedip->created_timestamp)."</td><td><a onclick=unblockip('".$blockedip->id."')>Unblock IP</a></td></tr>";
81
+ }
82
+ ?>
83
+ </tbody>
84
+ </table>
85
+ <script type="text/javascript">
86
+ jQuery("#blockedips_table1").DataTable({
87
+ "order": [[ 3, "desc" ]]
88
+ });
89
+ </script>
90
+ <?php
91
+ exit;
92
+ }
93
+ }
94
+ else
95
+ {
96
+ // Change message
97
+ echo("IP_IN_WHITELISTED");
98
+ exit;
99
+ }
100
+ }
101
+ }
102
+
103
+
104
+ // Function to handle Manual Block IP form submit
105
+ function wpns_handle_unblock_ip($entryID)
106
+ {
107
+ global $moWpnsUtility;
108
+
109
+ if( $moWpnsUtility->check_empty_or_null($entryID))
110
+ {
111
+ // Change message
112
+ echo("UNKNOWN_ERROR");
113
+ exit;
114
+ }
115
+ else
116
+ {
117
+ $entryid = sanitize_text_field($entryID);
118
+ $mo_wpns_config = new MoWpnsHandler();
119
+ $mo_wpns_config->unblock_ip_entry($entryid);
120
+ //not is structure
121
+ ?>
122
+ <table id="blockedips_table1" class="display">
123
+ <thead><tr><th>IP Address&emsp;&emsp;</th><th>Reason&emsp;&emsp;</th><th>Blocked Until&emsp;&emsp;</th><th>Blocked Date&emsp;&emsp;</th><th>Action&emsp;&emsp;</th></tr></thead>
124
+ <tbody>
125
+ <?php
126
+ $mo_wpns_handler = new MoWpnsHandler();
127
+ $blockedips = $mo_wpns_handler->get_blocked_ips();
128
+ $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
129
+ global $mo2f_dirName;
130
+ foreach($blockedips as $blockedip)
131
+ {
132
+ echo "<tr class='mo_wpns_not_bold'><td>".$blockedip->ip_address."</td><td>".$blockedip->reason."</td><td>";
133
+ if(empty($blockedip->blocked_for_time))
134
+ echo "<span class=redtext>Permanently</span>";
135
+ else
136
+ echo date("M j, Y, g:i:s a",$blockedip->blocked_for_time);
137
+ echo "</td><td>".date("M j, Y, g:i:s a",$blockedip->created_timestamp)."</td><td><a onclick=unblockip('".$blockedip->id."')>Unblock IP</a></td></tr>";
138
+ }
139
+ ?>
140
+ </tbody>
141
+ </table>
142
+ <script type="text/javascript">
143
+ jQuery("#blockedips_table1").DataTable({
144
+ "order": [[ 3, "desc" ]]
145
+ });
146
+ </script>
147
+ <?php
148
+
149
+ exit;
150
+ }
151
+ }
152
+
153
+
154
+ // Function to handle Whitelist IP form submit
155
+ function wpns_handle_whitelist_ip($ip)
156
+ {
157
+ global $moWpnsUtility;
158
+ if( $moWpnsUtility->check_empty_or_null($ip))
159
+ {
160
+ //change message
161
+ echo("EMPTY IP");
162
+ exit;
163
+ }
164
+ if(!preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\z/',$ip))
165
+ { //change message
166
+ echo("INVALID_IP");
167
+ exit;
168
+ }
169
+ else
170
+ {
171
+ $ipAddress = sanitize_text_field($ip);
172
+ $mo_wpns_config = new MoWpnsHandler();
173
+ if($mo_wpns_config->is_whitelisted($ipAddress))
174
+ {
175
+ //change message
176
+ echo("IP_ALREADY_WHITELISTED");
177
+ exit;
178
+ }
179
+ else
180
+ {
181
+ $mo_wpns_config->whitelist_ip($ip);
182
+ //Structures issues
183
+ $mo_wpns_handler = new MoWpnsHandler();
184
+ $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
185
+
186
+ ?>
187
+ <table id="whitelistedips_table1" class="display">
188
+ <thead><tr><th >IP Address</th><th >Whitelisted Date</th><th >Remove from Whitelist</th></tr></thead>
189
+ <tbody>
190
+ <?php
191
+ foreach($whitelisted_ips as $whitelisted_ip)
192
+ {
193
+ echo "<tr class='mo_wpns_not_bold'><td>".$whitelisted_ip->ip_address."</td><td>".date("M j, Y, g:i:s a",$whitelisted_ip->created_timestamp)."</td><td><a onclick=removefromwhitelist('".$whitelisted_ip->id."')>Remove</a></td></tr>";
194
+ }
195
+
196
+
197
+ ?>
198
+ </tbody>
199
+ </table>
200
+ <script type="text/javascript">
201
+ jQuery("#whitelistedips_table1").DataTable({
202
+ "order": [[ 1, "desc" ]]
203
+ });
204
+ </script>
205
+
206
+ <?php
207
+ exit;
208
+ }
209
+ }
210
+ }
211
+
212
+
213
+ // Function to handle remove whitelisted IP form submit
214
+ function wpns_handle_remove_whitelist($entryID)
215
+ {
216
+ global $moWpnsUtility;
217
+ if( $moWpnsUtility->check_empty_or_null($entryID))
218
+ {
219
+ //change Message
220
+ echo("UNKNOWN_ERROR");
221
+ exit;
222
+ }
223
+ else
224
+ {
225
+ $entryid = sanitize_text_field($entryID);
226
+ $mo_wpns_config = new MoWpnsHandler();
227
+ $mo_wpns_config->remove_whitelist_entry($entryid);
228
+ //structures
229
+ $mo_wpns_handler = new MoWpnsHandler();
230
+ $whitelisted_ips = $mo_wpns_handler->get_whitelisted_ips();
231
+
232
+ ?>
233
+ <table id="whitelistedips_table1" class="display">
234
+ <thead><tr><th >IP Address</th><th >Whitelisted Date</th><th >Remove from Whitelist</th></tr></thead>
235
+ <tbody>
236
+ <?php
237
+ foreach($whitelisted_ips as $whitelisted_ip)
238
+ {
239
+ echo "<tr class='mo_wpns_not_bold'><td>".$whitelisted_ip->ip_address."</td><td>".date("M j, Y, g:i:s a",$whitelisted_ip->created_timestamp)."</td><td><a onclick=removefromwhitelist('".$whitelisted_ip->id."')>Remove</a></td></tr>";
240
+ }
241
+
242
+
243
+ ?>
244
+ </tbody>
245
+ </table>
246
+ <script type="text/javascript">
247
+ jQuery("#whitelistedips_table1").DataTable({
248
+ "order": [[ 1, "desc" ]]
249
+ });
250
+ </script>
251
+
252
+ <?php
253
+ exit;
254
+ }
255
+ }
256
+
257
 
controllers/main_controller.php CHANGED
@@ -71,16 +71,11 @@ if(current_user_can('administrator'))
71
  }
72
  if (isset( $_GET[ 'page' ])) {
73
 
74
- if ($_GET[ 'page' ] == "mo_2fa_upgrade" || $_GET[ 'page' ] == "mo_2fa_addons")
 
75
  {
76
  include $controller . 'feedback_footer.php';
77
  }
78
- else
79
- {
80
- if(current_user_can('administrator')){
81
- include $controller . 'feedback_footer.php';
82
- }
83
- }
84
  }
85
  ?>
86
 
71
  }
72
  if (isset( $_GET[ 'page' ])) {
73
 
74
+ if ($_GET[ 'page' ] == "mo_2fa_upgrade" || $_GET[ 'page' ] == "mo_2fa_addons" || $_GET['page'] == "mo_2fa_account"
75
+ || $_GET['page']=="mo_2fa_waf" || $_GET['page']=="mo_2fa_login_and_spam" || $_GET['page']=="mo_2fa_dashboard")
76
  {
77
  include $controller . 'feedback_footer.php';
78
  }
 
 
 
 
 
 
79
  }
80
  ?>
81
 
controllers/navbar.php CHANGED
@@ -1,94 +1,94 @@
1
- <?php
2
-
3
- global $moWpnsUtility,$mo2f_dirName;
4
- if(current_user_can( 'manage_options' ) && isset($_POST['option']))
5
- {
6
- switch(sanitize_text_field(wp_unslash($_POST['option'])))
7
- {
8
- case "mo_wpns_2fa_with_network_security":
9
- $security_features = new Mo_2fa_security_features();
10
- $security_features->wpns_2fa_with_network_security($_POST); break;
11
- }
12
- }
13
- $network_security_features= MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option') ? "checked" : "";
14
-
15
- if( isset( $_GET[ 'page' ])){
16
- $tab_count= get_site_option('mo2f_tab_count', 0);
17
- if($tab_count == 5)
18
- update_site_option('mo_2f_switch_all', 1);
19
- else
20
- update_site_option('mo_2f_switch_all', 0);
21
- switch($_GET['page'])
22
- {
23
- case 'mo_2fa_login_and_spam':
24
- update_option('mo_2f_switch_loginspam', 1);
25
- if($tab_count < 5 && !get_site_option('mo_2f_switch_loginspam'))
26
- update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
27
- break;
28
- case 'mo_2fa_backup':
29
- update_option('mo_2f_switch_backup', 1);
30
- if($tab_count < 5 && !get_site_option('mo_2f_switch_backup'))
31
- update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
32
- break;
33
- case 'mo_2fa_waf':
34
- update_option('mo_2f_switch_waf', 1);
35
- if($tab_count < 5 && !get_site_option('mo_2f_switch_waf'))
36
- update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
37
- break;
38
- case 'mo_2fa_advancedblocking':
39
- update_option('mo_2f_switch_adv_block', 1);
40
- if($tab_count < 5 && !get_site_option('mo_2f_switch_adv_block'))
41
- update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
42
- break;
43
-
44
- case 'mo_2fa_malwarescan':
45
- update_option('mo_2f_switch_malware', 1);
46
- if($tab_count < 5 && !get_site_option('mo_2f_switch_malware'))
47
- update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
48
- break;
49
- }
50
- }
51
- $profile_url = add_query_arg( array('page' => 'mo_2fa_account' ), $_SERVER['REQUEST_URI'] );
52
- $login_security = add_query_arg( array('page' => 'default' ), $_SERVER['REQUEST_URI'] );
53
- $waf = add_query_arg( array('page' => 'mo_2fa_waf' ), $_SERVER['REQUEST_URI'] );
54
- $login_and_spam = add_query_arg( array('page' => 'mo_2fa_login_and_spam' ), $_SERVER['REQUEST_URI'] );
55
- $register_url = add_query_arg( array('page' => 'registration' ), $_SERVER['REQUEST_URI'] );
56
- $blocked_ips = add_query_arg( array('page' => 'mo_2fa_blockedips' ), $_SERVER['REQUEST_URI'] );
57
- $advance_block = add_query_arg( array('page' => 'mo_2fa_advancedblocking' ), $_SERVER['REQUEST_URI'] );
58
- $notif_url = add_query_arg( array('page' => 'mo_2fa_notifications' ), $_SERVER['REQUEST_URI'] );
59
- $reports_url = add_query_arg( array('page' => 'mo_2fa_reports' ), $_SERVER['REQUEST_URI'] );
60
- $license_url = add_query_arg( array('page' => 'mo_2fa_upgrade' ), $_SERVER['REQUEST_URI'] );
61
- $help_url = add_query_arg( array('page' => 'mo_2fa_troubleshooting' ), $_SERVER['REQUEST_URI'] );
62
- $addons_url = add_query_arg( array('page' => 'mo_2fa_addons' ), $_SERVER['REQUEST_URI'] );
63
- $content_protect= add_query_arg( array('page' => 'content_protect' ), $_SERVER['REQUEST_URI'] );
64
- $backup = add_query_arg( array('page' => 'mo_2fa_backup' ), $_SERVER['REQUEST_URI'] );
65
- $scan_url = add_query_arg( array('page' => 'mo_2fa_malwarescan' ), $_SERVER['REQUEST_URI'] );
66
- $two_fa = add_query_arg( array('page' => 'mo_2fa_two_fa' ), $_SERVER['REQUEST_URI'] );
67
- //Added for new design
68
- $dashboard_url = add_query_arg(array('page' => 'mo_2fa_dashboard' ), $_SERVER['REQUEST_URI']);
69
- $upgrade_url = add_query_arg(array('page' => 'mo_2fa_upgrade' ), $_SERVER['REQUEST_URI']);
70
- $request_demo_url = add_query_arg(array('page' => 'mo_2fa_request_demo' ), $_SERVER['REQUEST_URI']);
71
- $request_offer_url = add_query_arg(array('page' => 'mo_2fa_request_offer' ), $_SERVER['REQUEST_URI']);
72
-
73
- //dynamic
74
- $logo_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/miniorange_logo.png';
75
- $login_with_usename_only_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/login-with-password-and-2fa.png';
76
- $hide_login_form_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/hide_login_form.png';
77
- $new_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/new.png';
78
- $shw_feedback = get_option('donot_show_feedback_message') ? false: true;
79
-
80
- $moPluginHandler= new MoWpnsHandler();
81
- $safe = $moPluginHandler->is_whitelisted($moWpnsUtility->get_client_ip());
82
-
83
- $active_tab = $_GET['page'];
84
-
85
- $user_id = get_current_user_id();
86
- $mo2f_two_fa_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user_id );
87
- $backup_codes_remaining = get_user_meta($user_id, 'mo2f_backup_codes', true);
88
- if(is_array($backup_codes_remaining)){
89
- $backup_codes_remaining = sizeof($backup_codes_remaining);
90
- }else{
91
- $backup_codes_remaining = 0;
92
- }
93
-
94
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'navbar.php';
1
+ <?php
2
+
3
+ global $moWpnsUtility,$mo2f_dirName;
4
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']))
5
+ {
6
+ switch(sanitize_text_field(wp_unslash($_POST['option'])))
7
+ {
8
+ case "mo_wpns_2fa_with_network_security":
9
+ $security_features = new Mo_2fa_security_features();
10
+ $security_features->wpns_2fa_with_network_security($_POST); break;
11
+ }
12
+ }
13
+ $network_security_features= MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option') ? "checked" : "";
14
+
15
+ if( isset( $_GET[ 'page' ])){
16
+ $tab_count= get_site_option('mo2f_tab_count', 0);
17
+ if($tab_count == 5)
18
+ update_site_option('mo_2f_switch_all', 1);
19
+ else
20
+ update_site_option('mo_2f_switch_all', 0);
21
+ switch($_GET['page'])
22
+ {
23
+ case 'mo_2fa_login_and_spam':
24
+ update_option('mo_2f_switch_loginspam', 1);
25
+ if($tab_count < 5 && !get_site_option('mo_2f_switch_loginspam'))
26
+ update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
27
+ break;
28
+ case 'mo_2fa_backup':
29
+ update_option('mo_2f_switch_backup', 1);
30
+ if($tab_count < 5 && !get_site_option('mo_2f_switch_backup'))
31
+ update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
32
+ break;
33
+ case 'mo_2fa_waf':
34
+ update_option('mo_2f_switch_waf', 1);
35
+ if($tab_count < 5 && !get_site_option('mo_2f_switch_waf'))
36
+ update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
37
+ break;
38
+ case 'mo_2fa_advancedblocking':
39
+ update_option('mo_2f_switch_adv_block', 1);
40
+ if($tab_count < 5 && !get_site_option('mo_2f_switch_adv_block'))
41
+ update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
42
+ break;
43
+
44
+ case 'mo_2fa_malwarescan':
45
+ update_option('mo_2f_switch_malware', 1);
46
+ if($tab_count < 5 && !get_site_option('mo_2f_switch_malware'))
47
+ update_site_option('mo2f_tab_count', get_site_option('mo2f_tab_count')+1);
48
+ break;
49
+ }
50
+ }
51
+ $profile_url = add_query_arg( array('page' => 'mo_2fa_account' ), $_SERVER['REQUEST_URI'] );
52
+ $login_security = add_query_arg( array('page' => 'default' ), $_SERVER['REQUEST_URI'] );
53
+ $waf = add_query_arg( array('page' => 'mo_2fa_waf' ), $_SERVER['REQUEST_URI'] );
54
+ $login_and_spam = add_query_arg( array('page' => 'mo_2fa_login_and_spam' ), $_SERVER['REQUEST_URI'] );
55
+ $register_url = add_query_arg( array('page' => 'registration' ), $_SERVER['REQUEST_URI'] );
56
+ $blocked_ips = add_query_arg( array('page' => 'mo_2fa_blockedips' ), $_SERVER['REQUEST_URI'] );
57
+ $advance_block = add_query_arg( array('page' => 'mo_2fa_advancedblocking' ), $_SERVER['REQUEST_URI'] );
58
+ $notif_url = add_query_arg( array('page' => 'mo_2fa_notifications' ), $_SERVER['REQUEST_URI'] );
59
+ $reports_url = add_query_arg( array('page' => 'mo_2fa_reports' ), $_SERVER['REQUEST_URI'] );
60
+ $license_url = add_query_arg( array('page' => 'mo_2fa_upgrade' ), $_SERVER['REQUEST_URI'] );
61
+ $help_url = add_query_arg( array('page' => 'mo_2fa_troubleshooting' ), $_SERVER['REQUEST_URI'] );
62
+ $addons_url = add_query_arg( array('page' => 'mo_2fa_addons' ), $_SERVER['REQUEST_URI'] );
63
+ $content_protect= add_query_arg( array('page' => 'content_protect' ), $_SERVER['REQUEST_URI'] );
64
+ $backup = add_query_arg( array('page' => 'mo_2fa_backup' ), $_SERVER['REQUEST_URI'] );
65
+ $scan_url = add_query_arg( array('page' => 'mo_2fa_malwarescan' ), $_SERVER['REQUEST_URI'] );
66
+ $two_fa = add_query_arg( array('page' => 'mo_2fa_two_fa' ), $_SERVER['REQUEST_URI'] );
67
+ //Added for new design
68
+ $dashboard_url = add_query_arg(array('page' => 'mo_2fa_dashboard' ), $_SERVER['REQUEST_URI']);
69
+ $upgrade_url = add_query_arg(array('page' => 'mo_2fa_upgrade' ), $_SERVER['REQUEST_URI']);
70
+ $request_demo_url = add_query_arg(array('page' => 'mo_2fa_request_demo' ), $_SERVER['REQUEST_URI']);
71
+ $request_offer_url = add_query_arg(array('page' => 'mo_2fa_request_offer' ), $_SERVER['REQUEST_URI']);
72
+
73
+ //dynamic
74
+ $logo_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/miniorange_logo.png';
75
+ $login_with_usename_only_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/login-with-password-and-2fa.png';
76
+ $hide_login_form_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/hide_login_form.png';
77
+ $new_url = plugin_dir_url(dirname(__FILE__)) . 'includes/images/new.png';
78
+ $shw_feedback = get_option('donot_show_feedback_message') ? false: true;
79
+
80
+ $moPluginHandler= new MoWpnsHandler();
81
+ $safe = $moPluginHandler->is_whitelisted($moWpnsUtility->get_client_ip());
82
+
83
+ $active_tab = $_GET['page'];
84
+
85
+ $user_id = get_current_user_id();
86
+ $mo2f_two_fa_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user_id );
87
+ $backup_codes_remaining = get_user_meta($user_id, 'mo2f_backup_codes', true);
88
+ if(is_array($backup_codes_remaining)){
89
+ $backup_codes_remaining = sizeof($backup_codes_remaining);
90
+ }else{
91
+ $backup_codes_remaining = 0;
92
+ }
93
+
94
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'navbar.php';
controllers/notification-settings.php CHANGED
@@ -1,101 +1,101 @@
1
- <?php
2
-
3
- global $moWpnsUtility,$mo2f_dirName;
4
-
5
- $template1 = "Hello,<br><br>The user with IP Address <b>##ipaddress##</b> has exceeded allowed trasaction limit on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
6
- $template2 = "Hello ##username##,<br><br>Your account was logged in from new IP Address <b>##ipaddress##</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".MoWpnsConstants::SUPPORT_EMAIL."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo();
7
-
8
- if(current_user_can( 'manage_options' ) && isset($_POST['option']) )
9
- {
10
- switch($_POST['option'])
11
- {
12
- case "mo_wpns_enable_ip_blocked_email_to_admin":
13
- wpns_handle_notify_admin_on_ip_block($_POST); break;
14
- case "mo_wpns_enable_unusual_activity_email_to_user":
15
- wpns_handle_notify_unusual_activity($_POST); break;
16
- case "custom_user_template":
17
- wpns_handle_custom_template($_POST['custom_user_template']); break;
18
- case "mo_wpns_get_manual_email" :
19
- wpns_handle_admin_email($_POST); break;
20
- case "custom_admin_template":
21
- wpns_handle_custom_template(null,$_POST['custom_admin_template']); break;
22
- }
23
- }
24
- if(!get_option("admin_email_address_status")|| get_option("admin_email_address") ==''){
25
- update_option('mo_wpns_enable_ip_blocked_email_to_admin','0');
26
- $notify_admin_on_ip_block = MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option') ? "" : "unchacked";
27
- }
28
- $notify_admin_on_ip_block = MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option') ? "checked" : "";
29
- $notify_admin_unusual_activity = get_option('mo_wpns_enable_unusual_activity_email_to_user') ? "checked" : "";
30
-
31
- $template1 = get_option('custom_admin_template') ? get_option('custom_admin_template') : $template1;
32
- $template_type1 = 'custom_admin_template';
33
- $ip_blocking_template = array(
34
- 'textarea_name' => 'custom_admin_template',
35
- 'wpautop' => false
36
- );
37
- $fromEmail = get_option('mo2f_email');
38
- $template2 = get_option('custom_user_template') ? get_option('custom_user_template') : $template2;
39
- $template_type2 = 'custom_user_template';
40
- $user_activity_template = array(
41
- 'textarea_name' => 'custom_user_template',
42
- 'wpautop' => false
43
- );
44
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'notification-settings.php';
45
-
46
-
47
-
48
- /* ADMIN NOTIFICATION SETTINGS */
49
- function wpns_handle_admin_email($postValue)
50
- {
51
- $email = sanitize_email($_POST['admin_email_address']);
52
- if(validate_email($email)){
53
- $admin_email_address_status = isset($postValue['admin_email_address']) ? '1' :'0';
54
- update_option('admin_email_address',$email);
55
- update_option( 'admin_email_address_status', $admin_email_address_status);
56
- do_action('wpns_show_message',MoWpnsMessages::showMessage('EMAIL_SAVED'),'SUCCESS');
57
- }else{
58
- do_action('wpns_show_message',MoWpnsMessages::showMessage('INVALID_EMAIL'),'ERROR');
59
- }
60
- }
61
- function validate_email($str) {
62
- return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
63
- }
64
-
65
- //Function to handle enabling and disabling of admin notification on ip blocking
66
- function wpns_handle_notify_admin_on_ip_block($postValue)
67
- {
68
- $enable_ip_blocked_email_to_admin = isset($postValue['enable_ip_blocked_email_to_admin']) ? true : false;
69
- update_option( 'mo_wpns_enable_ip_blocked_email_to_admin', $enable_ip_blocked_email_to_admin);
70
-
71
- if($enable_ip_blocked_email_to_admin)
72
- do_action('wpns_show_message',MoWpnsMessages::showMessage('NOTIFY_ON_IP_BLOCKED'),'SUCCESS');
73
- else
74
- do_action('wpns_show_message',MoWpnsMessages::showMessage('DONOT_NOTIFY_ON_IP_BLOCKED'),'ERROR');
75
- }
76
-
77
-
78
- //Function to handle enabling and disabling of admin notification on unusual activity
79
- function wpns_handle_notify_unusual_activity($postValue)
80
- {
81
- $enable_unusual_activity_email_to_user = isset($postValue['enable_unusual_activity_email_to_user']) ? true : false;
82
- update_option( 'mo_wpns_enable_unusual_activity_email_to_user', $enable_unusual_activity_email_to_user);
83
-
84
- if($enable_unusual_activity_email_to_user)
85
- do_action('wpns_show_message',MoWpnsMessages::showMessage('NOTIFY_ON_UNUSUAL_ACTIVITY'),'SUCCESS');
86
- else
87
- do_action('wpns_show_message',MoWpnsMessages::showMessage('DONOT_NOTIFY_ON_UNUSUAL_ACTIVITY'),'ERROR');
88
- }
89
-
90
-
91
- //Function to save unusual activity email template
92
- function wpns_handle_custom_template($template1,$template2=null)
93
- {
94
- if(!is_null($template1))
95
- update_option('custom_user_template', stripslashes($template1));
96
-
97
- if(!is_null($template2))
98
- update_option('custom_admin_template', stripslashes($template2));
99
-
100
- do_action('wpns_show_message',MoWpnsMessages::showMessage('TEMPLATE_SAVED'),'SUCCESS');
101
  }
1
+ <?php
2
+
3
+ global $moWpnsUtility,$mo2f_dirName;
4
+
5
+ $template1 = "Hello,<br><br>The user with IP Address <b>##ipaddress##</b> has exceeded allowed trasaction limit on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
6
+ $template2 = "Hello ##username##,<br><br>Your account was logged in from new IP Address <b>##ipaddress##</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".MoWpnsConstants::SUPPORT_EMAIL."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo();
7
+
8
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']) )
9
+ {
10
+ switch($_POST['option'])
11
+ {
12
+ case "mo_wpns_enable_ip_blocked_email_to_admin":
13
+ wpns_handle_notify_admin_on_ip_block($_POST); break;
14
+ case "mo_wpns_enable_unusual_activity_email_to_user":
15
+ wpns_handle_notify_unusual_activity($_POST); break;
16
+ case "custom_user_template":
17
+ wpns_handle_custom_template($_POST['custom_user_template']); break;
18
+ case "mo_wpns_get_manual_email" :
19
+ wpns_handle_admin_email($_POST); break;
20
+ case "custom_admin_template":
21
+ wpns_handle_custom_template(null,$_POST['custom_admin_template']); break;
22
+ }
23
+ }
24
+ if(!get_option("admin_email_address_status")|| get_option("admin_email_address") ==''){
25
+ update_option('mo_wpns_enable_ip_blocked_email_to_admin','0');
26
+ $notify_admin_on_ip_block = MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option') ? "" : "unchacked";
27
+ }
28
+ $notify_admin_on_ip_block = MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option') ? "checked" : "";
29
+ $notify_admin_unusual_activity = get_option('mo_wpns_enable_unusual_activity_email_to_user') ? "checked" : "";
30
+
31
+ $template1 = get_option('custom_admin_template') ? get_option('custom_admin_template') : $template1;
32
+ $template_type1 = 'custom_admin_template';
33
+ $ip_blocking_template = array(
34
+ 'textarea_name' => 'custom_admin_template',
35
+ 'wpautop' => false
36
+ );
37
+ $fromEmail = get_option('mo2f_email');
38
+ $template2 = get_option('custom_user_template') ? get_option('custom_user_template') : $template2;
39
+ $template_type2 = 'custom_user_template';
40
+ $user_activity_template = array(
41
+ 'textarea_name' => 'custom_user_template',
42
+ 'wpautop' => false
43
+ );
44
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'notification-settings.php';
45
+
46
+
47
+
48
+ /* ADMIN NOTIFICATION SETTINGS */
49
+ function wpns_handle_admin_email($postValue)
50
+ {
51
+ $email = sanitize_email($_POST['admin_email_address']);
52
+ if(validate_email($email)){
53
+ $admin_email_address_status = isset($postValue['admin_email_address']) ? '1' :'0';
54
+ update_option('admin_email_address',$email);
55
+ update_option( 'admin_email_address_status', $admin_email_address_status);
56
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('EMAIL_SAVED'),'SUCCESS');
57
+ }else{
58
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('INVALID_EMAIL'),'ERROR');
59
+ }
60
+ }
61
+ function validate_email($str) {
62
+ return (!preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $str)) ? FALSE : TRUE;
63
+ }
64
+
65
+ //Function to handle enabling and disabling of admin notification on ip blocking
66
+ function wpns_handle_notify_admin_on_ip_block($postValue)
67
+ {
68
+ $enable_ip_blocked_email_to_admin = isset($postValue['enable_ip_blocked_email_to_admin']) ? true : false;
69
+ update_option( 'mo_wpns_enable_ip_blocked_email_to_admin', $enable_ip_blocked_email_to_admin);
70
+
71
+ if($enable_ip_blocked_email_to_admin)
72
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('NOTIFY_ON_IP_BLOCKED'),'SUCCESS');
73
+ else
74
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('DONOT_NOTIFY_ON_IP_BLOCKED'),'ERROR');
75
+ }
76
+
77
+
78
+ //Function to handle enabling and disabling of admin notification on unusual activity
79
+ function wpns_handle_notify_unusual_activity($postValue)
80
+ {
81
+ $enable_unusual_activity_email_to_user = isset($postValue['enable_unusual_activity_email_to_user']) ? true : false;
82
+ update_option( 'mo_wpns_enable_unusual_activity_email_to_user', $enable_unusual_activity_email_to_user);
83
+
84
+ if($enable_unusual_activity_email_to_user)
85
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('NOTIFY_ON_UNUSUAL_ACTIVITY'),'SUCCESS');
86
+ else
87
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('DONOT_NOTIFY_ON_UNUSUAL_ACTIVITY'),'ERROR');
88
+ }
89
+
90
+
91
+ //Function to save unusual activity email template
92
+ function wpns_handle_custom_template($template1,$template2=null)
93
+ {
94
+ if(!is_null($template1))
95
+ update_option('custom_user_template', stripslashes($template1));
96
+
97
+ if(!is_null($template2))
98
+ update_option('custom_admin_template', stripslashes($template2));
99
+
100
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('TEMPLATE_SAVED'),'SUCCESS');
101
  }
controllers/request_offer.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
-
3
-
4
- if(current_user_can( 'manage_options' ) && isset($_POST['option']) )
5
- {
6
- switch($_POST['option'])
7
- {
8
- case "mo_2FA_offer_request_form":
9
- wpns_handle_offer_request_form($_POST); break;
10
- }
11
- }
12
-
13
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'request_offer.php';
14
-
15
- function wpns_handle_offer_request_form($post){
16
- $nonce = sanitize_text_field($post['nonce']);
17
- $usecase = isset($post['mo_2FA_offer_usecase'])? sanitize_text_field($post['mo_2FA_offer_usecase']): NULL;
18
- $email = isset($post['mo_2FA_offer_email'])? sanitize_text_field($post['mo_2FA_offer_email']) : NULL;
19
- if ( ! wp_verify_nonce( $nonce, 'mo2f-Request-offer' ) ){
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
- $query = 'REQUEST FOR NEW YEAR OFFERS';
30
- $query .= ' =>';
31
- $query .= ' : ';
32
- $query .= $usecase;
33
- $contact_us = new MocURL();
34
- $submited = json_decode($contact_us->submit_contact_us($email, '', $query),true);
35
-
36
- if(json_last_error() == JSON_ERROR_NONE && $submited)
37
- {
38
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_SENT'),'SUCCESS');
39
- return;
40
- }
41
- else{
42
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
43
- }
44
- }
45
- }
46
  ?>
1
+ <?php
2
+
3
+
4
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']) )
5
+ {
6
+ switch($_POST['option'])
7
+ {
8
+ case "mo_2FA_offer_request_form":
9
+ wpns_handle_offer_request_form($_POST); break;
10
+ }
11
+ }
12
+
13
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'request_offer.php';
14
+
15
+ function wpns_handle_offer_request_form($post){
16
+ $nonce = sanitize_text_field($post['nonce']);
17
+ $usecase = isset($post['mo_2FA_offer_usecase'])? sanitize_text_field($post['mo_2FA_offer_usecase']): NULL;
18
+ $email = isset($post['mo_2FA_offer_email'])? sanitize_text_field($post['mo_2FA_offer_email']) : NULL;
19
+ if ( ! wp_verify_nonce( $nonce, 'mo2f-Request-offer' ) ){
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
+ $query = 'REQUEST FOR NEW YEAR OFFERS';
30
+ $query .= ' =>';
31
+ $query .= ' : ';
32
+ $query .= $usecase;
33
+ $contact_us = new MocURL();
34
+ $submited = json_decode($contact_us->submit_contact_us($email, '', $query),true);
35
+
36
+ if(json_last_error() == JSON_ERROR_NONE && $submited)
37
+ {
38
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_SENT'),'SUCCESS');
39
+ return;
40
+ }
41
+ else{
42
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
43
+ }
44
+ }
45
+ }
46
  ?>
controllers/support.php CHANGED
@@ -1,77 +1,81 @@
1
- <?php
2
-
3
- global $mo2f_dirName;
4
-
5
- if(current_user_can( 'manage_options' ) && isset($_POST['option']))
6
- {
7
- switch($_POST['option'])
8
- {
9
- case "mo_wpns_send_query":
10
- wpns_handle_support_form($_POST['query_email'],$_POST['query'],$_POST['query_phone']); break;
11
- }
12
- }
13
-
14
- $current_user = wp_get_current_user();
15
- $email = get_option("mo2f_email");
16
- $phone = get_option("mo_wpns_admin_phone");
17
-
18
-
19
- if(empty($email))
20
- $email = $current_user->user_email;
21
-
22
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'support.php';
23
-
24
-
25
- /* SUPPORT FORM RELATED FUNCTIONS */
26
-
27
- //Function to handle support form submit
28
- function wpns_handle_support_form($email,$query,$phone)
29
- {
30
- $call_setup = false;
31
- if(array_key_exists('2fa_setup_call',$_POST)===true){
32
- $time_zone = sanitize_text_field($_POST['mo_2fa_setup_call_timezone']);
33
- $call_date = sanitize_text_field($_POST['mo_2fa_setup_call_date']);
34
- $call_time = sanitize_text_field($_POST['mo_2fa_setup_call_time']);
35
- $call_setup = true;
36
- }
37
- $send_configuration = (isset($_POST['mo2f_send_configuration'])?$_POST['mo2f_send_configuration']:0);
38
- if(empty($email) || empty($query)){
39
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_VALUES'),'ERROR');
40
- return;
41
- }
42
- $query = sanitize_text_field( $query );
43
- $email = sanitize_text_field( $email );
44
- $phone = sanitize_text_field( $phone );
45
- $contact_us = new MocURL();
46
-
47
- if($send_configuration)
48
- $query = $query.MoWpnsUtility::mo_2fa_send_configuration(true);
49
- else
50
- $query = $query.MoWpnsUtility::mo_2fa_send_configuration();
51
-
52
- if($call_setup == false) {
53
- $query = $query.'<br><br>';
54
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
55
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
56
- } else {
57
- $submited = json_decode($contact_us->submit_contact_us( $email, $phone, $query),true);
58
- }
59
- } else {
60
-
61
- $local_timezone='Asia/Kolkata';
62
- $call_datetime=$call_date.$call_time;
63
- $convert_datetime = strtotime ( $call_datetime );
64
- $ist_date = new DateTime(date ( 'Y-m-d H:i:s' , $convert_datetime ), new DateTimeZone($time_zone));
65
- $ist_date->setTimezone(new DateTimeZone($local_timezone));
66
-
67
-
68
- $query = $query . '<br><br>' .'Meeting Details: '.'('.$time_zone.') '. date('d M, Y H:i',$convert_datetime). ' [IST Time -> '. $ist_date->format('d M, Y H:i').']'.'<br><br>';
69
- $submited = json_decode($contact_us->submit_contact_us( $email, $phone, $query, true),true);
70
-
71
- }
72
- if(json_last_error() == JSON_ERROR_NONE && $submited){
73
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_SENT'),'SUCCESS');
74
- }else{
75
- do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
76
- }
77
- }
 
 
 
 
1
+ <?php
2
+
3
+ global $mo2f_dirName;
4
+
5
+ if(current_user_can( 'manage_options' ) && isset($_POST['option']))
6
+ {
7
+
8
+
9
+ switch($_POST['option'])
10
+ {
11
+ case "mo_wpns_send_query":
12
+ wpns_handle_support_form($_POST['query_email'],$_POST['query'],$_POST['query_phone']); break;
13
+ }
14
+ }
15
+
16
+ $current_user = wp_get_current_user();
17
+ $email = get_option("mo2f_email");
18
+ $phone = get_option("mo_wpns_admin_phone");
19
+
20
+
21
+ if(empty($email))
22
+ $email = $current_user->user_email;
23
+
24
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'support.php';
25
+
26
+
27
+ /* SUPPORT FORM RELATED FUNCTIONS */
28
+
29
+ //Function to handle support form submit
30
+ function wpns_handle_support_form($email,$query,$phone)
31
+ {
32
+
33
+ $call_setup = false;
34
+ if(array_key_exists('2fa_setup_call',$_POST)===true){
35
+ $time_zone = sanitize_text_field($_POST['mo_2fa_setup_call_timezone']);
36
+ $call_date = sanitize_text_field($_POST['mo_2fa_setup_call_date']);
37
+ $call_time = sanitize_text_field($_POST['mo_2fa_setup_call_time']);
38
+ $call_setup = true;
39
+ }
40
+ $send_configuration = (isset($_POST['mo2f_send_configuration'])?$_POST['mo2f_send_configuration']:0);
41
+ if(empty($email) || empty($query)){
42
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_VALUES'),'ERROR');
43
+ return;
44
+ }
45
+ $query = sanitize_text_field( $query );
46
+ $email = sanitize_text_field( $email );
47
+ $phone = sanitize_text_field( $phone );
48
+ $contact_us = new MocURL();
49
+
50
+ if($send_configuration)
51
+ $query = $query.MoWpnsUtility::mo_2fa_send_configuration(true);
52
+ else
53
+ $query = $query.MoWpnsUtility::mo_2fa_send_configuration();
54
+
55
+
56
+ if($call_setup == false) {
57
+ $query = $query.'<br><br>';
58
+ if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
59
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
60
+ } else {
61
+ $submited = json_decode($contact_us->submit_contact_us( $email, $phone, $query),true);
62
+ }
63
+ } else {
64
+
65
+ $local_timezone='Asia/Kolkata';
66
+ $call_datetime=$call_date.$call_time;
67
+ $convert_datetime = strtotime ( $call_datetime );
68
+ $ist_date = new DateTime(date ( 'Y-m-d H:i:s' , $convert_datetime ), new DateTimeZone($time_zone));
69
+ $ist_date->setTimezone(new DateTimeZone($local_timezone));
70
+
71
+
72
+ $query = $query . '<br><br>' .'Meeting Details: '.'('.$time_zone.') '. date('d M, Y H:i',$convert_datetime). ' [IST Time -> '. $ist_date->format('d M, Y H:i').']'.'<br><br>';
73
+ $submited = json_decode($contact_us->submit_contact_us( $email, $phone, $query, true),true);
74
+
75
+ }
76
+ if(json_last_error() == JSON_ERROR_NONE && $submited){
77
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_SENT'),'SUCCESS');
78
+ }else{
79
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('SUPPORT_FORM_ERROR'),'ERROR');
80
+ }
81
+ }
controllers/tour-model.php CHANGED
@@ -1,334 +1,334 @@
1
- <?php
2
-
3
- global $mo2f_dirName;
4
- $current_user = wp_get_current_user();
5
- $email = get_option("mo2f_email");
6
- $phone = get_option("mo_wpns_admin_phone");
7
- $display = get_option('mo2f_tour_started') == 2?'block':'none';
8
- $networkSEnable = MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option');
9
- if(empty($email))
10
- $email = $current_user->user_email;
11
- $counter = 0;
12
- $enableTour = $networkSEnable == 1 ? '' : 'disabled';
13
- $tour_body = '<p class="modal-body-para">Hey, Thank you for installing <b style="color: #E85700">miniOrange 2-Factor plugin</b>.</p>
14
- <p class="modal-body-para">Two-factor will provide extra layer of security to your users account which will help to protect your users accounts from any outside attack.</p>';
15
- if($networkSEnable != 1)
16
- {
17
- $tour_body .= '<div style="margin-left:37.5%;margin-right:37.5%;">';
18
- }
19
-
20
- $tour_body .= '<table style="width: 100%; text-align: center; table-layout: fixed; font-size: medium;">
21
- <div class="mo2f_hiddenradio">
22
- <tr>
23
-
24
- <td style="border: 1px solid black;" id="2fa">
25
- <label>
26
- <input type="radio" name="mo2f_two_factor" value="2fa" checked style="display:none">
27
- <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/google-authenticator.png">
28
- </label>
29
- </td>';
30
- if($networkSEnable == 1)
31
- {
32
- $tour_body .= '<td style="border: 1px solid black;" id="waf">
33
- <label >
34
- <input type="radio" name="mo2f_two_factor" value="waf" style="display:none" '.$enableTour.'>
35
- <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/mo-waf-logo.png">
36
- </label>
37
- </td>
38
-
39
- <td style="border: 1px solid black;" id="login">
40
- <label >
41
- <input type="radio" name="mo2f_two_factor" value="login" style="display:none"'.$enableTour.'>
42
- <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/login-protection-logo.png">
43
- </label>
44
- </td>
45
-
46
- <td style="border: 1px solid black;" id="backup">
47
- <label>
48
- <input type="radio" name="mo2f_two_factor" value="backup" style="display:none"'.$enableTour.'>
49
- <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/database-backup-logo.png">
50
- </label>
51
- </td>
52
-
53
- <td style="border: 1px solid black;" id="malware">
54
- <label >
55
- <input type="radio" name="mo2f_two_factor" value="malware" style="display:none"'.$enableTour.'>
56
- <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/malware-scanner-logo.png">
57
- </label>
58
- </td>';
59
- }
60
- $tour_body .= '</tr>
61
- <tr>
62
- <th>
63
- Two-factor authentication
64
- </th>';
65
-
66
- if($networkSEnable == 1)
67
- {
68
-
69
- $tour_body .= '<th>
70
- Web Application Firewall(WAF)
71
- </th>
72
-
73
- <th>
74
- Login Protection
75
- </th>
76
-
77
- <th>
78
- Database Backup
79
- </th>
80
-
81
- <th>
82
- Malware scanner
83
- </th>';
84
- }
85
-
86
- $tour_body .= '</tr>
87
- </div>
88
- </table>';
89
- if($networkSEnable != 1)
90
- {
91
- $tour_body .= '</div>';
92
- }
93
-
94
- $waf_arr_ecc = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It includes very sensitive data such as user details, credit/debit card or bank details. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Media scraping, price scraping are also some scraping techniques which are used to degrade/destroy media files and change the price of products.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business. <div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
95
-
96
- $waf_arr_busi = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It may include company privileged data, admin users data which will affect on the business. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Price scraping is part of web scraping which is used to change prices of the products which affects a lot on business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
97
-
98
- $waf_arr_blog = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation. The data may include user details, privileged data, privileged blogs, etc.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Media scraping can be done in the blog/news site which alter, degrade or destroy media files.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations. Content modification may mislead to blog/news site subscriber. It can be used to spread fake/malicious imformation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
99
-
100
- $waf_arr_other = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business. </div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
101
-
102
- $waf_body_ecommerce = '<div class="modal-body-div">
103
- <p class="modal-body-para" style="margin: 0;">Ecommerce sites are always under attack to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
104
- $waf_body_business = '<div class="modal-body-div">
105
- <p class="modal-body-para" style="margin: 0;">Business sites are always under attack to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
106
- $waf_body_blog = '<div class="modal-body-div">
107
- <p class="modal-body-para" style="margin: 0;">Blogs/News sites are attacked to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
108
- $waf_body_other = '<div class="modal-body-div">
109
- <p class="modal-body-para" style="margin: 0;">Other sites such as employment, portfolio, multilingual, etc are attacked to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
110
-
111
- $waf_body = '<div style="width:100%; display:inline-flex; margin-left: 20px;">
112
- <div style="width:50%;font-size: medium;">1: <b>Data theft and manipulation</b></div>
113
- <div style="width:50%;font-size: medium;">2: <b>Web Scraping</b></div></div>
114
- <div style="width:100%; display:inline-flex; margin-left: 20px;">
115
- <div style="width:50%;font-size: medium;">3: <b>File manipulation</b></div>
116
- <div style="width:50%;font-size: medium;">4: <b>Content modification</b></div></div>
117
- </div>';
118
-
119
- $registration_security_ecommerce = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> Ecommerce sites need to prevent fake registrations. It helps to keep site safe from suspicious user.';
120
- $registration_security_business = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> Business sites need to prevent fake registrations. It helps to keep site safe from suspicious user.';
121
-
122
- $registration_security_other = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> The sites such as employment, social networking, etc. need to prevent fake user registrations. The user will spam other users and share private data of others.';
123
-
124
- $registration_security = '<div style="margin:1em;"><ul>
125
- <li>
126
- <p class="modal-body-para" style="margin: 0;">1. Temporary/Fake email ban</p>
127
- </li>
128
- <li>
129
- <p class="modal-body-para" style="margin: 0;">2. OTP Verification during registrations</p>
130
- </li>
131
- <li>
132
- <p class="modal-body-para" style="margin: 0;">3. Social login</p>
133
- </li>
134
- </ul>
135
- </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-13" onclick="open_hide(this);">+</a></div></div>';
136
-
137
- $login_security_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce sites should have strong login security to prevent unauthorised access.</p></div>';
138
- $login_security_business = '<div class="modal-body-div"><p class="modal-body-para">Business sites should have strong login security to prevent unauthorised access.</p></div>';
139
- $login_security_blog = '<div class="modal-body-div"><p class="modal-body-para">Blogs/News sites should have strong login security to prevent unauthorised access.</p></div>';
140
- $login_security_other = '<div class="modal-body-div"><p class="modal-body-para">Other sites such as employment, portfolio, etc. should have strong login security to prevent unauthorised access.</p></div>';
141
-
142
- $login_security_body = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-10" style="width: 98%; overflow:; height: ;line-height: 1.5;"><b><u>Limit Login:</u></b> Password guessing/Brute force attack can be controlled/prevented by limiting the login attempts. Paasword guessing can be protected by:
143
- <div style="margin:1em;">
144
- <ul>
145
- <li>
146
- <p class="modal-body-para">1. Limit Login attempts: 10 (<b>Recommended</b>)</p>
147
- </li>
148
- <li>
149
- <p class="modal-body-para">2. Enforce Strong passwords</p>
150
- </li>
151
- </ul>
152
- </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-10" onclick="open_hide(this);">-</a></div></div>
153
-
154
- <div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-11" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>2-Factor:</u></b> 2-factor authentication is important to prevent unauthorised login. 2-factor authentication can be enabled on top of login credentials at the time of login. Google authenticator, Authy authenticator, Lastpass authenticator applications can be used to configure 2FA. miniOrange supports 15+ 2FA methods, it includes OTP over SMS, Email, Security Questions, QR code authentication, push notification, Hardware Token, etc. 2FA can enabled to:
155
- <div style="margin:1em;">
156
- <ul>
157
- <li>
158
- <p class="modal-body-para">1. Enable 2FA for employees (<b>Recommended</b>)</p>
159
- </li>
160
- <li>
161
- <p class="modal-body-para">2. Enable 2FA for users</p>
162
- </li>
163
- <li>
164
- <p class="modal-body-para">3. Backup methods in case of emergency login</p>
165
- </li>
166
- </ul>
167
- </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-11" onclick="open_hide(this);">+</a></div></div>
168
- <div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-12" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Remember device:</u></b> Remember device allows user to login from trusted devices. It keeps safe from unauthorised users who tries to gain access. It improves your login security by allowing you to login from limited and trusted deivces.
169
- <div style="margin:1em;">
170
- <ul>
171
- <li>
172
- <p class="modal-body-para">1. Allows multiple trusted devices</p>
173
- </li>
174
- <li>
175
- <p class="modal-body-para">2. Limit no. of trusted devices</p>
176
- </li>
177
- <li>
178
- <p class="modal-body-para">3. Block IP\'s of unauthorised users</p>
179
- </li>
180
- </ul>
181
- </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-12" onclick="open_hide(this);">+</a></div></div>';
182
-
183
-
184
- $media_body = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce sites are often attacked to degrade and destroy media files such as images of product, audios and videos about products. You need to secure your media data. Media protection is important because the users of ecommerce site buy product by viewing the media of products. The broad word media scraping can be used for these types attacks.</p>
185
- <div class="modal-body-div modal-body-para">Here is our <a target="_blank" href="https://wordpress.org/plugins/prevent-file-access/">Media protection</a> plugin.</div>
186
- <div class="modal-body-div">The Media protection prevents media files listed below:</div>
187
- </div>
188
- <div style="margin:1em;">
189
- <ul>
190
- <li>
191
- <p class="modal-body-para">1. It protects all type of image files, audio, video and gif files.</p>
192
- </li>
193
- <li>
194
- <p class="modal-body-para">2. It also prevents access to documents such as pdf, doc, docx, txt, xls, xlsx, etc.</p>
195
- </li>
196
- </ul>
197
- </div>';
198
-
199
- $media_body_1 = '<div class="modal-body-div"><p class="modal-body-para">Some sites such as Photo Gallery or other site which contains media files are often attacked to degrade and destroy media files. You need to secure your media data. Media protection is important because the these sites are totally based on media files.</p>
200
- <div class="modal-body-div modal-body-para">Here is our <a target="_blank" href="https://wordpress.org/plugins/prevent-file-access/">Media protection</a> plugin.</div>
201
- <div class="modal-body-div">The Media protection prevents media files listed below:</div>
202
- </div>
203
- <div style="margin:1em;">
204
- <ul>
205
- <li>
206
- <p class="modal-body-para">1. It protects all type of image files, audio, video and gif files.</p>
207
- </li>
208
- <li>
209
- <p class="modal-body-para">2. It also prevents access to documents such as pdf, doc, docx, txt, xls, xlsx, etc.</p>
210
- </li>
211
- </ul>
212
- </div>';
213
-
214
- $backup_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any e-commerce site. The ecommerce sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
215
- $backup_business = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any Business site. The business sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
216
- $backup_blog = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any Blog/News site. These sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
217
- $backup_blog = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any site such as social networking, employment, etc. There are several attacks happens on these sites to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
218
-
219
-
220
- $backup_body = '<div class="modal-body-div">
221
- <ul>
222
- <li>
223
- <p class="modal-body-para"><b>1. <u>Scheduled backup:</u></b> Scheduled backup used to create automatic backup after scheduled time. It allows you to relax because you know that all of your information is being backed up, and you are limiting what you may lose. Using this feature you can set a time interval to create a continuous backup. ';
224
- $backup_body_1 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">Set scheduled backup time 1/2 hr for ecommerce site.</span></div>';
225
- $backup_body_2 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">You can set automatic backup after 12 hrs time interval.</span></div>';
226
- $backup_body_3 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">You can set automatic backup after 4-5 hrs time interval.</span></div>';
227
- $backup_body_4 = '</p>
228
- </li>
229
- <li>
230
- <p class="modal-body-para"><b>2. <u>Manual backup:</u></b> Manual backup can be taken manually whenever user wants. It is important when you made any crucial changes and don\'t want to loose data then you can immediately take a backup and keep it securely.</p>
231
- </li>
232
- <li>
233
- <p class="modal-body-para"><b>3. <u>Password protected encrypted backup:</u></b> Password protected encrypted backup is very secure way to take a backup. If anyone gets it still no one can decode it because of its highly secure nature.</p>
234
- </li>
235
- <li>
236
- <p class="modal-body-para"><b>4. <u>Easy restoring and recovering:</u></b> Simple one-click restore using installer files created for your website. During backup, we create an installer.php file. At the time of restore and recovery, you just need to upload the zip file of backup and installer.php and run the installer file and follow instructions to set up your website.</p>
237
- </li>
238
- </ul>
239
- </div>';
240
-
241
- $comment_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce websites are attacked to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
242
- $comment_business = '<div class="modal-body-div"><p class="modal-body-para">Business websites are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
243
- $comment_blog = '<div class="modal-body-div"><p class="modal-body-para">Blog/News websites are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
244
- $comment_other = '<div class="modal-body-div"><p class="modal-body-para">Other websites such as employment, multilingual, etc. are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
245
-
246
- $comment_spam = '<div style="margin:1em;">
247
- <ul>
248
- <li>
249
- <p class="modal-body-para"><b>1. <u>Comment protection:</u></b> Spam comments generated by automated scripts can be prevented using captcha. Honeypot is another widely used technique to catch bots and block them.</p>
250
- </li>
251
- <li>
252
- <p class="modal-body-para"><b>2. <u>Post protection:</u></b> Automated scripts or botnets can prevented by using captcha. There are three forms of captcha availble text, math and google recaptcha. Honeypot is also another way to detect spam posts. Malware scanner can also used to scan the malware in the posts.</p>
253
- </li>
254
- </ul>
255
- </div>';
256
-
257
-
258
- $scanner = '<div class="modal-body-div"><p class="modal-body-para">Malware scanner detects the malicious code in the files. Compares the wordpress, plugins and theme files with Wordpress repo files. Detects changes present in any wordpress, theme and plugin files. It also checks outdated/vulnerable plugins, themes. It is also useful to detect malware in posts and comments.</p></div>
259
- <div style="margin:1em;">
260
- <ul>
261
- <li>
262
- <p class="modal-body-para"><b>1. <u>Malware scan:</u></b> Malware scan scans the wordpress core files, plugins and theme files to check malware. It detects the trojans, backdoors, viruses, worms, etc. in the files. </p>
263
- </li>
264
- <li>
265
- <p class="modal-body-para"><b>2. <u>Wordpress version and file compare:</u></b> Checks WordPress, plugins and themes version with Wordpress.org repository and compare WordPress core, plugins and themes files with the repository to detect any file changes. Detect any changes in the files present in the WordPress plugins and themes folder.</p>
266
- </li>
267
- <li>
268
- <p class="modal-body-para"><b>3. <u>Check vulnerable plugins and themes:</u></b> Checks vulnerable plugins and themes which contains malicious code. You can remove it to enhance your site security.</p>
269
- </li>
270
- </ul>
271
- </div>';
272
-
273
- $support_modal = '<div>
274
-
275
- <div style="width: unset; float: unset; margin: 10px 20%;" class="mo_wpns_support_layout_model">
276
-
277
- <img src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/support3.png">
278
- <h1>Support</h1>
279
- <p>Need any help? We are available any time, Just send us a query so we can help you.</p>
280
- <form name="f" method="post" action="">
281
- <input type="hidden" name="option" value="mo_wpns_send_query"/>
282
- <table class="mo_wpns_settings_table">
283
- <tr><td>
284
- <input type="email" class="mo_wpns_table_textbox" id="query_email" name="query_email" value="'.$email.'" placeholder="Enter your email" required />
285
- </td>
286
- </tr>
287
- <tr><td>
288
- <input type="text" class="mo_wpns_table_textbox" name="query_phone" id="query_phone" value="'.$phone.'" placeholder="Enter your phone"/>
289
- </td>
290
- </tr>
291
- <tr>
292
- <td>
293
- <textarea id="query" name="query" class="mo_wpns_settings_textarea" style="resize: vertical;width:100%" cols="52" rows="7" onkeyup="mo_wpns_valid(this)" onblur="mo_wpns_valid(this)" onkeypress="mo_wpns_valid(this)" placeholder="Write your query here"></textarea>
294
- </td>
295
- </tr>
296
- </table>
297
- <input type="submit" name="send_query" id="send_query" value="Submit Query" class="mo_wpns_button mo_wpns_button1" />
298
- </form>
299
- <br />
300
- </div>
301
- </div>
302
- <script>
303
- function moSharingSizeValidate(e){
304
- var t=parseInt(e.value.trim());t>60?e.value=60:10>t&&(e.value=10)
305
- }
306
- function moSharingSpaceValidate(e){
307
- var t=parseInt(e.value.trim());t>50?e.value=50:0>t&&(e.value=0)
308
- }
309
- function moLoginSizeValidate(e){
310
- var t=parseInt(e.value.trim());t>60?e.value=60:20>t&&(e.value=20)
311
- }
312
- function moLoginSpaceValidate(e){
313
- var t=parseInt(e.value.trim());t>60?e.value=60:0>t&&(e.value=0)
314
- }
315
- function moLoginWidthValidate(e){
316
- var t=parseInt(e.value.trim());t>1000?e.value=1000:140>t&&(e.value=140)
317
- }
318
- function moLoginHeightValidate(e){
319
- var t=parseInt(e.value.trim());t>50?e.value=50:35>t&&(e.value=35)
320
- }
321
- </script>';
322
-
323
-
324
- $ecommerce_site = array(array('Web Application Firewall(WAF)', $waf_body_ecommerce.$waf_body.$waf_arr_ecc), array('Login Security', $login_security_ecommerce.$login_security_body.$registration_security_ecommerce.$registration_security), array('Media Protection', $media_body), array('Encrypted Backup', $backup_ecommerce.$backup_body.$backup_body_1.$backup_body_4), array('Comment and Spam Protection', $comment_ecommerce.$comment_spam), array('Malware Scanner', $scanner), array('Support', $support_modal));
325
-
326
- $business_site = array(array('Web Application Firewall(WAF)', $waf_body_business.$waf_body.$waf_arr_busi), array('Encrypted Backup', $backup_business.$backup_body.$backup_body_2.$backup_body_4), array('Comment and Spam Protection', $comment_business.$comment_spam), array('Login Security', $login_security_business.$login_security_body.$registration_security_business.$registration_security), array('Malware Scanner', $scanner), array('Support', $support_modal));
327
-
328
- $blog_site = array(array('Web Application Firewall(WAF)', $waf_body_blog.$waf_body.$waf_arr_blog), array('Comment and Spam Protection', $comment_blog.$comment_spam), array('Login Security', $login_security_blog.$login_security_body), array('Encrypted Backup', $backup_blog.$backup_body.$backup_body_3.$backup_body_4), array('Malware Scanner', $scanner), array('Support', $support_modal));
329
-
330
- $other_site = array(array('Web Application Firewall(WAF)', $waf_body_other.$waf_body.$waf_arr_other), array('Comment and Spam Protection', $comment_other.$comment_spam), array('Login Security', $login_security_other.$login_security_body), array('Encrypted Backup', $backup_blog.$backup_body.$backup_body_4), array('Media Protection', $media_body_1), array('Malware Scanner', $scanner), array('Support', $support_modal));
331
-
332
- $main_pointer = array('Main' => array('Let\'s get Started', $tour_body), 'Ecommerce' => $ecommerce_site, 'Business' => $business_site, 'Blogs/News' => $blog_site, 'Other' => $other_site);
333
-
334
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'tour-model.php';
1
+ <?php
2
+
3
+ global $mo2f_dirName;
4
+ $current_user = wp_get_current_user();
5
+ $email = get_option("mo2f_email");
6
+ $phone = get_option("mo_wpns_admin_phone");
7
+ $display = get_option('mo2f_tour_started') == 2?'block':'none';
8
+ $networkSEnable = MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option');
9
+ if(empty($email))
10
+ $email = $current_user->user_email;
11
+ $counter = 0;
12
+ $enableTour = $networkSEnable == 1 ? '' : 'disabled';
13
+ $tour_body = '<p class="modal-body-para">Hey, Thank you for installing <b style="color: #E85700">miniOrange 2-Factor plugin</b>.</p>
14
+ <p class="modal-body-para">Two-factor will provide extra layer of security to your users account which will help to protect your users accounts from any outside attack.</p>';
15
+ if($networkSEnable != 1)
16
+ {
17
+ $tour_body .= '<div style="margin-left:37.5%;margin-right:37.5%;">';
18
+ }
19
+
20
+ $tour_body .= '<table style="width: 100%; text-align: center; table-layout: fixed; font-size: medium;">
21
+ <div class="mo2f_hiddenradio">
22
+ <tr>
23
+
24
+ <td style="border: 1px solid black;" id="2fa">
25
+ <label>
26
+ <input type="radio" name="mo2f_two_factor" value="2fa" checked style="display:none">
27
+ <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/google-authenticator.png">
28
+ </label>
29
+ </td>';
30
+ if($networkSEnable == 1)
31
+ {
32
+ $tour_body .= '<td style="border: 1px solid black;" id="waf">
33
+ <label >
34
+ <input type="radio" name="mo2f_two_factor" value="waf" style="display:none" '.$enableTour.'>
35
+ <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/mo-waf-logo.png">
36
+ </label>
37
+ </td>
38
+
39
+ <td style="border: 1px solid black;" id="login">
40
+ <label >
41
+ <input type="radio" name="mo2f_two_factor" value="login" style="display:none"'.$enableTour.'>
42
+ <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/login-protection-logo.png">
43
+ </label>
44
+ </td>
45
+
46
+ <td style="border: 1px solid black;" id="backup">
47
+ <label>
48
+ <input type="radio" name="mo2f_two_factor" value="backup" style="display:none"'.$enableTour.'>
49
+ <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/database-backup-logo.png">
50
+ </label>
51
+ </td>
52
+
53
+ <td style="border: 1px solid black;" id="malware">
54
+ <label >
55
+ <input type="radio" name="mo2f_two_factor" value="malware" style="display:none"'.$enableTour.'>
56
+ <img src="'.plugin_dir_url(dirname(__FILE__)) . 'includes/images/malware-scanner-logo.png">
57
+ </label>
58
+ </td>';
59
+ }
60
+ $tour_body .= '</tr>
61
+ <tr>
62
+ <th>
63
+ Two-factor authentication
64
+ </th>';
65
+
66
+ if($networkSEnable == 1)
67
+ {
68
+
69
+ $tour_body .= '<th>
70
+ Web Application Firewall(WAF)
71
+ </th>
72
+
73
+ <th>
74
+ Login Protection
75
+ </th>
76
+
77
+ <th>
78
+ Database Backup
79
+ </th>
80
+
81
+ <th>
82
+ Malware scanner
83
+ </th>';
84
+ }
85
+
86
+ $tour_body .= '</tr>
87
+ </div>
88
+ </table>';
89
+ if($networkSEnable != 1)
90
+ {
91
+ $tour_body .= '</div>';
92
+ }
93
+
94
+ $waf_arr_ecc = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It includes very sensitive data such as user details, credit/debit card or bank details. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Media scraping, price scraping are also some scraping techniques which are used to degrade/destroy media files and change the price of products.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business. <div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
95
+
96
+ $waf_arr_busi = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It may include company privileged data, admin users data which will affect on the business. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Price scraping is part of web scraping which is used to change prices of the products which affects a lot on business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
97
+
98
+ $waf_arr_blog = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation. The data may include user details, privileged data, privileged blogs, etc.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc. Media scraping can be done in the blog/news site which alter, degrade or destroy media files.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations. Content modification may mislead to blog/news site subscriber. It can be used to spread fake/malicious imformation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
99
+
100
+ $waf_arr_other = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-1" style="width: 98%; overflow: ; height: ;line-height: 1.5;"><b><u>Data theft and manipulation</u>:</b> Data manipulation can lead to alter, delete, destroy data. The manipulated data may or may not be regained. It is very necessary to fix the existing data vulnerability issues, data leaks, change weak passwords and provide high end security to stop data breach and manipulation.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection is web security vulnerability through SQL queries executed to modify, delete and destroy data. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-1" onclick="open_hide(this);">-</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-2" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Web Scraping</u>:</b> Web scraping is a used to extract large amount of data from websites and saved on local computer. The web scraping involves fetching and extracting data from it. It can be used to web indexing, web mining, data mining, research, tracking online presence and reputation, etc.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site scripts used to web scraping and data extraction.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-2" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-3" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>File manipualtion</u>:</b> The file manipuaiton used to alter, delete, execution of files on the sever. It leads to spoil site, spread malicious content which will harm to the business.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Remote File Inclusion attacks:</span> Remote file inclusion used to include local file into the server. RFI is type of vulnerability which can lead to add malicious file through a script on server.</div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Local File Inclusion attacks:</span> Local file inclusion used to access local file available on the server. LFI can be achieved by uploading malicious file to the server.</div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-3" onclick="open_hide(this);">+</a></div></div><div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-4" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Content modification</u>:</b> Cross-site scripting used to change or modify data shown on website. Content modification affects a lot on business due to irrelevent content, malicious links which leads to spoil the trust of clients and reputation of organizations.<div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent SQL-Injection attacks:</span> SQL-Injection attack can change data in database. The data used to view content such as statistical data, charts, graphs, etc. It may mislead to business. </div><div class="modal-waf-dinner"><span class="modal-waf-sinner">Prevent Cross-site scripting(XSS) attacks:</span> Cross site script can add malicious links, change content of site. </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-4" onclick="open_hide(this);">+</a></div></div>';
101
+
102
+ $waf_body_ecommerce = '<div class="modal-body-div">
103
+ <p class="modal-body-para" style="margin: 0;">Ecommerce sites are always under attack to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
104
+ $waf_body_business = '<div class="modal-body-div">
105
+ <p class="modal-body-para" style="margin: 0;">Business sites are always under attack to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
106
+ $waf_body_blog = '<div class="modal-body-div">
107
+ <p class="modal-body-para" style="margin: 0;">Blogs/News sites are attacked to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
108
+ $waf_body_other = '<div class="modal-body-div">
109
+ <p class="modal-body-para" style="margin: 0;">Other sites such as employment, portfolio, multilingual, etc are attacked to spoil organizations reputaion, data theft and manipualation, file manipualation, web scraping, etc. WAF controls the access of web applications using rules designed to recognize and restrict suspicious activities.</p>';
110
+
111
+ $waf_body = '<div style="width:100%; display:inline-flex; margin-left: 20px;">
112
+ <div style="width:50%;font-size: medium;">1: <b>Data theft and manipulation</b></div>
113
+ <div style="width:50%;font-size: medium;">2: <b>Web Scraping</b></div></div>
114
+ <div style="width:100%; display:inline-flex; margin-left: 20px;">
115
+ <div style="width:50%;font-size: medium;">3: <b>File manipulation</b></div>
116
+ <div style="width:50%;font-size: medium;">4: <b>Content modification</b></div></div>
117
+ </div>';
118
+
119
+ $registration_security_ecommerce = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> Ecommerce sites need to prevent fake registrations. It helps to keep site safe from suspicious user.';
120
+ $registration_security_business = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> Business sites need to prevent fake registrations. It helps to keep site safe from suspicious user.';
121
+
122
+ $registration_security_other = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-13" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Registratoin security:</u></b> The sites such as employment, social networking, etc. need to prevent fake user registrations. The user will spam other users and share private data of others.';
123
+
124
+ $registration_security = '<div style="margin:1em;"><ul>
125
+ <li>
126
+ <p class="modal-body-para" style="margin: 0;">1. Temporary/Fake email ban</p>
127
+ </li>
128
+ <li>
129
+ <p class="modal-body-para" style="margin: 0;">2. OTP Verification during registrations</p>
130
+ </li>
131
+ <li>
132
+ <p class="modal-body-para" style="margin: 0;">3. Social login</p>
133
+ </li>
134
+ </ul>
135
+ </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-13" onclick="open_hide(this);">+</a></div></div>';
136
+
137
+ $login_security_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce sites should have strong login security to prevent unauthorised access.</p></div>';
138
+ $login_security_business = '<div class="modal-body-div"><p class="modal-body-para">Business sites should have strong login security to prevent unauthorised access.</p></div>';
139
+ $login_security_blog = '<div class="modal-body-div"><p class="modal-body-para">Blogs/News sites should have strong login security to prevent unauthorised access.</p></div>';
140
+ $login_security_other = '<div class="modal-body-div"><p class="modal-body-para">Other sites such as employment, portfolio, etc. should have strong login security to prevent unauthorised access.</p></div>';
141
+
142
+ $login_security_body = '<div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-10" style="width: 98%; overflow:; height: ;line-height: 1.5;"><b><u>Limit Login:</u></b> Password guessing/Brute force attack can be controlled/prevented by limiting the login attempts. Paasword guessing can be protected by:
143
+ <div style="margin:1em;">
144
+ <ul>
145
+ <li>
146
+ <p class="modal-body-para">1. Limit Login attempts: 10 (<b>Recommended</b>)</p>
147
+ </li>
148
+ <li>
149
+ <p class="modal-body-para">2. Enforce Strong passwords</p>
150
+ </li>
151
+ </ul>
152
+ </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-10" onclick="open_hide(this);">-</a></div></div>
153
+
154
+ <div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-11" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>2-Factor:</u></b> 2-factor authentication is important to prevent unauthorised login. 2-factor authentication can be enabled on top of login credentials at the time of login. Google authenticator, Authy authenticator, Lastpass authenticator applications can be used to configure 2FA. miniOrange supports 15+ 2FA methods, it includes OTP over SMS, Email, Security Questions, QR code authentication, push notification, Hardware Token, etc. 2FA can enabled to:
155
+ <div style="margin:1em;">
156
+ <ul>
157
+ <li>
158
+ <p class="modal-body-para">1. Enable 2FA for employees (<b>Recommended</b>)</p>
159
+ </li>
160
+ <li>
161
+ <p class="modal-body-para">2. Enable 2FA for users</p>
162
+ </li>
163
+ <li>
164
+ <p class="modal-body-para">3. Backup methods in case of emergency login</p>
165
+ </li>
166
+ </ul>
167
+ </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-11" onclick="open_hide(this);">+</a></div></div>
168
+ <div class="modal-body-div-c modal-body-div-d"><div id="div-show-hide-12" style="width: 98%; overflow: hidden; height: 50px;line-height: 1.5;"><b><u>Remember device:</u></b> Remember device allows user to login from trusted devices. It keeps safe from unauthorised users who tries to gain access. It improves your login security by allowing you to login from limited and trusted deivces.
169
+ <div style="margin:1em;">
170
+ <ul>
171
+ <li>
172
+ <p class="modal-body-para">1. Allows multiple trusted devices</p>
173
+ </li>
174
+ <li>
175
+ <p class="modal-body-para">2. Limit no. of trusted devices</p>
176
+ </li>
177
+ <li>
178
+ <p class="modal-body-para">3. Block IP\'s of unauthorised users</p>
179
+ </li>
180
+ </ul>
181
+ </div></div><div style="width: 2%; font-size: xx-large;"><a id="show-hide-12" onclick="open_hide(this);">+</a></div></div>';
182
+
183
+
184
+ $media_body = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce sites are often attacked to degrade and destroy media files such as images of product, audios and videos about products. You need to secure your media data. Media protection is important because the users of ecommerce site buy product by viewing the media of products. The broad word media scraping can be used for these types attacks.</p>
185
+ <div class="modal-body-div modal-body-para">Here is our <a target="_blank" href="https://wordpress.org/plugins/prevent-file-access/">Media protection</a> plugin.</div>
186
+ <div class="modal-body-div">The Media protection prevents media files listed below:</div>
187
+ </div>
188
+ <div style="margin:1em;">
189
+ <ul>
190
+ <li>
191
+ <p class="modal-body-para">1. It protects all type of image files, audio, video and gif files.</p>
192
+ </li>
193
+ <li>
194
+ <p class="modal-body-para">2. It also prevents access to documents such as pdf, doc, docx, txt, xls, xlsx, etc.</p>
195
+ </li>
196
+ </ul>
197
+ </div>';
198
+
199
+ $media_body_1 = '<div class="modal-body-div"><p class="modal-body-para">Some sites such as Photo Gallery or other site which contains media files are often attacked to degrade and destroy media files. You need to secure your media data. Media protection is important because the these sites are totally based on media files.</p>
200
+ <div class="modal-body-div modal-body-para">Here is our <a target="_blank" href="https://wordpress.org/plugins/prevent-file-access/">Media protection</a> plugin.</div>
201
+ <div class="modal-body-div">The Media protection prevents media files listed below:</div>
202
+ </div>
203
+ <div style="margin:1em;">
204
+ <ul>
205
+ <li>
206
+ <p class="modal-body-para">1. It protects all type of image files, audio, video and gif files.</p>
207
+ </li>
208
+ <li>
209
+ <p class="modal-body-para">2. It also prevents access to documents such as pdf, doc, docx, txt, xls, xlsx, etc.</p>
210
+ </li>
211
+ </ul>
212
+ </div>';
213
+
214
+ $backup_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any e-commerce site. The ecommerce sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
215
+ $backup_business = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any Business site. The business sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
216
+ $backup_blog = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any Blog/News site. These sites are attacked to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
217
+ $backup_blog = '<div class="modal-body-div"><p class="modal-body-para">The data is backbone of any site such as social networking, employment, etc. There are several attacks happens on these sites to steal data, data manipulation and files manipulation. You can take a backup of your data and files securely.</p></div>';
218
+
219
+
220
+ $backup_body = '<div class="modal-body-div">
221
+ <ul>
222
+ <li>
223
+ <p class="modal-body-para"><b>1. <u>Scheduled backup:</u></b> Scheduled backup used to create automatic backup after scheduled time. It allows you to relax because you know that all of your information is being backed up, and you are limiting what you may lose. Using this feature you can set a time interval to create a continuous backup. ';
224
+ $backup_body_1 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">Set scheduled backup time 1/2 hr for ecommerce site.</span></div>';
225
+ $backup_body_2 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">You can set automatic backup after 12 hrs time interval.</span></div>';
226
+ $backup_body_3 = '<div class="modal-waf-dinner"><span class="modal-waf-sinner">You can set automatic backup after 4-5 hrs time interval.</span></div>';
227
+ $backup_body_4 = '</p>
228
+ </li>
229
+ <li>
230
+ <p class="modal-body-para"><b>2. <u>Manual backup:</u></b> Manual backup can be taken manually whenever user wants. It is important when you made any crucial changes and don\'t want to loose data then you can immediately take a backup and keep it securely.</p>
231
+ </li>
232
+ <li>
233
+ <p class="modal-body-para"><b>3. <u>Password protected encrypted backup:</u></b> Password protected encrypted backup is very secure way to take a backup. If anyone gets it still no one can decode it because of its highly secure nature.</p>
234
+ </li>
235
+ <li>
236
+ <p class="modal-body-para"><b>4. <u>Easy restoring and recovering:</u></b> Simple one-click restore using installer files created for your website. During backup, we create an installer.php file. At the time of restore and recovery, you just need to upload the zip file of backup and installer.php and run the installer file and follow instructions to set up your website.</p>
237
+ </li>
238
+ </ul>
239
+ </div>';
240
+
241
+ $comment_ecommerce = '<div class="modal-body-div"><p class="modal-body-para">Ecommerce websites are attacked to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
242
+ $comment_business = '<div class="modal-body-div"><p class="modal-body-para">Business websites are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
243
+ $comment_blog = '<div class="modal-body-div"><p class="modal-body-para">Blog/News websites are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
244
+ $comment_other = '<div class="modal-body-div"><p class="modal-body-para">Other websites such as employment, multilingual, etc. are used to spread unwanted or irrelevant content by submitting automated posts, comments, contact forms, etc. A spam message, content or comment includes backlinks or excessive links that redirect to illegal websites or websites containing inappropriate content. Automated scripts and botnets are used to spread such spam comments and posts to spoil the organizations reputation or product reputation. </p></div>';
245
+
246
+ $comment_spam = '<div style="margin:1em;">
247
+ <ul>
248
+ <li>
249
+ <p class="modal-body-para"><b>1. <u>Comment protection:</u></b> Spam comments generated by automated scripts can be prevented using captcha. Honeypot is another widely used technique to catch bots and block them.</p>
250
+ </li>
251
+ <li>
252
+ <p class="modal-body-para"><b>2. <u>Post protection:</u></b> Automated scripts or botnets can prevented by using captcha. There are three forms of captcha availble text, math and google recaptcha. Honeypot is also another way to detect spam posts. Malware scanner can also used to scan the malware in the posts.</p>
253
+ </li>
254
+ </ul>
255
+ </div>';
256
+
257
+
258
+ $scanner = '<div class="modal-body-div"><p class="modal-body-para">Malware scanner detects the malicious code in the files. Compares the wordpress, plugins and theme files with Wordpress repo files. Detects changes present in any wordpress, theme and plugin files. It also checks outdated/vulnerable plugins, themes. It is also useful to detect malware in posts and comments.</p></div>
259
+ <div style="margin:1em;">
260
+ <ul>
261
+ <li>
262
+ <p class="modal-body-para"><b>1. <u>Malware scan:</u></b> Malware scan scans the wordpress core files, plugins and theme files to check malware. It detects the trojans, backdoors, viruses, worms, etc. in the files. </p>
263
+ </li>
264
+ <li>
265
+ <p class="modal-body-para"><b>2. <u>Wordpress version and file compare:</u></b> Checks WordPress, plugins and themes version with Wordpress.org repository and compare WordPress core, plugins and themes files with the repository to detect any file changes. Detect any changes in the files present in the WordPress plugins and themes folder.</p>
266
+ </li>
267
+ <li>
268
+ <p class="modal-body-para"><b>3. <u>Check vulnerable plugins and themes:</u></b> Checks vulnerable plugins and themes which contains malicious code. You can remove it to enhance your site security.</p>
269
+ </li>
270
+ </ul>
271
+ </div>';
272
+
273
+ $support_modal = '<div>
274
+
275
+ <div style="width: unset; float: unset; margin: 10px 20%;" class="mo_wpns_support_layout_model">
276
+
277
+ <img src="'.dirname(plugin_dir_url(__FILE__)).'/includes/images/support3.png">
278
+ <h1>Support</h1>
279
+ <p>Need any help? We are available any time, Just send us a query so we can help you.</p>
280
+ <form name="f" method="post" action="">
281
+ <input type="hidden" name="option" value="mo_wpns_send_query"/>
282
+ <table class="mo_wpns_settings_table">
283
+ <tr><td>
284
+ <input type="email" class="mo_wpns_table_textbox" id="query_email" name="query_email" value="'.$email.'" placeholder="Enter your email" required />
285
+ </td>
286
+ </tr>
287
+ <tr><td>
288
+ <input type="text" class="mo_wpns_table_textbox" name="query_phone" id="query_phone" value="'.$phone.'" placeholder="Enter your phone"/>
289
+ </td>
290
+ </tr>
291
+ <tr>
292
+ <td>
293
+ <textarea id="query" name="query" class="mo_wpns_settings_textarea" style="resize: vertical;width:100%" cols="52" rows="7" onkeyup="mo_wpns_valid(this)" onblur="mo_wpns_valid(this)" onkeypress="mo_wpns_valid(this)" placeholder="Write your query here"></textarea>
294
+ </td>
295
+ </tr>
296
+ </table>
297
+ <input type="submit" name="send_query" id="send_query" value="Submit Query" class="mo_wpns_button mo_wpns_button1" />
298
+ </form>
299
+ <br />
300
+ </div>
301
+ </div>
302
+ <script>
303
+ function moSharingSizeValidate(e){
304
+ var t=parseInt(e.value.trim());t>60?e.value=60:10>t&&(e.value=10)
305
+ }
306
+ function moSharingSpaceValidate(e){
307
+ var t=parseInt(e.value.trim());t>50?e.value=50:0>t&&(e.value=0)
308
+ }
309
+ function moLoginSizeValidate(e){
310
+ var t=parseInt(e.value.trim());t>60?e.value=60:20>t&&(e.value=20)
311
+ }
312
+ function moLoginSpaceValidate(e){
313
+ var t=parseInt(e.value.trim());t>60?e.value=60:0>t&&(e.value=0)
314
+ }
315
+ function moLoginWidthValidate(e){
316
+ var t=parseInt(e.value.trim());t>1000?e.value=1000:140>t&&(e.value=140)
317
+ }
318
+ function moLoginHeightValidate(e){
319
+ var t=parseInt(e.value.trim());t>50?e.value=50:35>t&&(e.value=35)
320
+ }
321
+ </script>';
322
+
323
+
324
+ $ecommerce_site = array(array('Web Application Firewall(WAF)', $waf_body_ecommerce.$waf_body.$waf_arr_ecc), array('Login Security', $login_security_ecommerce.$login_security_body.$registration_security_ecommerce.$registration_security), array('Media Protection', $media_body), array('Encrypted Backup', $backup_ecommerce.$backup_body.$backup_body_1.$backup_body_4), array('Comment and Spam Protection', $comment_ecommerce.$comment_spam), array('Malware Scanner', $scanner), array('Support', $support_modal));
325
+
326
+ $business_site = array(array('Web Application Firewall(WAF)', $waf_body_business.$waf_body.$waf_arr_busi), array('Encrypted Backup', $backup_business.$backup_body.$backup_body_2.$backup_body_4), array('Comment and Spam Protection', $comment_business.$comment_spam), array('Login Security', $login_security_business.$login_security_body.$registration_security_business.$registration_security), array('Malware Scanner', $scanner), array('Support', $support_modal));
327
+
328
+ $blog_site = array(array('Web Application Firewall(WAF)', $waf_body_blog.$waf_body.$waf_arr_blog), array('Comment and Spam Protection', $comment_blog.$comment_spam), array('Login Security', $login_security_blog.$login_security_body), array('Encrypted Backup', $backup_blog.$backup_body.$backup_body_3.$backup_body_4), array('Malware Scanner', $scanner), array('Support', $support_modal));
329
+
330
+ $other_site = array(array('Web Application Firewall(WAF)', $waf_body_other.$waf_body.$waf_arr_other), array('Comment and Spam Protection', $comment_other.$comment_spam), array('Login Security', $login_security_other.$login_security_body), array('Encrypted Backup', $backup_blog.$backup_body.$backup_body_4), array('Media Protection', $media_body_1), array('Malware Scanner', $scanner), array('Support', $support_modal));
331
+
332
+ $main_pointer = array('Main' => array('Let\'s get Started', $tour_body), 'Ecommerce' => $ecommerce_site, 'Business' => $business_site, 'Blogs/News' => $blog_site, 'Other' => $other_site);
333
+
334
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'tour-model.php';
controllers/twofa/two_fa.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
-
3
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa.php';
4
  update_site_option('mo2f_two_factor',true);
1
+ <?php
2
+
3
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa.php';
4
  update_site_option('mo2f_two_factor',true);
controllers/twofa/two_fa_premium_feature.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
-
3
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_premium_feature.php';
1
+ <?php
2
+
3
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_premium_feature.php';
controllers/twofa/two_fa_session_control.php CHANGED
@@ -1,3 +1,3 @@
1
- <?php
2
-
3
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_session_control.php';
1
+ <?php
2
+
3
  include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_session_control.php';
controllers/upgrade.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
- include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'upgrade.php';
3
- MoWpnsUtility::checkSecurity();
4
  update_site_option("mo_2fa_pnp",time());
1
+ <?php
2
+ include $mo2f_dirName . 'views'.DIRECTORY_SEPARATOR.'upgrade.php';
3
+ MoWpnsUtility::checkSecurity();
4
  update_site_option("mo_2fa_pnp",time());
handler/WAF/mo-waf.php CHANGED
@@ -1,207 +1,207 @@
1
- <?php
2
- $dir = dirname(__FILE__);
3
- $dir = str_replace('\\', "/", $dir);
4
- $dir = explode('WAF', $dir);
5
- $wafInclude = $dir[0].'WAF/waf-include.php';
6
- $wafdb = $dir[0].'WAF/database/mo-waf-db.php';
7
- $errorPage = $dir[0].'mo-error.html';
8
- $blockPage = $dir[0].'mo-block.html';
9
-
10
- include_once($wafInclude);
11
- include_once($wafdb);
12
-
13
- global $dbcon,$prefix;
14
- $connection = mo_wpns_dbconnection();
15
- if($connection)
16
- {
17
- $wafLevel = mo_wpns_get_option_value('WAF');
18
- if($wafLevel=='HtaccessLevel')
19
- {
20
- $ipaddress = get_ipaddress();
21
- if(mo_wpns_is_ip_blocked($ipaddress))
22
- {
23
- if(!mo_wpns_is_ip_whitelisted($ipaddress))
24
- {
25
- header('HTTP/1.1 403 Forbidden');
26
- include_once($blockPage);
27
- exit;
28
- }
29
- }
30
- $fileName = mo_wpns_setting_file();
31
-
32
- if($fileName != 'notMissing')
33
- {
34
- include_once($fileName);
35
- }
36
- if(isset($RateLimiting) && $RateLimiting == 1)
37
- {
38
- if(!is_crawler())
39
- {
40
- if(isset($RequestsPMin) && isset($actionRateL))
41
- mo_wpns_applyRateLimiting($RequestsPMin,$actionRateL,$ipaddress,$errorPage);
42
- }
43
- }
44
- if(isset($RateLimitingCrawler) && $RateLimitingCrawler == 1)
45
- {
46
- if(is_crawler())
47
- {
48
- if(is_fake_googlebot($ipaddress))
49
- {
50
- header('HTTP/1.1 403 Forbidden');
51
- include_once($errorPage);
52
- exit;
53
- }
54
- if($RateLimitingCrawler == '1')
55
- {
56
- mo_wpns_applyRateLimitingCrawler($ipaddress,$fileName,$errorPage);
57
- }
58
-
59
- }
60
- }
61
- $attack = array();
62
- if(isset($SQL) && $SQL==1)
63
- {
64
- array_push($attack,"SQL");
65
- }
66
- if(isset($XSS) && $XSS==1)
67
- {
68
- array_push($attack,"XSS");
69
- }
70
- if(isset($LFI) && $LFI==1)
71
- {
72
- array_push($attack,"LFI");
73
- }
74
-
75
- $attackC = $attack;
76
- $ParanoiaLevel = 1;
77
- $annomalyS = 0;
78
- $SQLScore = 0;
79
- $XSSScore = 0;
80
- $limitAttack = mo_wpns_get_option_value("limitAttack");
81
-
82
- foreach ($attackC as $key1 => $value1)
83
- {
84
- for($lev=1;$lev<=$ParanoiaLevel;$lev++)
85
- {
86
- if(isset($regex[$value1][$lev]))
87
- { $ooo = 0;
88
- for($i=0;$i<sizeof($regex[$value1][$lev]);$i++)
89
- {
90
- foreach ($_REQUEST as $key => $value) {
91
-
92
- if($regex[$value1][$lev][$i] != "")
93
- {
94
- if(is_string($value))
95
- {
96
- if(preg_match($regex[$value1][$lev][$i], $value))
97
- {
98
-
99
- if($value1 == "SQL")
100
- {
101
- $SQLScore += $score[$value1][$lev][$i];
102
- }
103
- elseif ($value1 == "XSS")
104
- {
105
- $XSSScore += $score[$value1][$lev][$i];
106
- }
107
- else
108
- {
109
- $annomalyS += $score[$value1][$lev][$i];
110
- }
111
-
112
- if($annomalyS>=5 || $SQLScore>=10 || $XSSScore >=10)
113
- {
114
- $attackCount = mo_wpns_log_attack($ipaddress,$value1,$value);
115
- if($attackCount>$limitAttack)
116
- {
117
- if(!mo_wpns_is_ip_whitelisted($ipaddress))
118
- {
119
- mo_wpns_block_ip($ipaddress,'Attack limit Exceeded'); //Attack Limit Exceed
120
- }
121
- }
122
-
123
- header('HTTP/1.1 403 Forbidden');
124
- include_once($errorPage);
125
- exit;
126
- }
127
- }
128
- }
129
- }
130
- }
131
- }
132
- }
133
- }
134
- }
135
- }
136
- }
137
-
138
-
139
- function mo_wpns_applyRateLimiting($reqLimit,$action,$ipaddress,$errorPage)
140
- {
141
- global $dbcon, $prefix;
142
- $rate = mo_wpns_CheckRate($ipaddress);
143
- if($rate>$reqLimit)
144
- {
145
- $lastAttack = mo_wpns_getRLEattack($ipaddress)+60;
146
- $current_time = time();
147
- if($current_time > $lastAttack)
148
- {
149
- mo_wpns_log_attack($ipaddress,'RLE','RLE');
150
- }
151
- if($action != 'ThrottleIP')
152
- {
153
- if(!mo_wpns_is_ip_whitelisted($ipaddress))
154
- {
155
- mo_wpns_block_ip($ipaddress,'RLE'); //Rate Limit Exceed
156
- }
157
- }
158
- header('HTTP/1.1 403 Forbidden');
159
- include_once($errorPage);
160
- exit;
161
- }
162
- }
163
-
164
- function mo_wpns_applyRateLimitingCrawler($ipaddress,$filename,$errorPage)
165
- {
166
- if(file_exists($filename))
167
- {
168
- include($filename);
169
- }
170
- global $dbcon,$prefix;
171
- $USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
172
- if(isset($RateLimitingCrawler))
173
- {
174
- if(isset($RateLimitingCrawler) && $RateLimitingCrawler=='1')
175
- {
176
- if(isset($RequestsPMinCrawler) && isset($actionRateLCrawler) )
177
- {
178
- $reqLimit = $RequestsPMinCrawler;
179
- $rate = mo_wpns_CheckRate($ipaddress);
180
- if($rate>=$reqLimit)
181
- {
182
- $action = $actionRateLCrawler;
183
- $lastAttack = mo_wpns_getRLEattack($ipaddress)+60;
184
- $current_time = time();
185
- if($current_time>$lastAttack)
186
- {
187
- mo_wpns_log_attack($ipaddress,'RLECrawler',$USER_AGENT);
188
- }
189
- if($action != 'ThrottleIP')
190
- {
191
- if(!mo_wpns_is_ip_whitelisted($ipaddress))
192
- {
193
- mo_wpns_block_ip($ipaddress,'RLECrawler'); //Rate Limit Exceed for Crawler
194
- }
195
- }
196
- header('HTTP/1.1 403 Forbidden');
197
- include_once($errorPage);
198
- exit;
199
- }
200
- }
201
- }
202
- }
203
- }
204
-
205
-
206
- $dbcon->close();
207
  ?>
1
+ <?php
2
+ $dir = dirname(__FILE__);
3
+ $dir = str_replace('\\', "/", $dir);
4
+ $dir = explode('WAF', $dir);
5
+ $wafInclude = $dir[0].'WAF/waf-include.php';
6
+ $wafdb = $dir[0].'WAF/database/mo-waf-db.php';
7
+ $errorPage = $dir[0].'mo-error.html';
8
+ $blockPage = $dir[0].'mo-block.html';
9
+
10
+ include_once($wafInclude);
11
+ include_once($wafdb);
12
+
13
+ global $dbcon,$prefix;
14
+ $connection = mo_wpns_dbconnection();
15
+ if($connection)
16
+ {
17
+ $wafLevel = mo_wpns_get_option_value('WAF');
18
+ if($wafLevel=='HtaccessLevel')
19
+ {
20
+ $ipaddress = get_ipaddress();
21
+ if(mo_wpns_is_ip_blocked($ipaddress))
22
+ {
23
+ if(!mo_wpns_is_ip_whitelisted($ipaddress))
24
+ {
25
+ header('HTTP/1.1 403 Forbidden');
26
+ include_once($blockPage);
27
+ exit;
28
+ }
29
+ }
30
+ $fileName = mo_wpns_setting_file();
31
+
32
+ if($fileName != 'notMissing')
33
+ {
34
+ include_once($fileName);
35
+ }
36
+ if(isset($RateLimiting) && $RateLimiting == 1)
37
+ {
38
+ if(!is_crawler())
39
+ {
40
+ if(isset($RequestsPMin) && isset($actionRateL))
41
+ mo_wpns_applyRateLimiting($RequestsPMin,$actionRateL,$ipaddress,$errorPage);
42
+ }
43
+ }
44
+ if(isset($RateLimitingCrawler) && $RateLimitingCrawler == 1)
45
+ {
46
+ if(is_crawler())
47
+ {
48
+ if(is_fake_googlebot($ipaddress))
49
+ {
50
+ header('HTTP/1.1 403 Forbidden');
51
+ include_once($errorPage);
52
+ exit;
53
+ }
54
+ if($RateLimitingCrawler == '1')
55
+ {
56
+ mo_wpns_applyRateLimitingCrawler($ipaddress,$fileName,$errorPage);
57
+ }
58
+
59
+ }
60
+ }
61
+ $attack = array();
62
+ if(isset($SQL) && $SQL==1)
63
+ {
64
+ array_push($attack,"SQL");
65
+ }
66
+ if(isset($XSS) && $XSS==1)
67
+ {
68
+ array_push($attack,"XSS");
69
+ }
70
+ if(isset($LFI) && $LFI==1)
71
+ {
72
+ array_push($attack,"LFI");
73
+ }
74
+
75
+ $attackC = $attack;
76
+ $ParanoiaLevel = 1;
77
+ $annomalyS = 0;
78
+ $SQLScore = 0;
79
+ $XSSScore = 0;
80
+ $limitAttack = mo_wpns_get_option_value("limitAttack");
81
+
82
+ foreach ($attackC as $key1 => $value1)
83
+ {
84
+ for($lev=1;$lev<=$ParanoiaLevel;$lev++)
85
+ {
86
+ if(isset($regex[$value1][$lev]))
87
+ { $ooo = 0;
88
+ for($i=0;$i<sizeof($regex[$value1][$lev]);$i++)
89
+ {
90
+ foreach ($_REQUEST as $key => $value) {
91
+
92
+ if($regex[$value1][$lev][$i] != "")
93
+ {
94
+ if(is_string($value))
95
+ {
96
+ if(preg_match($regex[$value1][$lev][$i], $value))
97
+ {
98
+
99
+ if($value1 == "SQL")
100
+ {
101
+ $SQLScore += $score[$value1][$lev][$i];
102
+ }
103
+ elseif ($value1 == "XSS")
104
+ {
105
+ $XSSScore += $score[$value1][$lev][$i];
106
+ }
107
+ else
108
+ {
109
+ $annomalyS += $score[$value1][$lev][$i];
110
+ }
111
+
112
+ if($annomalyS>=5 || $SQLScore>=10 || $XSSScore >=10)
113
+ {
114
+ $attackCount = mo_wpns_log_attack($ipaddress,$value1,$value);
115
+ if($attackCount>$limitAttack)
116
+ {
117
+ if(!mo_wpns_is_ip_whitelisted($ipaddress))
118
+ {
119
+ mo_wpns_block_ip($ipaddress,'Attack limit Exceeded'); //Attack Limit Exceed
120
+ }
121
+ }
122
+
123
+ header('HTTP/1.1 403 Forbidden');
124
+ include_once($errorPage);
125
+ exit;
126
+ }
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ }
137
+
138
+
139
+ function mo_wpns_applyRateLimiting($reqLimit,$action,$ipaddress,$errorPage)
140
+ {
141
+ global $dbcon, $prefix;
142
+ $rate = mo_wpns_CheckRate($ipaddress);
143
+ if($rate>$reqLimit)
144
+ {
145
+ $lastAttack = mo_wpns_getRLEattack($ipaddress)+60;
146
+ $current_time = time();
147
+ if($current_time > $lastAttack)
148
+ {
149
+ mo_wpns_log_attack($ipaddress,'RLE','RLE');
150
+ }
151
+ if($action != 'ThrottleIP')
152
+ {
153
+ if(!mo_wpns_is_ip_whitelisted($ipaddress))
154
+ {
155
+ mo_wpns_block_ip($ipaddress,'RLE'); //Rate Limit Exceed
156
+ }
157
+ }
158
+ header('HTTP/1.1 403 Forbidden');
159
+ include_once($errorPage);
160
+ exit;
161
+ }
162
+ }
163
+
164
+ function mo_wpns_applyRateLimitingCrawler($ipaddress,$filename,$errorPage)
165
+ {
166
+ if(file_exists($filename))
167
+ {
168
+ include($filename);
169
+ }
170
+ global $dbcon,$prefix;
171
+ $USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
172
+ if(isset($RateLimitingCrawler))
173
+ {
174
+ if(isset($RateLimitingCrawler) && $RateLimitingCrawler=='1')
175
+ {
176
+ if(isset($RequestsPMinCrawler) && isset($actionRateLCrawler) )
177
+ {
178
+ $reqLimit = $RequestsPMinCrawler;
179
+ $rate = mo_wpns_CheckRate($ipaddress);
180
+ if($rate>=$reqLimit)
181
+ {
182
+ $action = $actionRateLCrawler;
183
+ $lastAttack = mo_wpns_getRLEattack($ipaddress)+60;
184
+ $current_time = time();
185
+ if($current_time>$lastAttack)
186
+ {
187
+ mo_wpns_log_attack($ipaddress,'RLECrawler',$USER_AGENT);
188
+ }
189
+ if($action != 'ThrottleIP')
190
+ {
191
+ if(!mo_wpns_is_ip_whitelisted($ipaddress))
192
+ {
193
+ mo_wpns_block_ip($ipaddress,'RLECrawler'); //Rate Limit Exceed for Crawler
194
+ }
195
+ }
196
+ header('HTTP/1.1 403 Forbidden');
197
+ include_once($errorPage);
198
+ exit;
199
+ }
200
+ }
201
+ }
202
+ }
203
+ }
204
+
205
+
206
+ $dbcon->close();
207
  ?>
handler/backup.php CHANGED
@@ -1,322 +1,322 @@
1
- <?php
2
-
3
- class MoBackupSite{
4
-
5
- function __construct()
6
- {
7
- add_filter( 'cron_schedules', array($this,'db_eb_backup_interval'));
8
- add_action( 'mo_eb_bl_cron_hook', array($this,'db_cron_backup') );
9
- add_filter( 'cron_schedules', array($this,'file_eb_backup_interval'));
10
- add_action( 'mo_eb_file_cron_hook', array($this,'file_cron_backup') );
11
- }
12
-
13
- function db_cron_backup(){
14
-
15
- $obj = new MoBackupSite;
16
- $obj->backupDB();
17
-
18
- }
19
-
20
- function db_eb_backup_interval($schedules){
21
- $mo2f_cron_hours = MoWpnsUtility::get_mo2f_db_option('mo_wpns_backup_time', 'site_option')*3600;
22
- $schedules['db_eb_backup_time'] = array(
23
- 'interval' => $mo2f_cron_hours,
24
- 'display' => esc_html__( 'Cron Activated' ),
25
- );
26
- return $schedules;
27
- }
28
-
29
- function bl_deactivate() {
30
- $timestamp = wp_next_scheduled( 'mo_eb_bl_cron_hook' );
31
- wp_unschedule_event( $timestamp, 'mo_eb_bl_cron_hook' );
32
- }
33
-
34
- function file_cron_backup(){
35
- $backup_store_path = wp_upload_dir();
36
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
37
- $time = time();
38
- update_site_option('backup_created_time',$time);
39
-
40
- if(MoWpnsUtility::get_mo2f_db_option('mo_file_backup_plugins', 'site_option') =='1'){
41
- $this->plugin_backup($backup_store_path, $time);
42
- }
43
- if(MoWpnsUtility::get_mo2f_db_option('mo_file_backup_themes','site_option') =='1'){
44
- $this->themes_backup($backup_store_path ,$time);
45
- }
46
-
47
- if(get_site_option('mo_file_backup_wp_files') == '1'){
48
- $this->wpfiles_backup($backup_store_path, $time);
49
- }
50
- update_site_option('backup_notification_option',1);
51
- }
52
-
53
- function file_manual_backup(){
54
- $backup_store_path = wp_upload_dir();
55
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
56
- $time = time();
57
- update_site_option('backup_created_time',$time);
58
-
59
- if(MoWpnsUtility::get_mo2f_db_option('mo_file_manual_backup_plugins', 'site_option') =='1'){
60
- // if(get_option('mo_file_manual_backup_plugins') =='1'){
61
- $this->plugin_backup($backup_store_path, $time);
62
- }
63
- if(MoWpnsUtility::get_mo2f_db_option('mo_file_manual_backup_themes', 'site_option') =='1'){
64
- // if(get_option('mo_file_manual_backup_themes') =='1'){
65
- $this->themes_backup($backup_store_path ,$time);
66
- }
67
-
68
- if(get_site_option('mo_file_manual_backup_wp_files') == '1'){
69
- $this->wpfiles_backup($backup_store_path, $time);
70
- }
71
- update_site_option('backup_notification_option',1);
72
- }
73
-
74
- function file_eb_backup_interval($schedules){
75
- $mo2f_cron_file_backup_hours = MoWpnsUtility::get_mo2f_db_option('mo_wpns_backup_time', 'site_option')*3600;
76
- $schedules['file_eb_backup_time'] = array(
77
- 'interval' => $mo2f_cron_file_backup_hours,
78
- 'display' => esc_html__( 'Cron Activated' ),
79
- );
80
- return $schedules;
81
- }
82
-
83
- function file_backup_deactivate(){
84
- $timestamp = wp_next_scheduled( 'mo_eb_file_cron_hook' );
85
- wp_unschedule_event( $timestamp, 'mo_eb_file_cron_hook' );
86
- }
87
-
88
- function plugin_backup($backup_store_path, $time){
89
- global $wpnsDbQueries;
90
- $this->mkdirectory('plugins');
91
- $real_path= WP_PLUGIN_DIR;
92
- $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'plugins';
93
- $filename = 'miniorange-plugins-backup-'.$time.'.zip';
94
- $this->file_backup($real_path,$filename,'plugins');
95
- $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::PLUGIN,$filename,$time,$backup_path);
96
- }
97
-
98
- function themes_backup($backup_store_path ,$time){
99
- global $wpnsDbQueries;
100
- $this->mkdirectory('themes');
101
- $real_path= get_theme_root();
102
- $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'themes';
103
- $filename = 'miniorange-themes-backup-'.$time.'.zip';
104
- $this->file_backup($real_path,$filename,'themes');
105
- $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::THEMES,$filename,$time,$backup_path);
106
-
107
- }
108
-
109
- function wpfiles_backup($backup_store_path, $time){
110
- global $wpnsDbQueries;
111
- $this->mkdirectory('wp_files');
112
- $homepath = get_home_path();
113
- $real_path= $homepath;
114
- $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'wp_files';
115
- $filename = 'miniorange-wpfiles-backup-'.$time.'.zip';
116
- $this->file_backup($real_path,$filename, 'wp_files');
117
- $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::WPFILES,$filename,$time,$backup_path);
118
- }
119
-
120
- function mkdirectory($foldername){
121
-
122
- $homepath = wp_upload_dir();
123
- $homepath = $homepath['basedir'].DIRECTORY_SEPARATOR;
124
- if(!is_writable($homepath)){
125
- wp_send_json('not_writable');
126
- return;
127
- }
128
-
129
-
130
- $basepath = $homepath;
131
- if(!file_exists($basepath."miniorangebackup")){
132
- mkdir($basepath."miniorangebackup");
133
- }
134
-
135
- $basepath = $homepath.'miniorangebackup'.DIRECTORY_SEPARATOR;
136
- $this-> create_index_file($basepath);
137
-
138
- if(!file_exists($basepath.'file-backups')){
139
- mkdir($basepath.'file-backups');
140
- }
141
-
142
- $basepath = $homepath.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR;
143
- if(!file_exists($basepath.$foldername)){
144
- mkdir($basepath.$foldername);
145
- }
146
-
147
- }
148
-
149
- function create_index_file($folder_path){
150
-
151
- $html_path=$folder_path."index.html";
152
- $htaccess_path= $folder_path.".htaccess";
153
-
154
- if(!file_exists($html_path)){
155
- $f = fopen($html_path, "a");
156
- fwrite($f, '<html><body><a href="https://security.miniorange.com/" target="_blank">WordPress backups by miniorange</a></body></html>');
157
- fclose($f);
158
- }
159
- if(!file_exists($htaccess_path)){
160
- $f = fopen($htaccess_path, "a");
161
- fwrite($f, "deny from all");
162
- fclose($f);
163
- }
164
- }
165
-
166
-
167
- function file_backup($real_path, $filename, $foldername){
168
- ini_set('max_execution_time', 0);
169
- $backup_store_path = wp_upload_dir();
170
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR;
171
- $rootPath = realpath($real_path);
172
- $zip = new ZipArchive();
173
- $res = $zip->open($backup_store_path.$foldername.DIRECTORY_SEPARATOR.$filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
174
-
175
- $files = new RecursiveIteratorIterator(
176
- new RecursiveDirectoryIterator($rootPath),
177
- RecursiveIteratorIterator::LEAVES_ONLY
178
- );
179
- foreach ($files as $name => $file)
180
- {
181
- if (!$file->isDir())
182
- {
183
- $filePath = $file->getRealPath();
184
- $relativePath = substr($filePath, strlen($rootPath) + 1);
185
- if(strpos($relativePath, 'miniorangebackup')!== false ){}
186
- else{
187
- $zip->addFile($filePath, $relativePath);
188
- }
189
- }
190
- }
191
- $zip->close();
192
- }
193
-
194
-
195
- function backupDB(){
196
-
197
- if ( function_exists('memory_get_usage') && ( (int) ini_get('memory_limit') < 128 ) ){
198
- ini_set('memory_limit', '128M' );
199
- do_action('mo_eb_show_message',MoBackupMessages::showMessage('DB_MEMORY_LIMIT'),'SUCCESS');
200
- }
201
-
202
- $backup_store_path = wp_upload_dir();
203
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
204
-
205
- if(!is_writable($backup_store_path)){
206
- wp_send_json('not_writable');
207
- return;
208
- }
209
- global $wpdb;
210
- $tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
211
- $nooftables = count($tables);
212
- $query = "";
213
- $tableswithfk = array();
214
- $tableswithoutfk= array();
215
-
216
- foreach($tables as $table)
217
- {
218
- if(is_array($table))
219
- $table = $table[0];
220
- $createtable = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_A);
221
- if(!empty($createtable[0]))
222
- {
223
- $createquery = $createtable[0]['Create Table'];
224
- if (strpos($createquery, 'FOREIGN KEY') !== false)
225
- array_push($tableswithfk,$table);
226
- else
227
- array_push($tableswithoutfk, $table);
228
- }
229
- }
230
-
231
- $query .= $this->get_table_query($query,$tableswithoutfk);
232
-
233
- $query .= $this->get_table_query($query,$tableswithfk);
234
-
235
- $fileName = $this->create_db_backup_file($query);
236
- wp_send_json('created_backup');
237
- }
238
-
239
- function get_table_query($query,$tables)
240
- {
241
-
242
- global $wpdb;
243
- foreach($tables as $table)
244
- {
245
- $createtable = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_A);
246
- if(!empty($createtable[0]))
247
- {
248
- $createquery = $createtable[0]['Create Table'];
249
- $query .= 'DROP TABLE IF EXISTS '.$table.";\n";
250
- $query .= $createquery.";\n\n";
251
- $data = $wpdb->get_results("SELECT * FROM $table", ARRAY_A);
252
- foreach($data as $record)
253
- {
254
- if(count($record)>0)
255
- {
256
- $query.= 'INSERT INTO '.$table.' VALUES(';
257
- $i=0;
258
- foreach($record as $key=>$value)
259
- {
260
- $value = addslashes($value);
261
- if (isset($value))
262
- $query.= '"'.$value.'"' ;
263
- else
264
- $query.= '""';
265
- if ($i < (count($record)-1)) { $query.= ','; }
266
- $i++;
267
- }
268
- $query.= ");\n";
269
- }
270
- }
271
- $query.="\n\n";
272
- }
273
- }
274
- return $query;
275
- }
276
-
277
- function create_db_backup_file($data)
278
- {
279
-
280
- global $wpnsDbQueries;
281
- $time = time();
282
- $backup_store_path = wp_upload_dir();
283
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
284
- if(!file_exists($backup_store_path."miniorangebackup")){
285
- mkdir($backup_store_path."miniorangebackup");
286
- }
287
- $basepath = $backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR;
288
- $handler_obj = new MoBackupSite;
289
- $handler_obj->create_index_file($basepath);
290
- if(!file_exists($basepath.'db-backups')){
291
- mkdir($basepath.'db-backups');
292
- }
293
-
294
- $backup_path = $basepath.'db-backups';
295
- $filename = 'miniorange-db-backup-'.$time.'.sql';
296
- $basepath = $basepath.'db-backups';
297
- $handle = fopen($basepath.DIRECTORY_SEPARATOR.$filename,'w+');
298
- fwrite($handle,$data);
299
- fclose($handle);
300
- $filezipname = $this->barfw_create_database_backup_zip_file($filename,$time);
301
- $zip_path = $basepath.DIRECTORY_SEPARATOR.$filename;
302
- unlink($zip_path);
303
- $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::DATABASE,$filezipname,$time,$backup_path);
304
- return $filename;
305
- }
306
-
307
- function barfw_create_database_backup_zip_file($filename,$time){
308
- $backup_store_path = wp_upload_dir();
309
- $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR.'miniorangebackup'.DIRECTORY_SEPARATOR.'db-backups'.DIRECTORY_SEPARATOR;
310
-
311
- $filezipname = 'miniorange-db-backup-'.$time.'.zip';
312
- $zip = new ZipArchive();
313
- $res = $zip->open($backup_store_path.DIRECTORY_SEPARATOR.$filezipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
314
- $filePath = $backup_store_path.$filename;
315
- $relativePath = $filename;
316
- $zip->addFile($filePath, $relativePath);
317
-
318
- $zip->close();
319
- return $filezipname;
320
- }
321
-
322
  }new MoBackupSite;
1
+ <?php
2
+
3
+ class MoBackupSite{
4
+
5
+ function __construct()
6
+ {
7
+ add_filter( 'cron_schedules', array($this,'db_eb_backup_interval'));
8
+ add_action( 'mo_eb_bl_cron_hook', array($this,'db_cron_backup') );
9
+ add_filter( 'cron_schedules', array($this,'file_eb_backup_interval'));
10
+ add_action( 'mo_eb_file_cron_hook', array($this,'file_cron_backup') );
11
+ }
12
+
13
+ function db_cron_backup(){
14
+
15
+ $obj = new MoBackupSite;
16
+ $obj->backupDB();
17
+
18
+ }
19
+
20
+ function db_eb_backup_interval($schedules){
21
+ $mo2f_cron_hours = MoWpnsUtility::get_mo2f_db_option('mo_wpns_backup_time', 'site_option')*3600;
22
+ $schedules['db_eb_backup_time'] = array(
23
+ 'interval' => $mo2f_cron_hours,
24
+ 'display' => esc_html__( 'Cron Activated' ),
25
+ );
26
+ return $schedules;
27
+ }
28
+
29
+ function bl_deactivate() {
30
+ $timestamp = wp_next_scheduled( 'mo_eb_bl_cron_hook' );
31
+ wp_unschedule_event( $timestamp, 'mo_eb_bl_cron_hook' );
32
+ }
33
+
34
+ function file_cron_backup(){
35
+ $backup_store_path = wp_upload_dir();
36
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
37
+ $time = time();
38
+ update_site_option('backup_created_time',$time);
39
+
40
+ if(MoWpnsUtility::get_mo2f_db_option('mo_file_backup_plugins', 'site_option') =='1'){
41
+ $this->plugin_backup($backup_store_path, $time);
42
+ }
43
+ if(MoWpnsUtility::get_mo2f_db_option('mo_file_backup_themes','site_option') =='1'){
44
+ $this->themes_backup($backup_store_path ,$time);
45
+ }
46
+
47
+ if(get_site_option('mo_file_backup_wp_files') == '1'){
48
+ $this->wpfiles_backup($backup_store_path, $time);
49
+ }
50
+ update_site_option('backup_notification_option',1);
51
+ }
52
+
53
+ function file_manual_backup(){
54
+ $backup_store_path = wp_upload_dir();
55
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
56
+ $time = time();
57
+ update_site_option('backup_created_time',$time);
58
+
59
+ if(MoWpnsUtility::get_mo2f_db_option('mo_file_manual_backup_plugins', 'site_option') =='1'){
60
+ // if(get_option('mo_file_manual_backup_plugins') =='1'){
61
+ $this->plugin_backup($backup_store_path, $time);
62
+ }
63
+ if(MoWpnsUtility::get_mo2f_db_option('mo_file_manual_backup_themes', 'site_option') =='1'){
64
+ // if(get_option('mo_file_manual_backup_themes') =='1'){
65
+ $this->themes_backup($backup_store_path ,$time);
66
+ }
67
+
68
+ if(get_site_option('mo_file_manual_backup_wp_files') == '1'){
69
+ $this->wpfiles_backup($backup_store_path, $time);
70
+ }
71
+ update_site_option('backup_notification_option',1);
72
+ }
73
+
74
+ function file_eb_backup_interval($schedules){
75
+ $mo2f_cron_file_backup_hours = MoWpnsUtility::get_mo2f_db_option('mo_wpns_backup_time', 'site_option')*3600;
76
+ $schedules['file_eb_backup_time'] = array(
77
+ 'interval' => $mo2f_cron_file_backup_hours,
78
+ 'display' => esc_html__( 'Cron Activated' ),
79
+ );
80
+ return $schedules;
81
+ }
82
+
83
+ function file_backup_deactivate(){
84
+ $timestamp = wp_next_scheduled( 'mo_eb_file_cron_hook' );
85
+ wp_unschedule_event( $timestamp, 'mo_eb_file_cron_hook' );
86
+ }
87
+
88
+ function plugin_backup($backup_store_path, $time){
89
+ global $wpnsDbQueries;
90
+ $this->mkdirectory('plugins');
91
+ $real_path= WP_PLUGIN_DIR;
92
+ $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'plugins';
93
+ $filename = 'miniorange-plugins-backup-'.$time.'.zip';
94
+ $this->file_backup($real_path,$filename,'plugins');
95
+ $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::PLUGIN,$filename,$time,$backup_path);
96
+ }
97
+
98
+ function themes_backup($backup_store_path ,$time){
99
+ global $wpnsDbQueries;
100
+ $this->mkdirectory('themes');
101
+ $real_path= get_theme_root();
102
+ $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'themes';
103
+ $filename = 'miniorange-themes-backup-'.$time.'.zip';
104
+ $this->file_backup($real_path,$filename,'themes');
105
+ $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::THEMES,$filename,$time,$backup_path);
106
+
107
+ }
108
+
109
+ function wpfiles_backup($backup_store_path, $time){
110
+ global $wpnsDbQueries;
111
+ $this->mkdirectory('wp_files');
112
+ $homepath = get_home_path();
113
+ $real_path= $homepath;
114
+ $backup_path =$backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR.'wp_files';
115
+ $filename = 'miniorange-wpfiles-backup-'.$time.'.zip';
116
+ $this->file_backup($real_path,$filename, 'wp_files');
117
+ $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::WPFILES,$filename,$time,$backup_path);
118
+ }
119
+
120
+ function mkdirectory($foldername){
121
+
122
+ $homepath = wp_upload_dir();
123
+ $homepath = $homepath['basedir'].DIRECTORY_SEPARATOR;
124
+ if(!is_writable($homepath)){
125
+ wp_send_json('not_writable');
126
+ return;
127
+ }
128
+
129
+
130
+ $basepath = $homepath;
131
+ if(!file_exists($basepath."miniorangebackup")){
132
+ mkdir($basepath."miniorangebackup");
133
+ }
134
+
135
+ $basepath = $homepath.'miniorangebackup'.DIRECTORY_SEPARATOR;
136
+ $this-> create_index_file($basepath);
137
+
138
+ if(!file_exists($basepath.'file-backups')){
139
+ mkdir($basepath.'file-backups');
140
+ }
141
+
142
+ $basepath = $homepath.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR;
143
+ if(!file_exists($basepath.$foldername)){
144
+ mkdir($basepath.$foldername);
145
+ }
146
+
147
+ }
148
+
149
+ function create_index_file($folder_path){
150
+
151
+ $html_path=$folder_path."index.html";
152
+ $htaccess_path= $folder_path.".htaccess";
153
+
154
+ if(!file_exists($html_path)){
155
+ $f = fopen($html_path, "a");
156
+ fwrite($f, '<html><body><a href="https://security.miniorange.com/" target="_blank">WordPress backups by miniorange</a></body></html>');
157
+ fclose($f);
158
+ }
159
+ if(!file_exists($htaccess_path)){
160
+ $f = fopen($htaccess_path, "a");
161
+ fwrite($f, "deny from all");
162
+ fclose($f);
163
+ }
164
+ }
165
+
166
+
167
+ function file_backup($real_path, $filename, $foldername){
168
+ ini_set('max_execution_time', 0);
169
+ $backup_store_path = wp_upload_dir();
170
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR.'miniorangebackup'.DIRECTORY_SEPARATOR.'file-backups'.DIRECTORY_SEPARATOR;
171
+ $rootPath = realpath($real_path);
172
+ $zip = new ZipArchive();
173
+ $res = $zip->open($backup_store_path.$foldername.DIRECTORY_SEPARATOR.$filename, ZipArchive::CREATE | ZipArchive::OVERWRITE);
174
+
175
+ $files = new RecursiveIteratorIterator(
176
+ new RecursiveDirectoryIterator($rootPath),
177
+ RecursiveIteratorIterator::LEAVES_ONLY
178
+ );
179
+ foreach ($files as $name => $file)
180
+ {
181
+ if (!$file->isDir())
182
+ {
183
+ $filePath = $file->getRealPath();
184
+ $relativePath = substr($filePath, strlen($rootPath) + 1);
185
+ if(strpos($relativePath, 'miniorangebackup')!== false ){}
186
+ else{
187
+ $zip->addFile($filePath, $relativePath);
188
+ }
189
+ }
190
+ }
191
+ $zip->close();
192
+ }
193
+
194
+
195
+ function backupDB(){
196
+
197
+ if ( function_exists('memory_get_usage') && ( (int) ini_get('memory_limit') < 128 ) ){
198
+ ini_set('memory_limit', '128M' );
199
+ do_action('mo_eb_show_message',MoBackupMessages::showMessage('DB_MEMORY_LIMIT'),'SUCCESS');
200
+ }
201
+
202
+ $backup_store_path = wp_upload_dir();
203
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
204
+
205
+ if(!is_writable($backup_store_path)){
206
+ wp_send_json('not_writable');
207
+ return;
208
+ }
209
+ global $wpdb;
210
+ $tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
211
+ $nooftables = count($tables);
212
+ $query = "";
213
+ $tableswithfk = array();
214
+ $tableswithoutfk= array();
215
+
216
+ foreach($tables as $table)
217
+ {
218
+ if(is_array($table))
219
+ $table = $table[0];
220
+ $createtable = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_A);
221
+ if(!empty($createtable[0]))
222
+ {
223
+ $createquery = $createtable[0]['Create Table'];
224
+ if (strpos($createquery, 'FOREIGN KEY') !== false)
225
+ array_push($tableswithfk,$table);
226
+ else
227
+ array_push($tableswithoutfk, $table);
228
+ }
229
+ }
230
+
231
+ $query .= $this->get_table_query($query,$tableswithoutfk);
232
+
233
+ $query .= $this->get_table_query($query,$tableswithfk);
234
+
235
+ $fileName = $this->create_db_backup_file($query);
236
+ wp_send_json('created_backup');
237
+ }
238
+
239
+ function get_table_query($query,$tables)
240
+ {
241
+
242
+ global $wpdb;
243
+ foreach($tables as $table)
244
+ {
245
+ $createtable = $wpdb->get_results("SHOW CREATE TABLE $table", ARRAY_A);
246
+ if(!empty($createtable[0]))
247
+ {
248
+ $createquery = $createtable[0]['Create Table'];
249
+ $query .= 'DROP TABLE IF EXISTS '.$table.";\n";
250
+ $query .= $createquery.";\n\n";
251
+ $data = $wpdb->get_results("SELECT * FROM $table", ARRAY_A);
252
+ foreach($data as $record)
253
+ {
254
+ if(count($record)>0)
255
+ {
256
+ $query.= 'INSERT INTO '.$table.' VALUES(';
257
+ $i=0;
258
+ foreach($record as $key=>$value)
259
+ {
260
+ $value = addslashes($value);
261
+ if (isset($value))
262
+ $query.= '"'.$value.'"' ;
263
+ else
264
+ $query.= '""';
265
+ if ($i < (count($record)-1)) { $query.= ','; }
266
+ $i++;
267
+ }
268
+ $query.= ");\n";
269
+ }
270
+ }
271
+ $query.="\n\n";
272
+ }
273
+ }
274
+ return $query;
275
+ }
276
+
277
+ function create_db_backup_file($data)
278
+ {
279
+
280
+ global $wpnsDbQueries;
281
+ $time = time();
282
+ $backup_store_path = wp_upload_dir();
283
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR;
284
+ if(!file_exists($backup_store_path."miniorangebackup")){
285
+ mkdir($backup_store_path."miniorangebackup");
286
+ }
287
+ $basepath = $backup_store_path.'miniorangebackup'.DIRECTORY_SEPARATOR;
288
+ $handler_obj = new MoBackupSite;
289
+ $handler_obj->create_index_file($basepath);
290
+ if(!file_exists($basepath.'db-backups')){
291
+ mkdir($basepath.'db-backups');
292
+ }
293
+
294
+ $backup_path = $basepath.'db-backups';
295
+ $filename = 'miniorange-db-backup-'.$time.'.sql';
296
+ $basepath = $basepath.'db-backups';
297
+ $handle = fopen($basepath.DIRECTORY_SEPARATOR.$filename,'w+');
298
+ fwrite($handle,$data);
299
+ fclose($handle);
300
+ $filezipname = $this->barfw_create_database_backup_zip_file($filename,$time);
301
+ $zip_path = $basepath.DIRECTORY_SEPARATOR.$filename;
302
+ unlink($zip_path);
303
+ $wpnsDbQueries->insert_backup_detail(MoWpnsConstants::DATABASE,$filezipname,$time,$backup_path);
304
+ return $filename;
305
+ }
306
+
307
+ function barfw_create_database_backup_zip_file($filename,$time){
308
+ $backup_store_path = wp_upload_dir();
309
+ $backup_store_path = $backup_store_path['basedir'].DIRECTORY_SEPARATOR.'miniorangebackup'.DIRECTORY_SEPARATOR.'db-backups'.DIRECTORY_SEPARATOR;
310
+
311
+ $filezipname = 'miniorange-db-backup-'.$time.'.zip';
312
+ $zip = new ZipArchive();
313
+ $res = $zip->open($backup_store_path.DIRECTORY_SEPARATOR.$filezipname, ZipArchive::CREATE | ZipArchive::OVERWRITE);
314
+ $filePath = $backup_store_path.$filename;
315
+ $relativePath = $filename;
316
+ $zip->addFile($filePath, $relativePath);
317
+
318
+ $zip->close();
319
+ return $filezipname;
320
+ }
321
+
322
  }new MoBackupSite;
handler/malware_scanner.php CHANGED
@@ -1,669 +1,669 @@
1
- <?php
2
-
3
- class Mo_wpns_Scan_Handler{
4
- private $total_files_to_scan;
5
- public $scanned_files = array();
6
- function __construct(){
7
-
8
- }
9
- function mo2f_scan_all_files($scan_config){
10
- update_option('mo_wpns_scan_initialize', 0);
11
- update_option('mo_wpns_malware_scan_in_progress','IN PROGRESS');
12
- update_option('mo_wpns_files_scanned',0);
13
- update_option('mo_wpns_infected_files',0);
14
- ini_set('memory_limit', '-1');
15
- ini_set('max_execution_time', 0);
16
- $result = array();
17
- $folderpaths = array();
18
- $wp_repo_file = array();
19
- $folderNames = "";
20
- $repo_check_status = $scan_config['check_repo'];
21
- $repo_check_status_code = 0;
22
- $base = dirname(dirname(dirname(dirname(plugin_dir_path(__FILE__)))));
23
- $hostname = 'wordpress.org';
24
- $wordpress_server_status = $this->mo_wpns_check_malware_server_status($hostname);
25
- if (!is_writable($base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads")) {
26
- $scan_config['check_repo'] = 0;
27
- $repo_check_status_code = -97;
28
- }
29
- if (!$wordpress_server_status) {
30
- $scan_config['check_repo'] = 0;
31
- $repo_check_status_code = -98;
32
- }
33
- $repo_file_path=$base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads".DIRECTORY_SEPARATOR."miniorangescan";
34
- if($scan_config['core_scan'] == 1){
35
- $folderpaths['base'] = $base;
36
- $folderNames .= "WP Files;";
37
- }
38
- if($scan_config['plugin_scan'] == 1){
39
- $folderpaths['plugins'] = $base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."plugins";
40
- $folderNames .= "Plugins;";
41
- }
42
- if($scan_config['theme_scan'] == 1){
43
- $folderpaths['themes'] = $base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."themes";
44
- $folderNames .= "Themes;";
45
- }
46
- if($scan_config['check_repo'] == 1){
47
- $folderNames .= "WP Repo Files;";
48
- }
49
- $this->count_total_files($folderpaths, $base, $scan_config);
50
-
51
- if ( ! function_exists( 'get_plugins' ) ) {
52
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
53
- }
54
- if ( ! function_exists( 'plugins_api' ) ) {
55
- require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
56
- }
57
- if($scan_config['check_repo'] == 1){
58
- if(!is_dir($repo_file_path)){
59
- mkdir($repo_file_path);
60
- }
61
- if($scan_config['core_scan'] == 1){
62
- require(ABSPATH . 'wp-includes/version.php');
63
- //wordpress name to be changed to be changed based on version
64
- $zip_name="wp-".$wp_version;
65
- $wp_repo_file['base']=$repo_file_path.DIRECTORY_SEPARATOR.$zip_name;
66
- update_option('downloaded_wordpress_repo_name', $zip_name);
67
- if(!is_dir($repo_file_path.DIRECTORY_SEPARATOR.$zip_name)){
68
- $result = $this->download_repo($zip_name, $wp_version, $repo_file_path);
69
- if($result === -99){
70
- $scan_config['check_repo'] = 0;
71
- $repo_check_status_code = -99;
72
- }else if(!$result){
73
- $scan_config['check_repo'] = 0;
74
- $repo_check_status_code = -100;
75
- }
76
- }
77
- }
78
- if($scan_config['plugin_scan'] == 1 && $scan_config['check_repo']){
79
- $wp_plugin_repo_file=$repo_file_path.DIRECTORY_SEPARATOR."plugins";
80
- if(!is_dir($wp_plugin_repo_file)){
81
- mkdir($wp_plugin_repo_file);
82
- }
83
- $wp_repo_file['plugins']=$wp_plugin_repo_file;
84
- $plugin_list=get_site_transient( 'update_plugins' );
85
- $all_plugins=array();
86
- foreach ($plugin_list as $key => $value) {
87
- if($key=='response'||$key=='no_update'){
88
- foreach ($value as $ke => $val) {
89
- $all_plugins[$ke] = $val;
90
- }
91
- }
92
- }
93
- $result = $this->iterator_plugins_themes($all_plugins, $wp_plugin_repo_file, 'plugins');
94
- if($result === -99){
95
- $scan_config['check_repo'] = 0;
96
- $repo_check_status_code = -99;
97
- }else if(!$result){
98
- $scan_config['check_repo'] = 0;
99
- $repo_check_status_code = -100;
100
- }
101
- }
102
- if($scan_config['theme_scan'] == 1 && $scan_config['check_repo']){
103
- $wp_theme_repo_file=$repo_file_path.DIRECTORY_SEPARATOR."themes";
104
- if(!is_dir($wp_theme_repo_file)){
105
- mkdir($wp_theme_repo_file);
106
- }
107
- $wp_repo_file['themes']=$wp_theme_repo_file;
108
- $all_themes=get_site_transient( 'update_themes' )->checked;
109
- $result = $this->iterator_plugins_themes($all_themes, $wp_theme_repo_file, 'themes');
110
- if($result === -99){
111
- $scan_config['check_repo'] = 0;
112
- $repo_check_status_code = -99;
113
- }else if(!$result){
114
- $scan_config['check_repo'] = 0;
115
- $repo_check_status_code = -100;
116
- }
117
- }
118
- }
119
- $mo2f_malware_db_handler = new MoWpnsDB();
120
- $time = current_time('timestamp');
121
- $result = $this->get_scan_result($mo2f_malware_db_handler, $folderpaths, $wp_repo_file, $scan_config, $base);
122
- $reportid = $mo2f_malware_db_handler->create_scan_report($folderNames, $scan_config['type_scan'], $time);
123
- if($result['scan']){
124
- foreach ($result['scan'] as $key => $value) {
125
- $mo2f_malware_db_handler->add_report_details($reportid, $key, $value);
126
- }
127
- }
128
- $result['repo_issues'] = $repo_check_status!=$scan_config['check_repo'] ? $repo_check_status_code : $result['repo_issues'];
129
- $mo2f_malware_db_handler->scan_report_complete($reportid, $result['file_count'], $result['malware_count'], $result['repo_issues'], $result['malicious_link']);
130
- if(is_dir($repo_file_path)){
131
- $this->remove_dir($repo_file_path);
132
- }
133
- update_option('mo_wpns_malware_scan_in_progress','COMPLETE');
134
- $total_scan=$mo2f_malware_db_handler->count_files();
135
- $total_malicious=$mo2f_malware_db_handler->count_malicious_files();
136
- $last_scan=$mo2f_malware_db_handler->count_files_last_scan($reportid);
137
- $malicious_last_scan=$mo2f_malware_db_handler->count_malicious_last_scan($reportid);
138
- if($total_scan > 999){
139
- $total_scan=($total_scan/1000);
140
- $total_scan= round($total_scan,1)."k";
141
- }
142
- if($total_malicious > 999){
143
- $total_malicious=($total_malicious/1000);
144
- $total_malicious= round($total_malicious,1)."k";
145
- }
146
- $response=array('total_files'=>$total_scan, 'total_mal'=>$total_malicious, 'scan_files'=>$last_scan, 'mal_files'=>$malicious_last_scan);
147
- wp_send_json($response);
148
- }
149
-
150
- function iterator_plugins_themes($themes_or_plugins, $path, $type=''){
151
- foreach($themes_or_plugins as $key => $data){
152
- if($type=='plugins'){
153
- $plugin_slug=$data->slug;
154
- $plugin_directory_location=dirname(dirname(dirname($path))).DIRECTORY_SEPARATOR.'plugins';
155
- $plugin_data=get_plugin_data($plugin_directory_location.DIRECTORY_SEPARATOR.$data->plugin);
156
- $plugin_version=$plugin_data['Version'];
157
- if(!is_dir($path.DIRECTORY_SEPARATOR.$plugin_slug)){
158
- $result= $this->download_repo($plugin_slug, $plugin_version, $path, $type);
159
- if($result === -99){
160
- return -99;
161
- }else if(!$result){
162
- return false;
163
- }
164
- }
165
- } else if($type=='themes'){
166
- if(!is_dir($path.DIRECTORY_SEPARATOR.$key)){
167
- $result= $this->download_repo($key, $data, $path, $type);
168
- if($result === -99){
169
- return -99;
170
- }else if(!$result){
171
- return false;
172
- }
173
- }
174
- }
175
- }
176
- return true;
177
- }
178
-
179
- function download_repo($zip_name, $version, $path, $type=''){
180
- if ($type=='plugins') {
181
- $download_link="https://downloads.wordpress.org/plugin/".$zip_name.".".$version.".zip";
182
- $plugin_name=$zip_name.'.'.$version;
183
- $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
184
- if( $download_result){
185
- $result = $this->unzip_downloaded_repo($zip_name, $path);
186
- return $result;
187
- }else {
188
- $download_link="https://downloads.wordpress.org/plugin/".$zip_name.".zip";
189
- $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
190
- if( $download_result){
191
- $result = $this->unzip_downloaded_repo($zip_name, $path);
192
- return $result;
193
- }else {
194
- error_log("Unable to download Plugin: ".$plugin_name);
195
- return -99;
196
- }
197
- return -99;
198
- }
199
- } else if($type=='themes'){
200
- $theme_name=$zip_name.'.'.$version;
201
- $download_link="https://downloads.wordpress.org/theme/".$theme_name.".zip";
202
- $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
203
- if( $download_result){
204
- $result = $this->unzip_downloaded_repo($zip_name, $path);
205
- return $result;
206
- }else {
207
- $download_link="https://downloads.wordpress.org/theme/".$zip_name.".zip";
208
- $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
209
- if( $download_result){
210
- $result = $this->unzip_downloaded_repo($zip_name, $path);
211
- return $result;
212
- }else {
213
- error_log("Unable to download Theme: ".$theme_name);
214
- return -99;
215
- }
216
- return -99;
217
- }
218
- } else {
219
- $download_link="https://wordpress.org/wordpress-".$version.".zip";
220
- $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.'.zip', file_get_contents($download_link));
221
- if($download_result){
222
- $result=$this->unzip_downloaded_repo($zip_name, $path);
223
- return $result;
224
- } else {
225
- error_log("Unable to download wordpress-".$version);
226
- return -99;
227
- }
228
- }
229
- return false;
230
- }
231
-
232
- function unzip_downloaded_repo($name, $path){
233
- $zip = new ZipArchive;
234
- $folder_path=$path.DIRECTORY_SEPARATOR.$name.".zip";
235
- $res = $zip->open($folder_path);
236
- if ($res === TRUE) {
237
- // extract it to the path we determined above
238
- $result = $zip->extractTo($path);
239
- $zip->close();
240
- if ($name == get_option('downloaded_wordpress_repo_name')) {
241
- rename($path.DIRECTORY_SEPARATOR."wordpress", $path.DIRECTORY_SEPARATOR.$name);
242
- }
243
- unlink($folder_path);
244
- return true;
245
- } else {
246
- return false;
247
- }
248
- }
249
-
250
- function get_scan_result($mo2f_malware_db_handler=null, $folderpaths=array(), $repo_folder_path=array(), $scan_config, $base){
251
- if(!empty($folderpaths)){
252
- if ( in_array( 'curl', get_loaded_extensions() ) ) {
253
- $scanresults=array();
254
- $nooffiles=0;
255
- $scan_malware_count = 0;
256
- $repo_issue_count = 0;
257
- $malicious_link_count = 0;
258
- $file_ext = $scan_config['file_extension'];
259
- $host = 'http://scanner.api.xecurify.com/malwareservice/rest/file/upload';
260
- $extensions = array();
261
- $hostname = 'scanner.api.xecurify.com';
262
- $malware_server_status = $this->mo_wpns_check_malware_server_status($hostname);
263
- if(empty($file_ext)){
264
- }else{
265
- if(strpos($file_ext,';') !=false){
266
- $extensions = explode(";", $file_ext);
267
- }else{
268
- array_push($extensions, $file_ext);
269
- }
270
- }
271
- $folder_skip_array= empty($scan_config['path_skip']) ? array() : explode(";", $scan_config['path_skip']);
272
- $skip_path_array= array();
273
- for($i=0; $i<count($folder_skip_array); $i++){
274
- $pathParts = explode('/', rtrim(str_replace('\\', '/', $folder_skip_array[$i])));
275
- $n= sizeof($pathParts)-1;
276
- $folder= $pathParts[$n];
277
- array_push($skip_path_array, $folder);
278
- }
279
- $enable_extns = $scan_config['type_scan'] == "Custom Scan" && !empty($file_ext) ? false : true;
280
- foreach ($folderpaths as $value) {
281
- $onearr = array();
282
- if (is_dir($value)) {
283
- foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($value, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
284
- if ($item->isFile()) {
285
- $scanresult=array();
286
- $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
287
- if ($value == $base && ($scan_config['core_scan'] == 1)){
288
- $arr = explode(DIRECTORY_SEPARATOR, $iterator->getSubPathName());
289
- if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('miniorangescan', $arr)) || (!in_array('plugins', $arr) && !in_array('themes', $arr) && !in_array('miniorangescan', $arr))){
290
-
291
- }else{
292
- continue;
293
- }
294
- }elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
295
- continue;
296
- } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
297
- continue;
298
- }
299
- $flag_skip=0;
300
- if($scan_config['type_scan'] == "Custom Scan" && !empty($folder_skip_array)){
301
- for($q=0; $q<count($skip_path_array); $q++){
302
- if(strpos($source_file_path, $skip_path_array[$q])){
303
- $flag_skip=1;
304
- break;
305
- }
306
- }
307
- }
308
- if($flag_skip == 1){
309
- continue;
310
- }
311
- $ext = pathinfo($source_file_path, PATHINFO_EXTENSION);
312
- $extns = $enable_extns ? true : (in_array($ext, $extensions) ? true : false);
313
- if($extns){
314
- $nooffiles++;
315
- if($nooffiles - get_option('mo_wpns_files_scanned') > 50){
316
- update_option('mo_wpns_files_scanned', $nooffiles);
317
- }
318
- }
319
-
320
- $hash_of_file= md5_file($source_file_path);
321
- $res=$mo2f_malware_db_handler->check_hash($hash_of_file);
322
-
323
- $datascan = empty($res)?true:(isset($res[0]->scan_data) ? unserialize($res[0]->scan_data):false);
324
- $scanmalware = is_array($datascan)?$datascan['malware']==0:(!empty($datascan) ? $datascan: true);
325
- $repocheck = is_array($datascan)?$datascan['repo']==0:(!empty($datascan) ? $datascan: true);
326
- $extlink = is_array($datascan)?$datascan['ext_link']==0:(!empty($datascan) ? $datascan: true);
327
- $malware_status = $scanmalware? 0 : 1;
328
- $repo_status = $repocheck? 0 : 1;
329
- $link_status = $extlink? 0 : 1;
330
- if(!empty($res) && !$extlink && !$repocheck && !$scanmalware ){}
331
-
332
- else{
333
- $flag_update=0;
334
- $file_content=file_get_contents($source_file_path);
335
- $source_file_path_size = str_replace("\\", "/", $source_file_path);
336
- if(($scan_config['check_vulnerable'] == 1 || $scan_config['check_sql'] == 1) && !in_array($ext, array('zip','sitx','7z','rar','gz')) && filesize($source_file_path_size) < 1048576 && $malware_server_status && $extns && $scanmalware){
337
- $malware_status = 1;
338
- $cfile=curl_file_create($source_file_path, 'test/plain', time().basename($source_file_path));
339
- $postdata = array('file' => $cfile);
340
- $content_type = 'multipart/form-data';
341
- $issues = $this->mo_wpns_malware_scan_request( $host, $content_type,$postdata);
342
- if ($issues) {
343
- $scan_malware_count++;
344
- $scanresult['scan'] = $issues;
345
- $flag_update=1;
346
- }
347
- }else{
348
-
349
- }
350
-
351
- if($scan_config['check_repo'] == 1 && $repocheck && $extns){
352
- if(!in_array('wp-config.php', $arr) && !in_array($ext, array('zip', 'log', 'htaccess','sitx','7z','rar','gz'))){
353
- if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('uploads', $arr)) || !in_array('wp-content', $arr)){
354
- $repo_status = 1;
355
- if($value==$base){
356
- $repo_file_path=$repo_folder_path['base'];
357
- } elseif ($value == $base.DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins') {
358
- $repo_file_path=$repo_folder_path['plugins'];
359
- } elseif ($value == $base.DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'themes') {
360
- $repo_file_path=$repo_folder_path['themes'];
361
- }
362
- $issues = $this->check_with_repo_files($file_content, $repo_file_path.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
363
- if(!empty($issues)){
364
- $repo_issue_count++;
365
- $scanresult['repo']=$issues;
366
- $flag_update=1;
367
- }
368
- }
369
- }
370
- }
371
- if($extns && $extlink){
372
- if($scan_config['ext_link_check'] == 1){
373
- $link_status = 1;
374
- $elresult= $this->check_external_link($file_content);
375
- if(!empty($elresult)){
376
- $malicious_link_count++;
377
- $flag_update=1;
378
- $scanresult['extl']=$elresult;
379
- }
380
- }
381
- }
382
- if($flag_update == 0){
383
- $malware_status = ($scan_config['check_vulnerable'] || $scan_config['check_sql']) && $malware_status ? 1 : 0;
384
- $repo_status = $scan_config['check_repo'] && $repo_status ? 1 : 0;
385
- $link_status = $scan_config['ext_link_check'] && $link_status ? 1: 0;
386
- $scan_data = array('malware'=>$malware_status, 'repo'=>$repo_status, 'ext_link'=>$link_status);
387
- if(empty($res)){
388
- $mo2f_malware_db_handler->insert_hash($source_file_path, $hash_of_file, $scan_data);
389
- }else{
390
- $mo2f_malware_db_handler->update_hash($source_file_path, $hash_of_file, $scan_data);
391
- }
392
- }else{
393
- $infected_files=get_option('mo_wpns_infected_files');
394
- $infected_files++;
395
- if(!empty($res)){
396
- $mo2f_malware_db_handler->delete_hash($source_file_path);
397
- }
398
- update_option('mo_wpns_infected_files', $infected_files);
399
- }
400
- }
401
- if(!empty($scanresult))
402
- $scanresults[$source_file_path]=$scanresult;
403
- }
404
- }
405
- }
406
- }
407
- $malware_server_status = $this->mo_wpns_check_malware_server_status($hostname);
408
- if($malware_server_status){
409
- $host = 'http://scanner.api.xecurify.com/malwareservice/rest/file/data';
410
- $postdata = http_build_query(array('fileCount' => $nooffiles, 'maliciousCount' => $scan_malware_count));
411
- $content_type = 'application/x-www-form-urlencoded';
412
- $lastRequest = $this->mo_wpns_malware_scan_request( $host, $content_type,$postdata);
413
- }
414
- update_option('mo_wpns_files_scanned', $nooffiles);
415
- return array('file_count'=> $nooffiles, 'malware_count'=>$scan_malware_count, 'repo_issues'=>$repo_issue_count, 'malicious_link'=>$malicious_link_count, 'scan'=>$scanresults);
416
- }else{
417
- return array('message'=>'CURL not installed on the server.');
418
- }
419
- } else {
420
- return array('message'=>'No folder selected for scanning.');
421
- }
422
- }
423
-
424
- function mo_wpns_check_malware_server_status($host){
425
- $fsock = @fsockopen($host, 80, $errno, $errstr, 5);
426
- if ( ! $fsock ){
427
- return FALSE;
428
- }else{
429
- fclose($fsock);
430
- return TRUE;
431
- }
432
- }
433
-
434
- function mo_wpns_malware_scan_request( $host, $content_type,$postdata = array()){
435
- $response = null;
436
- $ch=curl_init($host);
437
- curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
438
- curl_setopt( $ch, CURLOPT_ENCODING, "" );
439
- curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
440
- curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
441
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
442
- curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: '.$content_type) );
443
- curl_setopt( $ch, CURLOPT_POST, true );
444
- curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata);
445
- $results=curl_exec($ch);
446
- curl_close($ch);
447
- if($results==false){
448
- error_log('Unable to scan file: '.$postdata['file']->name.' with result: '.$result);
449
- }else{
450
- $result = json_decode($results, true);
451
- if(isset($result['status'])){
452
- if ($result['status'] == 'success') {
453
- if($result['result']!='OK')
454
- $response = $result['result'];
455
- }else if($result['status']=='error'){
456
- error_log("Exception on server");
457
- }
458
- }else if(strpos($results, 'Summary')){
459
-
460
- }else{
461
- error_log("Any other issues on server");
462
- }
463
- }
464
- return $response;
465
- }
466
-
467
- function check_with_repo_files($file_content, $repo_file_path){
468
- $issues = array();
469
- if(file_exists($repo_file_path)){
470
- $content=@file_get_contents($repo_file_path);
471
- $hash_repo = md5($content);
472
- $hash_file = md5($file_content);
473
- if ($hash_file != $hash_repo) {
474
- $flag=1;
475
- $issues=array("exist" => "Mismatch in Files");
476
- }
477
- } else {
478
- $issues=array('exist'=>'Unwanted File Found');
479
- }
480
- return $issues;
481
- }
482
-
483
- function getlines($contents, $href){
484
- $newissues = 0;
485
- $lines = preg_split("/((\r?\n)|(\r\n?))/", $contents);
486
- for($i=0; $i<count($lines); $i++){
487
- $line = $lines[$i];
488
- if (strpos($line, $href) !== false) {
489
- $newissues = $i+1;
490
- }
491
- }
492
- return $newissues;
493
- }
494
-
495
- function check_external_link($contents){
496
- $issues = array();
497
- $hrefs = preg_match_all('/<a\s+(?:[^"\'>]+|"[^"]*"|\'[^\']*\')*href=("[^"]+"|\'[^\'‌​]+\'|[^<>\s]+)/i', $contents, $matches) ? $matches: array();
498
- if(isset($hrefs[1])){
499
- foreach($hrefs[1] as $href){
500
- if($this->isexternal($href)){
501
- $line=$this->getlines($contents, $href);
502
- $issues[] = array("i"=>"eld", "d"=>$href, "l"=>$line);
503
- }
504
- }
505
- }
506
- return $issues;
507
- }
508
-
509
- function isexternal($url) {
510
- $url = trim($url);
511
- $url = trim($url,';');
512
- $url = trim($url,'(');
513
- $url = trim($url,')');
514
- $url = trim($url,"'");
515
- $url = trim($url,'"');
516
- $components = parse_url($url);
517
- if(isset($components['host'])){
518
- if(preg_match('/(wordpress|google|miniorange|xecurify|facebook|themeisle|adobe|phppot)/i', $components['host']) === 1) {}
519
- else{
520
- if(!empty($components['host']) && strpos(strtolower($components['host']),strtolower($_SERVER['HTTP_HOST'])) === false){
521
- return true;
522
- }
523
- }
524
- }
525
- return false;
526
- }
527
- function check_vulnerable_code($contents){
528
- $issues = array();
529
- $tokens = token_get_all($contents);
530
-
531
- for($i=0; $i< sizeof($tokens); $i++) {
532
- $token = $tokens[$i];
533
- if (is_array($token)) {
534
- if(in_array(token_name($token[0]), array("T_EVAL"))){
535
- $issue = $this->getFunctionArgumentsOrEnclosedString("eval", $tokens, $i+1, "vlc", false);
536
- if(!empty($issue))
537
- $issues[] = $issue;
538
- } else if(in_array(token_name($token[0]), array("T_STRING"))){
539
- if(in_array($token[1],array("popen","fsockopen"))){
540
- $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", true);
541
- if(!empty($issue))
542
- $issues[] = $issue;
543
- } else if(in_array($token[1],array("assert"))){
544
- $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", false);
545
- if(!empty($issue))
546
- $issues[] = $issue;
547
- } else if(in_array($token[1],array("exec","shell_exec","passthru","system","proc_"))){
548
- $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "shc", false);
549
- if(!empty($issue))
550
- $issues[] = $issue;
551
- } else if(in_array($token[1],array("mysql_connect","mysqli_connect","mysqli_real_connect","PDO"))){
552
- $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "sqc", false);
553
- if(!empty($issue))
554
- $issues[] = $issue;
555
- }
556
- }
557
- }
558
- }
559
- return $issues;
560
- }
561
-
562
- function getFunctionArgumentsOrEnclosedString($issueFunction, $tokens, $start, $issuetype, $checkForExternalLink){
563
-
564
- $flag = 1;
565
- $argument = "";
566
- $line = "";
567
- $issue = array();
568
- for($j=$start; $j< sizeof($tokens); $j++) {
569
- $innertoken = $tokens[$j];
570
- if ($flag==1 && is_array($innertoken)) {
571
- $argument .= $innertoken[1];
572
- if(empty($line))
573
- $line = $innertoken[2];
574
- } else if($innertoken==";"){
575
- $argument .= ";";
576
- if($checkForExternalLink){
577
- if($this->isexternal($argument)){
578
- $issue = array("l"=>$line, "t"=> $issueFunction, "i"=>$issuetype, "d"=>$argument);
579
- }
580
- } else {
581
- $issue = array("l"=>$line, "t"=> $issueFunction, "i"=>$issuetype, "d"=>$argument);
582
- }
583
- break;
584
- } else if($flag==1){
585
- $argument .= $innertoken;
586
- }
587
- }
588
- return $issue;
589
- }
590
-
591
- function remove_dir($repo_path){
592
- $dir=$repo_path;
593
- $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
594
- $files = new RecursiveIteratorIterator($it,RecursiveIteratorIterator::CHILD_FIRST);
595
- foreach($files as $file) {
596
- if ($file->isDir()){
597
- rmdir($file->getRealPath());
598
- } else {
599
- unlink($file->getRealPath());
600
- }
601
- }
602
- rmdir($dir);
603
- }
604
-
605
- function count_total_files($folder_paths, $base, $scan_config){
606
-
607
- $file_count=0;
608
- $file_ext = $scan_config['file_extension'];
609
- $extensions = array();
610
- if(empty($file_ext)){
611
-
612
- }else{
613
- if(strpos($file_ext,';') !=false){
614
- $extensions = explode(";", $file_ext);
615
- }else{
616
- array_push($extensions, $file_ext);
617
- }
618
- }
619
- $enable_extns = $scan_config['type_scan'] == "Custom Scan" && !empty($file_ext) ? false : true;
620
- $folder_skip_array= empty($scan_config['path_skip']) ? array() : explode(";", $scan_config['path_skip']);
621
- $skip_path_array= array();
622
- for($i=0; $i<count($folder_skip_array); $i++){
623
- $pathParts = explode('/', $folder_skip_array[$i]);
624
- $n= sizeof($pathParts)-1;
625
- $folder= $pathParts[$n];
626
- array_push($skip_path_array, $folder);
627
- }
628
- foreach ($folder_paths as $value) {
629
- if (is_dir($value)) {
630
- foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($value, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
631
- if ($item->isFile()) {
632
- $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
633
- if ($value == $base && ($scan_config['core_scan'] == 1)){
634
- $arr = explode(DIRECTORY_SEPARATOR, $iterator->getSubPathName());
635
- if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('miniorange', $arr)) || (!in_array('plugins', $arr) && !in_array('themes', $arr) && !in_array('miniorange', $arr))){
636
-
637
- }else{
638
- continue;
639
- }
640
- }elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
641
- continue;
642
- } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
643
- continue;
644
- }
645
- $flag_skip=0;
646
- if (!empty($folder_skip_array)) {
647
- for($q=0; $q<count($skip_path_array); $q++){
648
- if(strpos($source_file_path, $skip_path_array[$q])){
649
- $flag_skip=1;
650
- break;
651
- }
652
- }
653
- }
654
- if($flag_skip == 1){
655
- continue;
656
- }
657
- $ext = pathinfo($source_file_path, PATHINFO_EXTENSION);
658
- $extns = $enable_extns ? true : (in_array($ext, $extensions)? true : false);
659
- if($extns)
660
- $file_count++;
661
- }
662
- }
663
- }
664
- }
665
- update_option('mo_wpns_total_files', $file_count);
666
- }
667
- }
668
- new Mo_wpns_Scan_Handler;
669
  ?>
1
+ <?php
2
+
3
+ class Mo_wpns_Scan_Handler{
4
+ private $total_files_to_scan;
5
+ public $scanned_files = array();
6
+ function __construct(){
7
+
8
+ }
9
+ function mo2f_scan_all_files($scan_config){
10
+ update_option('mo_wpns_scan_initialize', 0);
11
+ update_option('mo_wpns_malware_scan_in_progress','IN PROGRESS');
12
+ update_option('mo_wpns_files_scanned',0);
13
+ update_option('mo_wpns_infected_files',0);
14
+ ini_set('memory_limit', '-1');
15
+ ini_set('max_execution_time', 0);
16
+ $result = array();
17
+ $folderpaths = array();
18
+ $wp_repo_file = array();
19
+ $folderNames = "";
20
+ $repo_check_status = $scan_config['check_repo'];
21
+ $repo_check_status_code = 0;
22
+ $base = dirname(dirname(dirname(dirname(plugin_dir_path(__FILE__)))));
23
+ $hostname = 'wordpress.org';
24
+ $wordpress_server_status = $this->mo_wpns_check_malware_server_status($hostname);
25
+ if (!is_writable($base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads")) {
26
+ $scan_config['check_repo'] = 0;
27
+ $repo_check_status_code = -97;
28
+ }
29
+ if (!$wordpress_server_status) {
30
+ $scan_config['check_repo'] = 0;
31
+ $repo_check_status_code = -98;
32
+ }
33
+ $repo_file_path=$base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."uploads".DIRECTORY_SEPARATOR."miniorangescan";
34
+ if($scan_config['core_scan'] == 1){
35
+ $folderpaths['base'] = $base;
36
+ $folderNames .= "WP Files;";
37
+ }
38
+ if($scan_config['plugin_scan'] == 1){
39
+ $folderpaths['plugins'] = $base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."plugins";
40
+ $folderNames .= "Plugins;";
41
+ }
42
+ if($scan_config['theme_scan'] == 1){
43
+ $folderpaths['themes'] = $base.DIRECTORY_SEPARATOR."wp-content".DIRECTORY_SEPARATOR."themes";
44
+ $folderNames .= "Themes;";
45
+ }
46
+ if($scan_config['check_repo'] == 1){
47
+ $folderNames .= "WP Repo Files;";
48
+ }
49
+ $this->count_total_files($folderpaths, $base, $scan_config);
50
+
51
+ if ( ! function_exists( 'get_plugins' ) ) {
52
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
53
+ }
54
+ if ( ! function_exists( 'plugins_api' ) ) {
55
+ require_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
56
+ }
57
+ if($scan_config['check_repo'] == 1){
58
+ if(!is_dir($repo_file_path)){
59
+ mkdir($repo_file_path);
60
+ }
61
+ if($scan_config['core_scan'] == 1){
62
+ require(ABSPATH . 'wp-includes/version.php');
63
+ //wordpress name to be changed to be changed based on version
64
+ $zip_name="wp-".$wp_version;
65
+ $wp_repo_file['base']=$repo_file_path.DIRECTORY_SEPARATOR.$zip_name;
66
+ update_option('downloaded_wordpress_repo_name', $zip_name);
67
+ if(!is_dir($repo_file_path.DIRECTORY_SEPARATOR.$zip_name)){
68
+ $result = $this->download_repo($zip_name, $wp_version, $repo_file_path);
69
+ if($result === -99){
70
+ $scan_config['check_repo'] = 0;
71
+ $repo_check_status_code = -99;
72
+ }else if(!$result){
73
+ $scan_config['check_repo'] = 0;
74
+ $repo_check_status_code = -100;
75
+ }
76
+ }
77
+ }
78
+ if($scan_config['plugin_scan'] == 1 && $scan_config['check_repo']){
79
+ $wp_plugin_repo_file=$repo_file_path.DIRECTORY_SEPARATOR."plugins";
80
+ if(!is_dir($wp_plugin_repo_file)){
81
+ mkdir($wp_plugin_repo_file);
82
+ }
83
+ $wp_repo_file['plugins']=$wp_plugin_repo_file;
84
+ $plugin_list=get_site_transient( 'update_plugins' );
85
+ $all_plugins=array();
86
+ foreach ($plugin_list as $key => $value) {
87
+ if($key=='response'||$key=='no_update'){
88
+ foreach ($value as $ke => $val) {
89
+ $all_plugins[$ke] = $val;
90
+ }
91
+ }
92
+ }
93
+ $result = $this->iterator_plugins_themes($all_plugins, $wp_plugin_repo_file, 'plugins');
94
+ if($result === -99){
95
+ $scan_config['check_repo'] = 0;
96
+ $repo_check_status_code = -99;
97
+ }else if(!$result){
98
+ $scan_config['check_repo'] = 0;
99
+ $repo_check_status_code = -100;
100
+ }
101
+ }
102
+ if($scan_config['theme_scan'] == 1 && $scan_config['check_repo']){
103
+ $wp_theme_repo_file=$repo_file_path.DIRECTORY_SEPARATOR."themes";
104
+ if(!is_dir($wp_theme_repo_file)){
105
+ mkdir($wp_theme_repo_file);
106
+ }
107
+ $wp_repo_file['themes']=$wp_theme_repo_file;
108
+ $all_themes=get_site_transient( 'update_themes' )->checked;
109
+ $result = $this->iterator_plugins_themes($all_themes, $wp_theme_repo_file, 'themes');
110
+ if($result === -99){
111
+ $scan_config['check_repo'] = 0;
112
+ $repo_check_status_code = -99;
113
+ }else if(!$result){
114
+ $scan_config['check_repo'] = 0;
115
+ $repo_check_status_code = -100;
116
+ }
117
+ }
118
+ }
119
+ $mo2f_malware_db_handler = new MoWpnsDB();
120
+ $time = current_time('timestamp');
121
+ $result = $this->get_scan_result($mo2f_malware_db_handler, $folderpaths, $wp_repo_file, $scan_config, $base);
122
+ $reportid = $mo2f_malware_db_handler->create_scan_report($folderNames, $scan_config['type_scan'], $time);
123
+ if($result['scan']){
124
+ foreach ($result['scan'] as $key => $value) {
125
+ $mo2f_malware_db_handler->add_report_details($reportid, $key, $value);
126
+ }
127
+ }
128
+ $result['repo_issues'] = $repo_check_status!=$scan_config['check_repo'] ? $repo_check_status_code : $result['repo_issues'];
129
+ $mo2f_malware_db_handler->scan_report_complete($reportid, $result['file_count'], $result['malware_count'], $result['repo_issues'], $result['malicious_link']);
130
+ if(is_dir($repo_file_path)){
131
+ $this->remove_dir($repo_file_path);
132
+ }
133
+ update_option('mo_wpns_malware_scan_in_progress','COMPLETE');
134
+ $total_scan=$mo2f_malware_db_handler->count_files();
135
+ $total_malicious=$mo2f_malware_db_handler->count_malicious_files();
136
+ $last_scan=$mo2f_malware_db_handler->count_files_last_scan($reportid);
137
+ $malicious_last_scan=$mo2f_malware_db_handler->count_malicious_last_scan($reportid);
138
+ if($total_scan > 999){
139
+ $total_scan=($total_scan/1000);
140
+ $total_scan= round($total_scan,1)."k";
141
+ }
142
+ if($total_malicious > 999){
143
+ $total_malicious=($total_malicious/1000);
144
+ $total_malicious= round($total_malicious,1)."k";
145
+ }
146
+ $response=array('total_files'=>$total_scan, 'total_mal'=>$total_malicious, 'scan_files'=>$last_scan, 'mal_files'=>$malicious_last_scan);
147
+ wp_send_json($response);
148
+ }
149
+
150
+ function iterator_plugins_themes($themes_or_plugins, $path, $type=''){
151
+ foreach($themes_or_plugins as $key => $data){
152
+ if($type=='plugins'){
153
+ $plugin_slug=$data->slug;
154
+ $plugin_directory_location=dirname(dirname(dirname($path))).DIRECTORY_SEPARATOR.'plugins';
155
+ $plugin_data=get_plugin_data($plugin_directory_location.DIRECTORY_SEPARATOR.$data->plugin);
156
+ $plugin_version=$plugin_data['Version'];
157
+ if(!is_dir($path.DIRECTORY_SEPARATOR.$plugin_slug)){
158
+ $result= $this->download_repo($plugin_slug, $plugin_version, $path, $type);
159
+ if($result === -99){
160
+ return -99;
161
+ }else if(!$result){
162
+ return false;
163
+ }
164
+ }
165
+ } else if($type=='themes'){
166
+ if(!is_dir($path.DIRECTORY_SEPARATOR.$key)){
167
+ $result= $this->download_repo($key, $data, $path, $type);
168
+ if($result === -99){
169
+ return -99;
170
+ }else if(!$result){
171
+ return false;
172
+ }
173
+ }
174
+ }
175
+ }
176
+ return true;
177
+ }
178
+
179
+ function download_repo($zip_name, $version, $path, $type=''){
180
+ if ($type=='plugins') {
181
+ $download_link="https://downloads.wordpress.org/plugin/".$zip_name.".".$version.".zip";
182
+ $plugin_name=$zip_name.'.'.$version;
183
+ $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
184
+ if( $download_result){
185
+ $result = $this->unzip_downloaded_repo($zip_name, $path);
186
+ return $result;
187
+ }else {
188
+ $download_link="https://downloads.wordpress.org/plugin/".$zip_name.".zip";
189
+ $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
190
+ if( $download_result){
191
+ $result = $this->unzip_downloaded_repo($zip_name, $path);
192
+ return $result;
193
+ }else {
194
+ error_log("Unable to download Plugin: ".$plugin_name);
195
+ return -99;
196
+ }
197
+ return -99;
198
+ }
199
+ } else if($type=='themes'){
200
+ $theme_name=$zip_name.'.'.$version;
201
+ $download_link="https://downloads.wordpress.org/theme/".$theme_name.".zip";
202
+ $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
203
+ if( $download_result){
204
+ $result = $this->unzip_downloaded_repo($zip_name, $path);
205
+ return $result;
206
+ }else {
207
+ $download_link="https://downloads.wordpress.org/theme/".$zip_name.".zip";
208
+ $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.".zip", file_get_contents($download_link));
209
+ if( $download_result){
210
+ $result = $this->unzip_downloaded_repo($zip_name, $path);
211
+ return $result;
212
+ }else {
213
+ error_log("Unable to download Theme: ".$theme_name);
214
+ return -99;
215
+ }
216
+ return -99;
217
+ }
218
+ } else {
219
+ $download_link="https://wordpress.org/wordpress-".$version.".zip";
220
+ $download_result=@file_put_contents($path.DIRECTORY_SEPARATOR.$zip_name.'.zip', file_get_contents($download_link));
221
+ if($download_result){
222
+ $result=$this->unzip_downloaded_repo($zip_name, $path);
223
+ return $result;
224
+ } else {
225
+ error_log("Unable to download wordpress-".$version);
226
+ return -99;
227
+ }
228
+ }
229
+ return false;
230
+ }
231
+
232
+ function unzip_downloaded_repo($name, $path){
233
+ $zip = new ZipArchive;
234
+ $folder_path=$path.DIRECTORY_SEPARATOR.$name.".zip";
235
+ $res = $zip->open($folder_path);
236
+ if ($res === TRUE) {
237
+ // extract it to the path we determined above
238
+ $result = $zip->extractTo($path);
239
+ $zip->close();
240
+ if ($name == get_option('downloaded_wordpress_repo_name')) {
241
+ rename($path.DIRECTORY_SEPARATOR."wordpress", $path.DIRECTORY_SEPARATOR.$name);
242
+ }
243
+ unlink($folder_path);
244
+ return true;
245
+ } else {
246
+ return false;
247
+ }
248
+ }
249
+
250
+ function get_scan_result($mo2f_malware_db_handler=null, $folderpaths=array(), $repo_folder_path=array(), $scan_config, $base){
251
+ if(!empty($folderpaths)){
252
+ if ( in_array( 'curl', get_loaded_extensions() ) ) {
253
+ $scanresults=array();
254
+ $nooffiles=0;
255
+ $scan_malware_count = 0;
256
+ $repo_issue_count = 0;
257
+ $malicious_link_count = 0;
258
+ $file_ext = $scan_config['file_extension'];
259
+ $host = 'http://scanner.api.xecurify.com/malwareservice/rest/file/upload';
260
+ $extensions = array();
261
+ $hostname = 'scanner.api.xecurify.com';
262
+ $malware_server_status = $this->mo_wpns_check_malware_server_status($hostname);
263
+ if(empty($file_ext)){
264
+ }else{
265
+ if(strpos($file_ext,';') !=false){
266
+ $extensions = explode(";", $file_ext);
267
+ }else{
268
+ array_push($extensions, $file_ext);
269
+ }
270
+ }
271
+ $folder_skip_array= empty($scan_config['path_skip']) ? array() : explode(";", $scan_config['path_skip']);
272
+ $skip_path_array= array();
273
+ for($i=0; $i<count($folder_skip_array); $i++){
274
+ $pathParts = explode('/', rtrim(str_replace('\\', '/', $folder_skip_array[$i])));
275
+ $n= sizeof($pathParts)-1;
276
+ $folder= $pathParts[$n];
277
+ array_push($skip_path_array, $folder);
278
+ }
279
+ $enable_extns = $scan_config['type_scan'] == "Custom Scan" && !empty($file_ext) ? false : true;
280
+ foreach ($folderpaths as $value) {
281
+ $onearr = array();
282
+ if (is_dir($value)) {
283
+ foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($value, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
284
+ if ($item->isFile()) {
285
+ $scanresult=array();
286
+ $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
287
+ if ($value == $base && ($scan_config['core_scan'] == 1)){
288
+ $arr = explode(DIRECTORY_SEPARATOR, $iterator->getSubPathName());
289
+ if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('miniorangescan', $arr)) || (!in_array('plugins', $arr) && !in_array('themes', $arr) && !in_array('miniorangescan', $arr))){
290
+
291
+ }else{
292
+ continue;
293
+ }
294
+ }elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
295
+ continue;
296
+ } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
297
+ continue;
298
+ }
299
+ $flag_skip=0;
300
+ if($scan_config['type_scan'] == "Custom Scan" && !empty($folder_skip_array)){
301
+ for($q=0; $q<count($skip_path_array); $q++){
302
+ if(strpos($source_file_path, $skip_path_array[$q])){
303
+ $flag_skip=1;
304
+ break;
305
+ }
306
+ }
307
+ }
308
+ if($flag_skip == 1){
309
+ continue;
310
+ }
311
+ $ext = pathinfo($source_file_path, PATHINFO_EXTENSION);
312
+ $extns = $enable_extns ? true : (in_array($ext, $extensions) ? true : false);
313
+ if($extns){
314
+ $nooffiles++;
315
+ if($nooffiles - get_option('mo_wpns_files_scanned') > 50){
316
+ update_option('mo_wpns_files_scanned', $nooffiles);
317
+ }
318
+ }
319
+
320
+ $hash_of_file= md5_file($source_file_path);
321
+ $res=$mo2f_malware_db_handler->check_hash($hash_of_file);
322
+
323
+ $datascan = empty($res)?true:(isset($res[0]->scan_data) ? unserialize($res[0]->scan_data):false);
324
+ $scanmalware = is_array($datascan)?$datascan['malware']==0:(!empty($datascan) ? $datascan: true);
325
+ $repocheck = is_array($datascan)?$datascan['repo']==0:(!empty($datascan) ? $datascan: true);
326
+ $extlink = is_array($datascan)?$datascan['ext_link']==0:(!empty($datascan) ? $datascan: true);
327
+ $malware_status = $scanmalware? 0 : 1;
328
+ $repo_status = $repocheck? 0 : 1;
329
+ $link_status = $extlink? 0 : 1;
330
+ if(!empty($res) && !$extlink && !$repocheck && !$scanmalware ){}
331
+
332
+ else{
333
+ $flag_update=0;
334
+ $file_content=file_get_contents($source_file_path);
335
+ $source_file_path_size = str_replace("\\", "/", $source_file_path);
336
+ if(($scan_config['check_vulnerable'] == 1 || $scan_config['check_sql'] == 1) && !in_array($ext, array('zip','sitx','7z','rar','gz')) && filesize($source_file_path_size) < 1048576 && $malware_server_status && $extns && $scanmalware){
337
+ $malware_status = 1;
338
+ $cfile=curl_file_create($source_file_path, 'test/plain', time().basename($source_file_path));
339
+ $postdata = array('file' => $cfile);
340
+ $content_type = 'multipart/form-data';
341
+ $issues = $this->mo_wpns_malware_scan_request( $host, $content_type,$postdata);
342
+ if ($issues) {
343
+ $scan_malware_count++;
344
+ $scanresult['scan'] = $issues;
345
+ $flag_update=1;
346
+ }
347
+ }else{
348
+
349
+ }
350
+
351
+ if($scan_config['check_repo'] == 1 && $repocheck && $extns){
352
+ if(!in_array('wp-config.php', $arr) && !in_array($ext, array('zip', 'log', 'htaccess','sitx','7z','rar','gz'))){
353
+ if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('uploads', $arr)) || !in_array('wp-content', $arr)){
354
+ $repo_status = 1;
355
+ if($value==$base){
356
+ $repo_file_path=$repo_folder_path['base'];
357
+ } elseif ($value == $base.DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins') {
358
+ $repo_file_path=$repo_folder_path['plugins'];
359
+ } elseif ($value == $base.DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'themes') {
360
+ $repo_file_path=$repo_folder_path['themes'];
361
+ }
362
+ $issues = $this->check_with_repo_files($file_content, $repo_file_path.DIRECTORY_SEPARATOR.$iterator->getSubPathName());
363
+ if(!empty($issues)){
364
+ $repo_issue_count++;
365
+ $scanresult['repo']=$issues;
366
+ $flag_update=1;
367
+ }
368
+ }
369
+ }
370
+ }
371
+ if($extns && $extlink){
372
+ if($scan_config['ext_link_check'] == 1){
373
+ $link_status = 1;
374
+ $elresult= $this->check_external_link($file_content);
375
+ if(!empty($elresult)){
376
+ $malicious_link_count++;
377
+ $flag_update=1;
378
+ $scanresult['extl']=$elresult;
379
+ }
380
+ }
381
+ }
382
+ if($flag_update == 0){
383
+ $malware_status = ($scan_config['check_vulnerable'] || $scan_config['check_sql']) && $malware_status ? 1 : 0;
384
+ $repo_status = $scan_config['check_repo'] && $repo_status ? 1 : 0;
385
+ $link_status = $scan_config['ext_link_check'] && $link_status ? 1: 0;
386
+ $scan_data = array('malware'=>$malware_status, 'repo'=>$repo_status, 'ext_link'=>$link_status);
387
+ if(empty($res)){
388
+ $mo2f_malware_db_handler->insert_hash($source_file_path, $hash_of_file, $scan_data);
389
+ }else{
390
+ $mo2f_malware_db_handler->update_hash($source_file_path, $hash_of_file, $scan_data);
391
+ }
392
+ }else{
393
+ $infected_files=get_option('mo_wpns_infected_files');
394
+ $infected_files++;
395
+ if(!empty($res)){
396
+ $mo2f_malware_db_handler->delete_hash($source_file_path);
397
+ }
398
+ update_option('mo_wpns_infected_files', $infected_files);
399
+ }
400
+ }
401
+ if(!empty($scanresult))
402
+ $scanresults[$source_file_path]=$scanresult;
403
+ }
404
+ }
405
+ }
406
+ }
407
+ $malware_server_status = $this->mo_wpns_check_malware_server_status($hostname);
408
+ if($malware_server_status){
409
+ $host = 'http://scanner.api.xecurify.com/malwareservice/rest/file/data';
410
+ $postdata = http_build_query(array('fileCount' => $nooffiles, 'maliciousCount' => $scan_malware_count));
411
+ $content_type = 'application/x-www-form-urlencoded';
412
+ $lastRequest = $this->mo_wpns_malware_scan_request( $host, $content_type,$postdata);
413
+ }
414
+ update_option('mo_wpns_files_scanned', $nooffiles);
415
+ return array('file_count'=> $nooffiles, 'malware_count'=>$scan_malware_count, 'repo_issues'=>$repo_issue_count, 'malicious_link'=>$malicious_link_count, 'scan'=>$scanresults);
416
+ }else{
417
+ return array('message'=>'CURL not installed on the server.');
418
+ }
419
+ } else {
420
+ return array('message'=>'No folder selected for scanning.');
421
+ }
422
+ }
423
+
424
+ function mo_wpns_check_malware_server_status($host){
425
+ $fsock = @fsockopen($host, 80, $errno, $errstr, 5);
426
+ if ( ! $fsock ){
427
+ return FALSE;
428
+ }else{
429
+ fclose($fsock);
430
+ return TRUE;
431
+ }
432
+ }
433
+
434
+ function mo_wpns_malware_scan_request( $host, $content_type,$postdata = array()){
435
+ $response = null;
436
+ $ch=curl_init($host);
437
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
438
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
439
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
440
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
441
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
442
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: '.$content_type) );
443
+ curl_setopt( $ch, CURLOPT_POST, true );
444
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $postdata);
445
+ $results=curl_exec($ch);
446
+ curl_close($ch);
447
+ if($results==false){
448
+ error_log('Unable to scan file: '.$postdata['file']->name.' with result: '.$result);
449
+ }else{
450
+ $result = json_decode($results, true);
451
+ if(isset($result['status'])){
452
+ if ($result['status'] == 'success') {
453
+ if($result['result']!='OK')
454
+ $response = $result['result'];
455
+ }else if($result['status']=='error'){
456
+ error_log("Exception on server");
457
+ }
458
+ }else if(strpos($results, 'Summary')){
459
+
460
+ }else{
461
+ error_log("Any other issues on server");
462
+ }
463
+ }
464
+ return $response;
465
+ }
466
+
467
+ function check_with_repo_files($file_content, $repo_file_path){
468
+ $issues = array();
469
+ if(file_exists($repo_file_path)){
470
+ $content=@file_get_contents($repo_file_path);
471
+ $hash_repo = md5($content);
472
+ $hash_file = md5($file_content);
473
+ if ($hash_file != $hash_repo) {
474
+ $flag=1;
475
+ $issues=array("exist" => "Mismatch in Files");
476
+ }
477
+ } else {
478
+ $issues=array('exist'=>'Unwanted File Found');
479
+ }
480
+ return $issues;
481
+ }
482
+
483
+ function getlines($contents, $href){
484
+ $newissues = 0;
485
+ $lines = preg_split("/((\r?\n)|(\r\n?))/", $contents);
486
+ for($i=0; $i<count($lines); $i++){
487
+ $line = $lines[$i];
488
+ if (strpos($line, $href) !== false) {
489
+ $newissues = $i+1;
490
+ }
491
+ }
492
+ return $newissues;
493
+ }
494
+
495
+ function check_external_link($contents){
496
+ $issues = array();
497
+ $hrefs = preg_match_all('/<a\s+(?:[^"\'>]+|"[^"]*"|\'[^\']*\')*href=("[^"]+"|\'[^\'‌​]+\'|[^<>\s]+)/i', $contents, $matches) ? $matches: array();
498
+ if(isset($hrefs[1])){
499
+ foreach($hrefs[1] as $href){
500
+ if($this->isexternal($href)){
501
+ $line=$this->getlines($contents, $href);
502
+ $issues[] = array("i"=>"eld", "d"=>$href, "l"=>$line);
503
+ }
504
+ }
505
+ }
506
+ return $issues;
507
+ }
508
+
509
+ function isexternal($url) {
510
+ $url = trim($url);
511
+ $url = trim($url,';');
512
+ $url = trim($url,'(');
513
+ $url = trim($url,')');
514
+ $url = trim($url,"'");
515
+ $url = trim($url,'"');
516
+ $components = parse_url($url);
517
+ if(isset($components['host'])){
518
+ if(preg_match('/(wordpress|google|miniorange|xecurify|facebook|themeisle|adobe|phppot)/i', $components['host']) === 1) {}
519
+ else{
520
+ if(!empty($components['host']) && strpos(strtolower($components['host']),strtolower($_SERVER['HTTP_HOST'])) === false){
521
+ return true;
522
+ }
523
+ }
524
+ }
525
+ return false;
526
+ }
527
+ function check_vulnerable_code($contents){
528
+ $issues = array();
529
+ $tokens = token_get_all($contents);
530
+
531
+ for($i=0; $i< sizeof($tokens); $i++) {
532
+ $token = $tokens[$i];
533
+ if (is_array($token)) {
534
+ if(in_array(token_name($token[0]), array("T_EVAL"))){
535
+ $issue = $this->getFunctionArgumentsOrEnclosedString("eval", $tokens, $i+1, "vlc", false);
536
+ if(!empty($issue))
537
+ $issues[] = $issue;
538
+ } else if(in_array(token_name($token[0]), array("T_STRING"))){
539
+ if(in_array($token[1],array("popen","fsockopen"))){
540
+ $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", true);
541
+ if(!empty($issue))
542
+ $issues[] = $issue;
543
+ } else if(in_array($token[1],array("assert"))){
544
+ $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "vlc", false);
545
+ if(!empty($issue))
546
+ $issues[] = $issue;
547
+ } else if(in_array($token[1],array("exec","shell_exec","passthru","system","proc_"))){
548
+ $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "shc", false);
549
+ if(!empty($issue))
550
+ $issues[] = $issue;
551
+ } else if(in_array($token[1],array("mysql_connect","mysqli_connect","mysqli_real_connect","PDO"))){
552
+ $issue = $this->getFunctionArgumentsOrEnclosedString($token[1], $tokens, $i+1, "sqc", false);
553
+ if(!empty($issue))
554
+ $issues[] = $issue;
555
+ }
556
+ }
557
+ }
558
+ }
559
+ return $issues;
560
+ }
561
+
562
+ function getFunctionArgumentsOrEnclosedString($issueFunction, $tokens, $start, $issuetype, $checkForExternalLink){
563
+
564
+ $flag = 1;
565
+ $argument = "";
566
+ $line = "";
567
+ $issue = array();
568
+ for($j=$start; $j< sizeof($tokens); $j++) {
569
+ $innertoken = $tokens[$j];
570
+ if ($flag==1 && is_array($innertoken)) {
571
+ $argument .= $innertoken[1];
572
+ if(empty($line))
573
+ $line = $innertoken[2];
574
+ } else if($innertoken==";"){
575
+ $argument .= ";";
576
+ if($checkForExternalLink){
577
+ if($this->isexternal($argument)){
578
+ $issue = array("l"=>$line, "t"=> $issueFunction, "i"=>$issuetype, "d"=>$argument);
579
+ }
580
+ } else {
581
+ $issue = array("l"=>$line, "t"=> $issueFunction, "i"=>$issuetype, "d"=>$argument);
582
+ }
583
+ break;
584
+ } else if($flag==1){
585
+ $argument .= $innertoken;
586
+ }
587
+ }
588
+ return $issue;
589
+ }
590
+
591
+ function remove_dir($repo_path){
592
+ $dir=$repo_path;
593
+ $it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
594
+ $files = new RecursiveIteratorIterator($it,RecursiveIteratorIterator::CHILD_FIRST);
595
+ foreach($files as $file) {
596
+ if ($file->isDir()){
597
+ rmdir($file->getRealPath());
598
+ } else {
599
+ unlink($file->getRealPath());
600
+ }
601
+ }
602
+ rmdir($dir);
603
+ }
604
+
605
+ function count_total_files($folder_paths, $base, $scan_config){
606
+
607
+ $file_count=0;
608
+ $file_ext = $scan_config['file_extension'];
609
+ $extensions = array();
610
+ if(empty($file_ext)){
611
+
612
+ }else{
613
+ if(strpos($file_ext,';') !=false){
614
+ $extensions = explode(";", $file_ext);
615
+ }else{
616
+ array_push($extensions, $file_ext);
617
+ }
618
+ }
619
+ $enable_extns = $scan_config['type_scan'] == "Custom Scan" && !empty($file_ext) ? false : true;
620
+ $folder_skip_array= empty($scan_config['path_skip']) ? array() : explode(";", $scan_config['path_skip']);
621
+ $skip_path_array= array();
622
+ for($i=0; $i<count($folder_skip_array); $i++){
623
+ $pathParts = explode('/', $folder_skip_array[$i]);
624
+ $n= sizeof($pathParts)-1;
625
+ $folder= $pathParts[$n];
626
+ array_push($skip_path_array, $folder);
627
+ }
628
+ foreach ($folder_paths as $value) {
629
+ if (is_dir($value)) {
630
+ foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($value, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) {
631
+ if ($item->isFile()) {
632
+ $source_file_path = $value . DIRECTORY_SEPARATOR . $iterator->getSubPathName();
633
+ if ($value == $base && ($scan_config['core_scan'] == 1)){
634
+ $arr = explode(DIRECTORY_SEPARATOR, $iterator->getSubPathName());
635
+ if(($arr[count($arr)-1]== 'index.php' && (count($arr)==1 || in_array($arr[count($arr)-2], array('wp-content', 'plugins', 'themes'))) && !in_array('miniorange', $arr)) || (!in_array('plugins', $arr) && !in_array('themes', $arr) && !in_array('miniorange', $arr))){
636
+
637
+ }else{
638
+ continue;
639
+ }
640
+ }elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'plugins' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
641
+ continue;
642
+ } elseif ($value == $base.DIRECTORY_SEPARATOR.'wp-content'.DIRECTORY_SEPARATOR.'themes' && explode(DIRECTORY_SEPARATOR,$iterator->getSubPathName())[0]=='index.php'){
643
+ continue;
644
+ }
645
+ $flag_skip=0;
646
+ if (!empty($folder_skip_array)) {
647
+ for($q=0; $q<count($skip_path_array); $q++){
648
+ if(strpos($source_file_path, $skip_path_array[$q])){
649
+ $flag_skip=1;
650
+ break;
651
+ }
652
+ }
653
+ }
654
+ if($flag_skip == 1){
655
+ continue;
656
+ }
657
+ $ext = pathinfo($source_file_path, PATHINFO_EXTENSION);
658
+ $extns = $enable_extns ? true : (in_array($ext, $extensions)? true : false);
659
+ if($extns)
660
+ $file_count++;
661
+ }
662
+ }
663
+ }
664
+ }
665
+ update_option('mo_wpns_total_files', $file_count);
666
+ }
667
+ }
668
+ new Mo_wpns_Scan_Handler;
669
  ?>
handler/mo-error.html CHANGED
@@ -1,11 +1,11 @@
1
- <img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAVMAAACVCAMAAADSU+lbAAAA51BMVEX///9fYGJeYGL3k01cXV9ZWlz8/PxdXmFhYmTv7+/5+fnm5+eSk5Tq6upaW173kUnV1dZqa21xcnTe39+IiYrMzc2bznuPkJHDxMWfn6D2j0VrbG19fX+EhIf+9e95eny2trf4pGr5rnnAwMGqq6yioqT4oGL3mFRNmWX949NSU1X+7eP83cn7zK3++PL5s4X6wpzy+e770riv2Jb82MD5touXxKX96Nu61cLg7eRzrYQ+kln3o2aiya73m1vM4NGGuZSszrZjp2t2tHCSxYG43KLL5buKwnXW6smm04np9ONmp3vC4K/9LbbnAAARyklEQVR4nO1ci2LbthUlaYAQSYkSKal6S7QlWbEl24obN22XuXul67b+//cMuBcgAZBytCVLkxVn6WJDEEgc3sfBBRjPc3BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBw+BSIkqSfJEn8H/UO/7f39JUjbs9mWZblxVk0RYtMIB++2Ot+ubw3hwt/+O/v8OtDp0UIYYyOonN69wiAtk91uL+5e7q6ury8uno4HipeX393ph/8XyBpMQEyOIvToc98nz+BRk7D/ePllKOLmE6v36qPvn/1ezLUpBUIns7m1A8C5jdyenO8nnYvdEyf5Ec//PiHnz7dLX/xSFq+AD2bU+hd53R5vO6ajF5cdN/d44d/evWHP37Su/6yAfGUR8iPjKdvDEa7+Mv0CiJq/N2rV6/+9Inv+0tG3M4BZ+b9AfYem83LY+n1PIxOL3a7nfj7+SA+/OnHV4LT1xy/FwkW9QXO1acd6N03G/dPFa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G4J/JtZsi5JW4vCGelHYi3qm4gsW7WLnktOH43YgHN6BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHh/Pwb5PnTnFHEM1hAAAAAElFTkSuQmCC" style="margin-left: 5em;width: 12em;margin-top: 1px;">
2
- <div>
3
- <img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N13nFTV3T/wz50+21hgl91l6b2JCGJHxS4WigUZFUuMYyTR50meTMovz5P2S35PJqaZoI5JlICOJbqoKDYUlC4KSO8odYEFtk6/9/z+mF1YYcuUe+fcc+/3/Xqt4DJ757u7M+d87ynfIzHGQAghhBBzsfAOgBBCCCG5RwkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmZOPxpB6vzwJgFIARABoAnGj1cTwY8Cs84iKEEEK00NzvdQfQrdVHIYAtADbx6PckxlhOnsjj9Y0FcAuASwBcBKConYceBTAHwD+CAf/OnARHCCGEaMDj9Q0G8BCA+wH0aOdh9QBWAVgBYEEw4F+bi9g0TwCav/nfArg9gy9fAuDvAF4PBvxRNeMihBBCtODx+pwAbgPwbQBXZnCJ1wD8VOubYM0SAI/XVwbg50j+ALKdatgH4L8BvEDTA4QQQvSoeZj/HgC/BtAny8slkLwB/mUw4D+SbWxt0SQB8Hh9QwF8BKBS5UtvB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umkl9ff2TOrv8wrgAPX3dz9wIOgdTkrDISGMkgJACCGEyCDZBiiEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJk0P8HIGK4qJUDxrEAAAAASUVORK5CYII=" style="width: 16em;margin-left: 52em;margin-top: 63px;">
4
- <div>
5
- <div><h1 style="font-size: 90px;margin-top: -2em;margin-left: 401PX;">403</h1></div>
6
- <div><h2 style="font-size: 54px;margin-left: 557px;margin-top: -140px;" >Forbidden</h2></div>
7
- <div><h6 style="font-size: 21px;margin-left: 23em;margin-top: 7em;color: red;">Your request was detected as suspicious.<h6></div>
8
- <div><h6 style="font-size: 21px;margin-left: 17em;margin-top: -2em;color: red;">Please Contact Your Site Administrator if you feel the request is legitimate.<h6></div>
9
- <h6 style="font-size: 21px;margin-left:20em;">For more information please contact miniorange <a href="https://faq.miniorange.com/">FAQ'S</h6>
10
- </div>
11
  </div>
1
+ <img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAVMAAACVCAMAAADSU+lbAAAA51BMVEX///9fYGJeYGL3k01cXV9ZWlz8/PxdXmFhYmTv7+/5+fnm5+eSk5Tq6upaW173kUnV1dZqa21xcnTe39+IiYrMzc2bznuPkJHDxMWfn6D2j0VrbG19fX+EhIf+9e95eny2trf4pGr5rnnAwMGqq6yioqT4oGL3mFRNmWX949NSU1X+7eP83cn7zK3++PL5s4X6wpzy+e770riv2Jb82MD5touXxKX96Nu61cLg7eRzrYQ+kln3o2aiya73m1vM4NGGuZSszrZjp2t2tHCSxYG43KLL5buKwnXW6smm04np9ONmp3vC4K/9LbbnAAARyklEQVR4nO1ci2LbthUlaYAQS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JMNiMhq0i2GiTUEcZS5vxejeqzpU6OAYeI46kr5vVgHC/lj0gdPYZ73J9BnxdidJ7T6brHJGL9Tm1AclrAku+D/6FRUxBj7IaIB1/nltTN7nrPP8nx376sWT6e7h8fB2v9/fvDleT9VbU92dvcHyeSFXTtphni8fe/Odsx2+c1a+2De9rL+Q8lmBJ6R8uvkSLfIU7u926qgEEHuh/zJ98SzlZwAurbhcOmO75EvC26cL661oGWO77xre8fmciIczWYKtvSjxxePw9Gy/Gd2dXlzefbho9T9E3BkOUrEZJfaGv6ZwKnF/w/O8+CcRhPPDP4rw/PTmN3D7ZIxYr4tNe+7LulRgHRz5WhAu3z4+XD5zQi92766Oh/1v4vUFbUn4qXwvDMtEX1OGshDeL5fL3zCGFtTH4/X4UhNWqQLSvGpzOAsFZUxVt3DvXBSJ8t6Hv+lwCoV6VySQfh+IFzy/upz/RaG4LSt90u3JzK42O/xnKG4J/JtZsi5JW4vCGelHYi3qm4gsW7WLnktOH43YgHN6BwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHh/Pwb5PnTnFHEM1hAAAAAElFTkSuQmCC" style="margin-left: 5em;width: 12em;margin-top: 1px;">
2
+ <div>
3
+ <img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N13nFTV3T/wz50+21hgl91l6b2JCGJHxS4WigUZFUuMYyTR50meTMovz5P2S35PJqaZoI5JlICOJbqoKDYUlC4KSO8odYEFtk6/9/z+mF1YYcuUe+fcc+/3/Xqt4DJ757u7M+d87ynfIzHGQAghhBBzsfAOgBBCCCG5RwkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBCCCEmRAkAIYQQYkKUABBC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qf+WsbRVuB1jc+iEIkjiwBF4lVHN/0h8Cmgw3UsDTcDbw56hydcB5IG1dFNPcB26lM/cVAE3h70Dn/OdSBCtENGAETiNX4RX4b7Y1f3AW8H3ijJ35zGa/lG6q/tPsfhfAu4TJK/SAMZARCpUh3d9DvUh2afG+FlxxvX/FjQOzwV4XUzpzq6qQt4NzAIrIjw0j8DBoPe4e9EeE0hrJICQKROdXSTor6V7EPABRYvVQG2AX8rnd+iVR3ddBrw34ABIGfxUvcB7wd2Br3D8stSpIoUACK1qqObfOBK6nPH1wDnG3jYInAr8BXg60HvcNxXqadadXTTauC1wBuo7xowsQ7kfurrOG4GbpPOjSKtpAAQmVEd3fRM6oXAVcBTgNMAtcS3TQL7gR9RTwj/EvQOT1oMU7SoOrqpG3g19ff4+cAZQPcS36aBQ8ADwC3AzUHv8K8shilEbEgBIDKrOropB6ylnijObPz7OPWEvw/YJ1u8kq06umkl9ff2TOrv8wrgAPX3dz9wIOgdTkrDISGMkgJACCGEyCDZBiiEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJkkBQAQgghRAZJASCEEEJk0P8HIGK4qJUDxrEAAAAASUVORK5CYII=" style="width: 16em;margin-left: 52em;margin-top: 63px;">
4
+ <div>
5
+ <div><h1 style="font-size: 90px;margin-top: -2em;margin-left: 401PX;">403</h1></div>
6
+ <div><h2 style="font-size: 54px;margin-left: 557px;margin-top: -140px;" >Forbidden</h2></div>
7
+ <div><h6 style="font-size: 21px;margin-left: 23em;margin-top: 7em;color: red;">Your request was detected as suspicious.<h6></div>
8
+ <div><h6 style="font-size: 21px;margin-left: 17em;margin-top: -2em;color: red;">Please Contact Your Site Administrator if you feel the request is legitimate.<h6></div>
9
+ <h6 style="font-size: 21px;margin-left:20em;">For more information please contact miniorange <a href="https://faq.miniorange.com/">FAQ'S</h6>
10
+ </div>
11
  </div>
handler/recaptcha.php CHANGED
@@ -1,156 +1,156 @@
1
- <?php
2
-
3
- class mo2f_ReCaptcha
4
- {
5
- function __construct()
6
- {
7
- add_filter( 'admin_init' , array($this, 'handle_recaptcha' ), 11, 3 );
8
- add_action( 'login_form' , array($this, 'custom_login_fields' ) );
9
- add_action( 'register_form' , array($this, 'register_with_captcha') );
10
- add_action( 'woocommerce_register_form' , array($this, 'woocommerce_register_with_captcha'));
11
- add_action( 'woocommerce_login_form', array($this, 'woocommerce_login_with_captcha'));
12
- add_action( 'woocommerce_review_order_before_submit', array($this, 'woocommerce_register_with_captcha_checkout'));
13
- }
14
-
15
-
16
- //Function to handle Testing reCaptcha
17
- function handle_recaptcha()
18
- {
19
- global $moWpnsUtility,$mo2f_dirName;
20
- if (current_user_can( 'manage_options' ))
21
- {
22
- if(isset($_REQUEST['option']) && $_REQUEST['option']=='testrecaptchaconfig')
23
- {
24
- if(array_key_exists('g-recaptcha-response',$_POST))
25
- {
26
- $userIp = $moWpnsUtility->get_client_ip();
27
- $mocURL = new MocURL;
28
- $response = $mocURL->validate_recaptcha($userIp,sanitize_text_field($_POST['g-recaptcha-response']));
29
- $content = json_decode($response, true);
30
- if(isset($content['error-codes']) && in_array("invalid-input-secret", $content['error-codes']))
31
- echo "<br><br><h2 style=color:red;text-align:center>Invalid Secret Key.</h2>";
32
- else if(isset($content['success']) && $content['success']==1)
33
- echo "<br><br><h2 style=color:green;text-align:center>Test was successful and captcha verified.</h2>";
34
- else
35
- echo "<br><br><h2 style=color:red;text-align:center>Invalid captcha. Please try again.</h2>";
36
- }
37
- show_google_recaptcha_form_v2();
38
- }
39
- if(isset($_REQUEST['option']) && $_REQUEST['option']=='testrecaptchaconfig3')
40
- {
41
- if(array_key_exists('g-recaptcha-response',$_REQUEST))
42
- {
43
- $userIp = $moWpnsUtility->get_client_ip();
44
- $mocURL = new MocURL;
45
-
46
- $response = $mocURL->get_Captcha_v3($_REQUEST['g-recaptcha-response']);
47
-
48
- $content = json_decode($response, true);
49
- if(isset($content['error-codes']) && in_array("invalid-input-secret", $content['error-codes']))
50
- echo "<br><br><h2 style=color:red;text-align:center>Invalid Secret Key.</h2>";
51
- else if(isset($content['success']) && $content['success']==1)
52
- {
53
-
54
- if($content['success']==1)
55
- {
56
- if($content['score']>=0.9)
57
- {
58
- echo "<br><br><h2 style=color:green;text-align:center>Welcome!</h2>";
59
- echo "<h2 style=color:green;text-align:center>Test was successful and captcha verified.</h2>";
60
- }
61
- else echo "<br><br><h2 style=color:red;text-align:center>Captcha verification failed! Permission denied.</h2>";
62
- }
63
- }
64
- else
65
- echo "<br><br><h2 style=color:red;text-align:center>Invalid captcha. Please try again.</h2>";
66
- }
67
- show_google_recaptcha_form_v3();
68
- }
69
- }
70
- }
71
-
72
-
73
- function custom_login_fields()
74
- {
75
- global $moWpnsUtility,$mo2f_dirName;
76
- if(get_option('mo_wpns_activate_recaptcha_for_login') && MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option'))
77
- {
78
- if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v3')
79
- show_google_recaptcha_form_v3_login();
80
- else if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v2')
81
- {
82
- echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
83
- echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
84
- echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#loginform{padding-bottom:20px;}</style>';
85
- }
86
- }
87
- }
88
-
89
-
90
- function register_with_captcha(){
91
- global $moWpnsUtility,$mo2f_dirName;
92
- if(get_option('mo_wpns_activate_recaptcha_for_registration'))
93
- {
94
- if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v3')
95
- show_google_recaptcha_form_v3_login();
96
- else if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v2')
97
- show_google_recaptcha_form_v2_login();
98
- }
99
- }
100
-
101
- function woocommerce_register_with_captcha(){
102
- if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_registration'))
103
- {
104
- echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
105
- echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
106
- echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#registerform{padding-bottom:20px;}</style>';
107
- }
108
- }
109
-
110
- function woocommerce_login_with_captcha(){
111
- if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_login'))
112
- {
113
-
114
- echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
115
-
116
- echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
117
- echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#loginform{padding-bottom:20px;}</style>';
118
- }
119
- }
120
-
121
- function woocommerce_register_with_captcha_checkout(){
122
-
123
- if (!is_user_logged_in()){
124
- if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_registration'))
125
- {
126
- echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
127
- echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
128
- echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#registerform{padding-bottom:20px;}</style>';
129
- }
130
- }
131
- }
132
-
133
- public static function recaptcha_verify($response)
134
- {
135
- global $moWpnsUtility;
136
- $userIp = $moWpnsUtility->get_client_ip();
137
- $mocURL = new MocURL;
138
- $response = $mocURL->validate_recaptcha($userIp,$response);
139
- $content = json_decode($response, true);
140
- $isvalid = isset($content['success']) && $content['success']==1 ? true : false;
141
- return $isvalid;
142
- }
143
-
144
- public static function recaptcha_verify_3($response)
145
- {
146
- global $moWpnsUtility;
147
- $userIp = $moWpnsUtility->get_client_ip();
148
- $mocURL = new MocURL;
149
- $response = $mocURL->get_Captcha_v3($response);
150
- $content = json_decode($response, true);
151
- $isvalid = isset($content['success']) && $content['success']==1 && $content['score']>=0.9? true : false;
152
- return $isvalid;
153
- }
154
-
155
- }
156
- new mo2f_ReCaptcha;
1
+ <?php
2
+
3
+ class mo2f_ReCaptcha
4
+ {
5
+ function __construct()
6
+ {
7
+ add_filter( 'admin_init' , array($this, 'handle_recaptcha' ), 11, 3 );
8
+ add_action( 'login_form' , array($this, 'custom_login_fields' ) );
9
+ add_action( 'register_form' , array($this, 'register_with_captcha') );
10
+ add_action( 'woocommerce_register_form' , array($this, 'woocommerce_register_with_captcha'));
11
+ add_action( 'woocommerce_login_form', array($this, 'woocommerce_login_with_captcha'));
12
+ add_action( 'woocommerce_review_order_before_submit', array($this, 'woocommerce_register_with_captcha_checkout'));
13
+ }
14
+
15
+
16
+ //Function to handle Testing reCaptcha
17
+ function handle_recaptcha()
18
+ {
19
+ global $moWpnsUtility,$mo2f_dirName;
20
+ if (current_user_can( 'manage_options' ))
21
+ {
22
+ if(isset($_REQUEST['option']) && $_REQUEST['option']=='testrecaptchaconfig')
23
+ {
24
+ if(array_key_exists('g-recaptcha-response',$_POST))
25
+ {
26
+ $userIp = $moWpnsUtility->get_client_ip();
27
+ $mocURL = new MocURL;
28
+ $response = $mocURL->validate_recaptcha($userIp,sanitize_text_field($_POST['g-recaptcha-response']));
29
+ $content = json_decode($response, true);
30
+ if(isset($content['error-codes']) && in_array("invalid-input-secret", $content['error-codes']))
31
+ echo "<br><br><h2 style=color:red;text-align:center>Invalid Secret Key.</h2>";
32
+ else if(isset($content['success']) && $content['success']==1)
33
+ echo "<br><br><h2 style=color:green;text-align:center>Test was successful and captcha verified.</h2>";
34
+ else
35
+ echo "<br><br><h2 style=color:red;text-align:center>Invalid captcha. Please try again.</h2>";
36
+ }
37
+ show_google_recaptcha_form_v2();
38
+ }
39
+ if(isset($_REQUEST['option']) && $_REQUEST['option']=='testrecaptchaconfig3')
40
+ {
41
+ if(array_key_exists('g-recaptcha-response',$_REQUEST))
42
+ {
43
+ $userIp = $moWpnsUtility->get_client_ip();
44
+ $mocURL = new MocURL;
45
+
46
+ $response = $mocURL->get_Captcha_v3($_REQUEST['g-recaptcha-response']);
47
+
48
+ $content = json_decode($response, true);
49
+ if(isset($content['error-codes']) && in_array("invalid-input-secret", $content['error-codes']))
50
+ echo "<br><br><h2 style=color:red;text-align:center>Invalid Secret Key.</h2>";
51
+ else if(isset($content['success']) && $content['success']==1)
52
+ {
53
+
54
+ if($content['success']==1)
55
+ {
56
+ if($content['score']>=0.9)
57
+ {
58
+ echo "<br><br><h2 style=color:green;text-align:center>Welcome!</h2>";
59
+ echo "<h2 style=color:green;text-align:center>Test was successful and captcha verified.</h2>";
60
+ }
61
+ else echo "<br><br><h2 style=color:red;text-align:center>Captcha verification failed! Permission denied.</h2>";
62
+ }
63
+ }
64
+ else
65
+ echo "<br><br><h2 style=color:red;text-align:center>Invalid captcha. Please try again.</h2>";
66
+ }
67
+ show_google_recaptcha_form_v3();
68
+ }
69
+ }
70
+ }
71
+
72
+
73
+ function custom_login_fields()
74
+ {
75
+ global $moWpnsUtility,$mo2f_dirName;
76
+ if(get_option('mo_wpns_activate_recaptcha_for_login') && MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option'))
77
+ {
78
+ if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v3')
79
+ show_google_recaptcha_form_v3_login();
80
+ else if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v2')
81
+ {
82
+ echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
83
+ echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
84
+ echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#loginform{padding-bottom:20px;}</style>';
85
+ }
86
+ }
87
+ }
88
+
89
+
90
+ function register_with_captcha(){
91
+ global $moWpnsUtility,$mo2f_dirName;
92
+ if(get_option('mo_wpns_activate_recaptcha_for_registration'))
93
+ {
94
+ if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v3')
95
+ show_google_recaptcha_form_v3_login();
96
+ else if(get_option('mo_wpns_recaptcha_version')=='reCAPTCHA_v2')
97
+ show_google_recaptcha_form_v2_login();
98
+ }
99
+ }
100
+
101
+ function woocommerce_register_with_captcha(){
102
+ if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_registration'))
103
+ {
104
+ echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
105
+ echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
106
+ echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#registerform{padding-bottom:20px;}</style>';
107
+ }
108
+ }
109
+
110
+ function woocommerce_login_with_captcha(){
111
+ if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_login'))
112
+ {
113
+
114
+ echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
115
+
116
+ echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
117
+ echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#loginform{padding-bottom:20px;}</style>';
118
+ }
119
+ }
120
+
121
+ function woocommerce_register_with_captcha_checkout(){
122
+
123
+ if (!is_user_logged_in()){
124
+ if(get_option('mo_wpns_activate_recaptcha_for_woocommerce_registration'))
125
+ {
126
+ echo "<script src='".MoWpnsConstants::RECAPTCHA_URL."'></script>";
127
+ echo '<div class="g-recaptcha" data-sitekey="'.get_option("mo_wpns_recaptcha_site_key").'"></div>';
128
+ echo '<style>#login{ width:349px;padding:2% 0 0; }.g-recaptcha{margin-bottom:5%;}#registerform{padding-bottom:20px;}</style>';
129
+ }
130
+ }
131
+ }
132
+
133
+ public static function recaptcha_verify($response)
134
+ {
135
+ global $moWpnsUtility;
136
+ $userIp = $moWpnsUtility->get_client_ip();
137
+ $mocURL = new MocURL;
138
+ $response = $mocURL->validate_recaptcha($userIp,$response);
139
+ $content = json_decode($response, true);
140
+ $isvalid = isset($content['success']) && $content['success']==1 ? true : false;
141
+ return $isvalid;
142
+ }
143
+
144
+ public static function recaptcha_verify_3($response)
145
+ {
146
+ global $moWpnsUtility;
147
+ $userIp = $moWpnsUtility->get_client_ip();
148
+ $mocURL = new MocURL;
149
+ $response = $mocURL->get_Captcha_v3($response);
150
+ $content = json_decode($response, true);
151
+ $isvalid = isset($content['success']) && $content['success']==1 && $content['score']>=0.9? true : false;
152
+ return $isvalid;
153
+ }
154
+
155
+ }
156
+ new mo2f_ReCaptcha;
handler/security_features.php CHANGED
@@ -1,47 +1,47 @@
1
- <?php
2
- class Mo_2fa_security_features
3
- {
4
- function wpns_2fa_features_only()
5
- {
6
- update_option( 'mo_wpns_2fa_with_network_security', 0);
7
- update_option( 'mo_wpns_2fa_with_network_security_popup_visible', 0);
8
- ?><script>window.location.href="admin.php?page=mo_2fa_two_fa";</script><?php
9
-
10
- }
11
-
12
- function wpns_2fa_with_network_security($postvalue)
13
- {
14
- $nonce= sanitize_text_field(wp_unslash($_POST['mo_security_features_nonce']));
15
-
16
- if ( wp_verify_nonce( $nonce, 'mo_2fa_security_features_nonce' ) )
17
- {
18
- $enable_newtwork_security_features = isset($postvalue['mo_wpns_2fa_with_network_security']) ? true : false;
19
-
20
- update_option( 'mo_wpns_2fa_with_network_security', $enable_newtwork_security_features);
21
-
22
- if ($enable_newtwork_security_features)
23
- {
24
- $mo2f_enable_all_enable = new Mo2f_ajax_dashboard();
25
- $mo2f_enable_all_enable -> mo2f_handle_all_enable(1);
26
- }
27
-
28
-
29
-
30
- update_option( 'mo_wpns_2fa_with_network_security_popup_visible', 0);
31
- if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
32
- {
33
- ?><script>window.location.href="admin.php?page=mo_2fa_dashboard";</script><?php
34
- }
35
- else
36
- {
37
- ?><script>window.location.href="admin.php?page=mo_2fa_two_fa";</script><?php
38
- }
39
-
40
-
41
- }
42
- else
43
- do_action('wpns_show_message',MoWpnsMessages::showMessage('NONCE_ERROR'),'ERROR');
44
-
45
- }
46
- }new Mo_2fa_security_features;
47
- ?>
1
+ <?php
2
+ class Mo_2fa_security_features
3
+ {
4
+ function wpns_2fa_features_only()
5
+ {
6
+ update_option( 'mo_wpns_2fa_with_network_security', 0);
7
+ update_option( 'mo_wpns_2fa_with_network_security_popup_visible', 0);
8
+ ?><script>window.location.href="admin.php?page=mo_2fa_two_fa";</script><?php
9
+
10
+ }
11
+
12
+ function wpns_2fa_with_network_security($postvalue)
13
+ {
14
+ $nonce= sanitize_text_field(wp_unslash($_POST['mo_security_features_nonce']));
15
+
16
+ if ( wp_verify_nonce( $nonce, 'mo_2fa_security_features_nonce' ) )
17
+ {
18
+ $enable_newtwork_security_features = isset($postvalue['mo_wpns_2fa_with_network_security']) ? true : false;
19
+
20
+ update_option( 'mo_wpns_2fa_with_network_security', $enable_newtwork_security_features);
21
+
22
+ if ($enable_newtwork_security_features)
23
+ {
24
+ $mo2f_enable_all_enable = new Mo2f_ajax_dashboard();
25
+ $mo2f_enable_all_enable -> mo2f_handle_all_enable(1);
26
+ }
27
+
28
+
29
+
30
+ update_option( 'mo_wpns_2fa_with_network_security_popup_visible', 0);
31
+ if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
32
+ {
33
+ ?><script>window.location.href="admin.php?page=mo_2fa_dashboard";</script><?php
34
+ }
35
+ else
36
+ {
37
+ ?><script>window.location.href="admin.php?page=mo_2fa_two_fa";</script><?php
38
+ }
39
+
40
+
41
+ }
42
+ else
43
+ do_action('wpns_show_message',MoWpnsMessages::showMessage('NONCE_ERROR'),'ERROR');
44
+
45
+ }
46
+ }new Mo_2fa_security_features;
47
+ ?>
handler/signature/APLFI.php CHANGED
@@ -1,5 +1,5 @@
1
- <?php
2
-
3
- $regex['LFI'][1] = array( "#(?i)(?:\x5c|(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\/))(?:%(?:(?:f(?:(?:c%80|8)%8)?0%8|e)0%80%ae|2(?:(?:5(?:c0%25a|2))?e|%45)|u(?:(?:002|ff0)e|2024)|%32(?:%(?:%6|4)5|E)|c0(?:%[256aef]e|\.))|\.(?:%0[01]|\?)?|\?\.?|0x2e){2}(?:\x5c|(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\/))#" , "# (?:^|[\\/])\.\.(?:[\\/]|$)#","#(?:etc/(?:s(?:e(?:curity/(?:(?:(?:namespac|tim)e|sepermit|access).conf|l(?:imits(?:.conf)?|astlog)|(?:failedlogi|enviro)n|pa(?:m_env.conf|sswd)|group(?:.conf)?|opasswd|user)|nsors3?.conf)|ys(?:c(?:tl(?:.d/(?:10-(?:(?:network|process)-security|console-messages)|wine.sysctl))?.conf|onfig/network-scripts/ifcfg-eth0)|log.conf)|quirrelmail/(?:(?:config(?:_(?:default|local)|/config)?|sqspell_config|filters_setup|index).php|(?:default_pre|apache.con)f)|amba/(?:s(?:mb(?:.conf(?:.user)?|passwd|users)|amba.conf)|private/smbpasswd|dhcp.conf|netlogon)|(?:w-cp-server/applications.d/(?:00-sso-cpserver|plesk)|tunnel/stunnel).conf|u(?:bversion/config|se-release|doers)|s(?:o/sso_config.ini|h/sshd_config)|m(?:b(?:passwd|.conf)|i.conf)|lackware-release|hadow[-~]?)|a(?:p(?:ache(?:2(?:/(?:(?:mods-(?:available/(?:m(?:em_cach|im)e|s(?:etenvif|sl)|d(?:eflate|ir)|autoindex|proxy)|enabled/(?:(?:statu|alia)s|d(?:eflate|ir)|negotiation|mime|php5))|(?:apache|httpd)2?|default-server|ports).conf|s(?:ites-(?:available/default(?:-ssl)?|enabled/(?:000-)?default)|sl-global.conf)|conf(?:.d/(?:phpmyadmin.conf|security|charset)|/httpd.conf)|vhosts.d/(?:00_default_vhost.conf|default_vhost.include)|envvars)|2(?:/conf)?/httpd.conf)|/(?:a(?:ccess|pache)|(?:conf/)?httpd|default-server).conf)|t/apt.conf)|(?:vahi/avahi-daemon|dduser).conf|lias)|p(?:hp(?:(?:(?:(?:4(?:/(?:apache2?|cgi)|.4/fcgi)|5/(?:apache2?|cgi))/|/(?:(?:apache2?|cgi)/|(?:php4/)?))php)?.ini|myadmin/config.inc.php)|u(?:re(?:-ftpd(?:/pure(?:-ftpd.(?:conf|pdb)|ftpd.pdb)|.conf)|ftpd.p(?:asswd|db))|lse/client.conf)|ro(?:f(?:tp(?:d/modules)?.conf|ile)|tpd/proftpd.conf)|a(?:ssw(?:ord.master|d[-~]?)|m.(?:d/proftpd|conf))|ostgresql/p(?:ostgresql|g_hba).conf)|m(?:o(?:no/(?:(?:2.0/(?:machine|web)|1.0/machine).)?config|d(?:probe.d/vmware-tools.conf|ules)|td)|(?:y(?:sql/(?:conf.d/old_passwords|my))?.c|iredo(?:/miredo)?(?:-server)?.co)nf|uddleftpd(?:/(?:mud(?:dleftpd.(?:passwd|conf)|log(?:d.conf)?)|passwd)|.com)|a(?:n(?:drake-release|path.config)|il/sendmail.conf)|t(?:ools.conf|ab))|h(?:ttp(?:d(?:/(?:conf(?:.d(?:/(?:squirrelmail|php).conf)?|/(?:apache2?|httpd).conf)?|(?:extra/httpd-ssl|apache2?|mod_php|httpd).conf|logs/(?:access.)log|php.ini)|.conf)|(?:/conf)?/httpd.conf)|ost(?:s(?:.(?:allow|deny))?|.conf|name)|dparm.conf)|c(?:ups/(?:(?:p(?:rinter|dftop)s|acroread).conf|cupsd.conf(?:.default)?)|(?:lamav/(?:freshclam|clamd)|vs-(?:pserver|cron)).conf|a(?:-certificates.conf(?:.dpkg-old)?|sper.conf)|h(?:krootkit.conf|rootusers)|r(?:ypt|on)tab)|w(?:icd/(?:(?:wire(?:less|d)|manager)-settings.conf|dhclient.conf.template.default)|u-ftpd/ftp(?:acces|host|user)s|ebmin/miniserv.(?:users|conf))|v(?:mware-tools/(?:(?:vmware-tools-libraries|tpvmlp).conf|config)|sftpd(?:.c(?:hroot_list|onf)|/vsftpd.conf)|hcs2/proftpd/proftpd.conf)|l(?:og(?:rotate.(?:d/(?:vsftpd.log|proftpd|ftp)|conf)|in.defs)|(?:ighttpd/lighthttpd|d(?:ap/ldap|.so)|trace).conf)|r(?:e(?:solv(?:conf/update-libc.d/sendmail|.conf)|d(?:is(?:-sentinel)?.conf|hat-release))|c.(?:d/rc.httpd|conf))|d(?:e(?:b(?:ian_version|conf.conf)|fault/grub|luser.conf)|(?:hcp(?:3/dhc(?:lient|pd)|/dhclient)|ns2tcpd).conf)|f(?:tp(?:(?:host|user)s|chroot)|(?:oremost|use).conf|edora-release|irewall.rules|stab)|b(?:luetooth/(?:network|rfcomm|input|main).conf|ash(?:_completion.d/debconf|.bashrc))|x11/xorg.conf(?:.(?:beforevmwaretoolsinstall|orig)|-v(?:mware|esa))?|i(?:n(?:it(?:tab|.d|/)|etd.conf)|pfw.(?:rules|conf)|ssue(?:.net)?)|t(?:i(?:nyproxy/tinyproxy.conf|mezone)|(?:or/tor-t)?socks.conf)|o(?:s(?:xhttpd/osxhttpd.conf|-release)|penldap/ldap.conf)|u(?:pdatedb.conf(?:.beforevmwaretoolsinstall)?|tmp)|n(?:e(?:wsyslog.conf|twork[/s])|ginx/nginx.conf)|e(?:(?:sound/esd|2fsck|tter).conf|xports)|k(?:ernel-(?:im|pk)g.conf|bd/config)|group-?)|usr(?:/(?:l(?:ocal/(?:p(?:hp(?:4/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini)|5/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini)|/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini))|sa/admin/(?:htdocs/domains/databases/phpmyadmin/libraries/config.default.php|conf/(?:site_isolation_settings|php).ini|logs/(?:httpsd_access_|panel.)log)|gsql/(?:data/p(?:ostgresql.(?:conf|log)|g_(?:hba.conf|log)|asswd)|bin/pg_passwd)|ureftpd/(?:etc/pure(?:-ftpd.conf|ftpd.pdb)|sbin/pure-config.pl))|ap(?:ache(?:2(?:/(?:(?:conf/(?:(?:extra/httpd-)?ssl|vhosts(?:-custom)?|apache2?|modsec|httpd)|apache2?|httpd).conf|logs/(?:a(?:ccess.|udit_))?log)|2(?:/conf)?/httpd.conf)|/(?:conf/(?:(?:a(?:pache2?|ccess)|vhosts(?:-custom)?|modsec).conf|httpd.conf(?:.default)?|php.ini)|logs/(?:a(?:ccess.|udit_))?log|(?:apache2?|httpd).conf)|1.3/conf/httpd.conf)|ps/apache(?:2?2)?/conf/httpd.conf)|jakarta/(?:tomcat/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml|jakarta.conf)|logs/(?:catalina.(?:err|out)|mod_jk.log))|dist/tomcat/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml|jakarta.conf)|logs/mod_jk.log))|etc/(?:(?:(?:apache(?:2(?:/(?:(?:conf/)?httpd|vhosts)|2(?:/conf)?/httpd)|/(?:(?:conf/)?httpd|vhosts))|nginx/nginx|smb).|httpd/(?:conf/httpd.)?)conf|p(?:ure(?:-ftpd.conf|ftpd.pdb)|hp.ini)|webmin/miniserv.(?:users|conf)|lighttpd.conf(?:.new)?)|l(?:i(?:ghttpd/(?:log/(?:lighttpd.error|access).log|conf/lighttpd.conf)|b/php.ini)|sws/(?:conf/httpd_conf.xml|logs/error.log)|ogs/(?:access|samba).log)|mysql/data/mysql(?:-(?:bin.(?:index|log)|slow.log)|.(?:err|log)|derror.log)|s(?:amba/lib/(?:smb.conf|log).user|quirrelmail/www/readme|b/config)|cpanel/logs/(?:l(?:icense|ogin)|(?:acces|stat)s|error)_log|ze(?:us/web/(?:global.cfg|log/errors)|nd/etc/php.ini)|(?:httpd/conf/httpd|nginx/conf/nginx).conf)|ib/(?:security/mkuser.default|(?:php/)?php.ini|cron/log))|s(?:hare/(?:tomcat(?:6/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml)|logs/catalina.(?:err|out))|/logs/catalina.(?:err|out))|squirrelmail/(?:plugins/squirrel_logger/setup|config/config).php|logs/catalina.(?:err|out)|adduser/adduser.conf)|bin/(?:mud(?:passw|log)d|pure-config.pl)|pool/(?:mqueue/sys|lp/)log)|p(?:orts/(?:contrib/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|ftp/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|net/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf))|kg(?:src/net/pureftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|/etc/httpd/httpd(?:-(?:default|vhosts))?.conf))|home/user/(?:var/log/(?:lighttpd.error|apache).log|lighttpd/lighttpd.conf)|internet/pgsql/data/p(?:ostmaster.log|g_hba.conf)|(?:apache2?/conf/ht|etc/pure-f)tpd.conf)|\/local\/(?:[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|mysql\/data\/\{host\}.err))|v(?:ar(?:/(?:l(?:o(?:g(?:/(?:p(?:(?:o(?:stgres(?:ql(?:/(?:postgres(?:ql(?:-(?:8.[134]|9.[01])-main)?)?|main))?|/p(?:g_backup|ostgres)).|p)|(?:ure(?:-ftpd/pure-)?ftpd|m-powersave).|gsql(?:(?:/pgsql|8).|_))log|roftpd(?:.(?:access_|xfer)log|/xferlog.legacy)?)|(?:(?:v(?:mware/hostd(?:-1)?|sftpd)|cron/var/log/postgres|webmin/miniserv|boot).|a(?:pache(?:2/(?:(?:access|error).)|/(?:access.))|ccess.|uth.?)|e(?:xim[/_](?:reject|panic|main)|rror.)|httpd/(?:access.)|x(?:org.0.|fer))log|m(?:ysql(?:/(?:mysql(?:-(?:bin.(?:index|log)|slow.log)|.log)|data/mysql-bin.index)|.(?:err|log)|-bin.index|derror.log)|ail(?:.(?:info|warn|err|log)|log)|uddleftpd(?:.conf)?|essages(?:.1)?)|n(?:ews(?:/(?:news.(?:notice|crit|all|err)|suck.(?:notice|err))|.all)|ginx(?:.(?:access|error)_|/(?:access.))log)|s(?:(?:(?:quirrelmail|so/sso).|w-cp-server/error_)log|amba(?:/log.[ns]mbd|.log[12]?)|yslog(?:.1)?)|l(?:ighttpd(?:/(?:(?:access|error)(?:.www)?.log)?|.(?:access|error).log)|og.smb)|da(?:ta/mysql-bin.index|emon.log(?:.1)?)|ftp(?:-proxy(?:/ftp-proxy.log)?|log)|ipfw(?:.(?:today|log)|/ipfw.log)?|u(?:ser.log(?:.1)?|fw.log)|tomcat6/catalina.out|kern.log(?:.1)?)|s/access.log)|cal/www/conf/php.ini)|i(?:b/(?:(?:pgsql/data/postgresql.co|mysql/my.c)nf|squirrelmail/prefs/squirrelmail.log)|ghttpd.log)|p/logs/(?:lp(?:sched|net)|requests))|a(?:dm/(?:l(?:og(?:/(?:asppp.|xfer)|in)log|astlog/username|p/lpd-errs)|(?:ras/(?:boot|err)|s(?:ys|u)|vold.)log|cr(?:ash/(?:vmcore|unix)|on/log)|ac(?:ct/sum/loginlog|ulogs?)|(?:message|x0msg)s|[pq]acct|utmpx?|wtmpx?|dtmp)|pache/conf/httpd.conf)|www/(?:(?:html/squirrelmail(?:-1.2.9)?|squirrelmail)/config/config.php|(?:conf/httpd.)?conf|logs/(?:access.)log|.lighttpdpassword)|postgresql/(?:db/postgresql.conf|log/postgresql.log)|c(?:panel/(?:tomcat.options|cpanel.config)|ron/log)|m(?:ysql(?:-bin.index|.log)|ail/www-data)|data/mysql-bin.index|nm2/postgresql.conf|saf/(?:port/|_)log)|\/log\/lighttpd\/\{domain\}\/(?:access|error).log)|olumes/(?:macintosh_hd1/(?:usr/local/php(?:/(?:httpd.conf.php|lib/php.ini)|[45]/httpd.conf.php)|opt/(?:apache2?|httpd)/conf/httpd.conf)|webbackup/(?:private/etc/httpd/httpd.conf(?:.default)?|opt/apache2/conf/httpd.conf)))|p(?:r(?:o(?:gram files(?:/(?:apache (?:group/apache(?:/(?:(?:conf/(?:apache2?|httpd)|apache2?).conf|logs/(?:access|error).log)|2/conf/(?:apache2?|httpd).conf)|software foundation/apache2.2/(?:logs/(?:access|error).log|conf/httpd.conf))|mysql/(?:my(?:sql server 5.0/(?:data/mysql(?:-bin.(?:index|log)|.(?:err|log))|my.(?:cnf|ini))|.(?:cnf|ini))|data/mysql(?:-bin.(?:index|log)|.(?:err|log)))|(?:postgresql/(?:8.[34]|9.[01])/data/p(?:g_(?:ident|hba)|ostgresql)|xampp/apache/conf/(?:apache2?|httpd)|vidalia bundle/polipo/polipo).conf)|\/(?:[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|mysql(?:\/mysql server 5.0)?\/data\/\{host\}.err))|c/(?:self/(?:fd/(?:[023456789]|1[012345]?)|stat(?:us)?|cmdline|environ|mounts)|(?:cpu|mem)info|net/(?:tc|ud)p|devices|version))|ivate(?:\/tmp\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|/etc/(?:httpd/(?:httpd.conf(?:.default)?|apache2?.conf)|squirrelmail/config/config.php)))|a(?:ckage(?:-lock)?.json|rameters.yml)|ostgresql/log/pgadmin.log|hp[45]?/php.ini)|w(?:in(?:dows/(?:s(?:ystem32/(?:logfiles/(?:firewall/pfirewall.log(?:.old)?|w3svc[123]?/inetsvn1.log|smtpsvc[12345]?|msftpsvc[12]?)|drivers/etc/(?:(?:network|service|host)s|lmhosts.sam|protocol)|macromed/flash/(?:flash)?install.log)|etup(?:a(?:ct|pi)|err).log)|(?:(?:debug/net|repair/|com)setup|w(?:indowsupdate|msetup)|updspapi).log|(?:odbc|php).ini)|nt/(?:system32/logfiles/(?:firewall/pfirewall.log(?:.old)?|w3svc[123]?/inetsvn1.log|smtpsvc[12345]?|msftpsvc[12]?)|repair/sam._|php.ini))|amp/(?:bin/(?:apache/apache2.2.2(?:2/(?:(?:conf/(?:wampserver|httpd)|wampserver).conf|logs/(?:access|error).log)|1/(?:(?:conf/httpd|wampserver).conf|logs/(?:access|error).log))|mysql/mysql5.5.(?:16/(?:data/mysql-bin.index|wampserver.conf|my.ini)|24/(?:data/mysql-bin.index|wampserver.conf|my.ini))|php/php5.(?:3.8|4.3)/php.ini)|logs/(?:a(?:pache_error|ccess)|(?:slow|gen)query|mysql).log)|ww/(?:logs/(?:freebsddiary-(?:access_|error.)|proftpd.system.)log|(?:apache/)?conf/httpd.conf)|p-config.(?:t(?:e?mp|xt)|bak|old|php)|eb(?:pack.config.js|/conf/php.ini))|\.(?:s(?:sh/(?:id(?:_(?:dsa(?:.pub)?|rsa(?:.pub)?)|entity(?:.pub)?)|(?:authorized_key|known_host)s|config)|ubversion/(?:servers|config|auth)|(?:qlite|h)_history)|c(?:onfig/odesk/odesk team.conf|ache/notify-osd.log|shrc)|l(?:(?:ocal/share/mc|ftp)/|(?:ldb-)?history|esshst)|h(?:t(?:access|digest|passwd)|plip/hplip.conf)|p(?:(?:ython|sql|hp)_history|rofile|earrc|ki/)|bash(?:_(?:history|profile|config|logout)|rc)|(?:(?:(?:rediscli|ksh)_|R)histor|xauthorit)y|vi(?:dalia/vidalia.conf|m(?:info|rc))|n(?:(?:ode_repl|ano)_history|sr)|z(?:sh(?:_history|rc)|history)|tc(?:onn/tconn.conf|shrc)|my(?:sql_history|.cnf)|g(?:itconfig|nupg/)|aptitude/config|drush/)|o(?:pt(?:/(?:(?:apache(?:2(?:/(?:conf/(?:apache2?|httpd)|apache2?)|2/conf/httpd)|/(?:conf/(?:apache2?|httpd)|apache2?))|httpd/(?:conf/)?apache2?).conf|l(?:sws/(?:logs/(?:access|error).log|conf/httpd_conf.xml)|ampp/(?:logs/(?:access.)log|etc/httpd.conf))|xampp/(?:logs/(?:access.)log|etc/php.ini)|tomcat/logs/catalina.(?:err|out))|\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log))|rmconfig.json)|xampp(?:/(?:apache/(?:logs/(?:access|error).log|conf/httpd.conf|bin/php.ini)|m(?:ysql/data/mysql(?:-bin.index|.err)|ercurymail/mercury.ini)|htdocs/(?:a(?:dmin.php|ca.txt)|leer.txt)|php(?:myadmin/config.inc.php|/php.ini)|filezillaftp/filezilla server.xml|sendmail/sendmail.(?:ini|log)|webalizer/webalizer.conf)|\/mysql\/data\/\{host\}.err)|s(?:ystem(?:32/(?:inetsrv/config/(?:a(?:pplicationhost|dministration)|redirection).config|config/(?:s(?:(?:yste|a)m|oftware)|default))|/library/webobjects/adaptors/apache2.2/apache.conf)|(?:ites/default/(?:settings(?:.local)?|default.settings)|rv/www/htdos/squirrelmail/config/config).php|e(?:curity|rvices).yml|ftp-config.json)|t(?:mp(?:\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|/access.log)|ypo3conf/localconf.php|sconfig.json)|[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|h(?:ome(?:/(?:postgres/data/p(?:g_(?:(?:ident|hba).conf|version)|ostgresql.conf)|user/lighttpd/lighttpd.conf|bin/stable/apache/php.ini)|2/bin/stable/apache/php.ini)|ttp/httpd.conf)|ap(?:ache(?:/(?:logs/(?:access|error).log|conf/httpd.conf|php/php.ini)|2/logs/(?:access|error).log)|p/etc/local.xml)|l(?:ibrary/webserver/documents/(?:default.(?:html?|php)|index.(?:html?|php))|ogs/(?:security(?:_debug)?_)?log)|mysql(?:/(?:data/mysql(?:-bin.(?:index|log)|.(?:err|log))|my.(?:cnf|ini)|bin/my.ini)|\/data\/\{host\}.err)|ro(?:ot/.(?:bash(?:_(?:history|config|logout)|rc)|(?:ksh_histor|xauthorit)y)|uting.yml)|config(?:/(?:database|custom|app).php|_(?:prod|test|dev).yml|.(?:inc.php|yml))|in(?:c(?:ludes/config(?:ure)?|/config).php|etpub/wwwroot/global.asa)|n(?:etserver/bin/stable/apache/php.ini|pm-debug.log)|b(?:oot/grub/(?:grub.cfg|menu.lst)|in/php.ini)|/(?:config(?:uration)?.php|boot.ini|etc/)|LocalSettings.php|gruntfile.js|Web.config|yarn.lock)#" );
4
- $score['LFI'][1] = array( 5 , 5, 5, 5 );
5
  ?>
1
+ <?php
2
+
3
+ $regex['LFI'][1] = array( "#(?i)(?:\x5c|(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\/))(?:%(?:(?:f(?:(?:c%80|8)%8)?0%8|e)0%80%ae|2(?:(?:5(?:c0%25a|2))?e|%45)|u(?:(?:002|ff0)e|2024)|%32(?:%(?:%6|4)5|E)|c0(?:%[256aef]e|\.))|\.(?:%0[01]|\?)?|\?\.?|0x2e){2}(?:\x5c|(?:%(?:c(?:0%(?:[2aq]f|5c|9v)|1%(?:[19p]c|8s|af))|2(?:5(?:c(?:0%25af|1%259c)|2f|5c)|%46|f)|(?:(?:f(?:8%8)?0%8|e)0%80%a|bg%q)f|%3(?:2(?:%(?:%6|4)6|F)|5%%63)|u(?:221[56]|002f|EFC8|F025)|1u|5c)|0x(?:2f|5c)|\/))#" , "# (?:^|[\\/])\.\.(?:[\\/]|$)#","#(?:etc/(?:s(?:e(?:curity/(?:(?:(?:namespac|tim)e|sepermit|access).conf|l(?:imits(?:.conf)?|astlog)|(?:failedlogi|enviro)n|pa(?:m_env.conf|sswd)|group(?:.conf)?|opasswd|user)|nsors3?.conf)|ys(?:c(?:tl(?:.d/(?:10-(?:(?:network|process)-security|console-messages)|wine.sysctl))?.conf|onfig/network-scripts/ifcfg-eth0)|log.conf)|quirrelmail/(?:(?:config(?:_(?:default|local)|/config)?|sqspell_config|filters_setup|index).php|(?:default_pre|apache.con)f)|amba/(?:s(?:mb(?:.conf(?:.user)?|passwd|users)|amba.conf)|private/smbpasswd|dhcp.conf|netlogon)|(?:w-cp-server/applications.d/(?:00-sso-cpserver|plesk)|tunnel/stunnel).conf|u(?:bversion/config|se-release|doers)|s(?:o/sso_config.ini|h/sshd_config)|m(?:b(?:passwd|.conf)|i.conf)|lackware-release|hadow[-~]?)|a(?:p(?:ache(?:2(?:/(?:(?:mods-(?:available/(?:m(?:em_cach|im)e|s(?:etenvif|sl)|d(?:eflate|ir)|autoindex|proxy)|enabled/(?:(?:statu|alia)s|d(?:eflate|ir)|negotiation|mime|php5))|(?:apache|httpd)2?|default-server|ports).conf|s(?:ites-(?:available/default(?:-ssl)?|enabled/(?:000-)?default)|sl-global.conf)|conf(?:.d/(?:phpmyadmin.conf|security|charset)|/httpd.conf)|vhosts.d/(?:00_default_vhost.conf|default_vhost.include)|envvars)|2(?:/conf)?/httpd.conf)|/(?:a(?:ccess|pache)|(?:conf/)?httpd|default-server).conf)|t/apt.conf)|(?:vahi/avahi-daemon|dduser).conf|lias)|p(?:hp(?:(?:(?:(?:4(?:/(?:apache2?|cgi)|.4/fcgi)|5/(?:apache2?|cgi))/|/(?:(?:apache2?|cgi)/|(?:php4/)?))php)?.ini|myadmin/config.inc.php)|u(?:re(?:-ftpd(?:/pure(?:-ftpd.(?:conf|pdb)|ftpd.pdb)|.conf)|ftpd.p(?:asswd|db))|lse/client.conf)|ro(?:f(?:tp(?:d/modules)?.conf|ile)|tpd/proftpd.conf)|a(?:ssw(?:ord.master|d[-~]?)|m.(?:d/proftpd|conf))|ostgresql/p(?:ostgresql|g_hba).conf)|m(?:o(?:no/(?:(?:2.0/(?:machine|web)|1.0/machine).)?config|d(?:probe.d/vmware-tools.conf|ules)|td)|(?:y(?:sql/(?:conf.d/old_passwords|my))?.c|iredo(?:/miredo)?(?:-server)?.co)nf|uddleftpd(?:/(?:mud(?:dleftpd.(?:passwd|conf)|log(?:d.conf)?)|passwd)|.com)|a(?:n(?:drake-release|path.config)|il/sendmail.conf)|t(?:ools.conf|ab))|h(?:ttp(?:d(?:/(?:conf(?:.d(?:/(?:squirrelmail|php).conf)?|/(?:apache2?|httpd).conf)?|(?:extra/httpd-ssl|apache2?|mod_php|httpd).conf|logs/(?:access.)log|php.ini)|.conf)|(?:/conf)?/httpd.conf)|ost(?:s(?:.(?:allow|deny))?|.conf|name)|dparm.conf)|c(?:ups/(?:(?:p(?:rinter|dftop)s|acroread).conf|cupsd.conf(?:.default)?)|(?:lamav/(?:freshclam|clamd)|vs-(?:pserver|cron)).conf|a(?:-certificates.conf(?:.dpkg-old)?|sper.conf)|h(?:krootkit.conf|rootusers)|r(?:ypt|on)tab)|w(?:icd/(?:(?:wire(?:less|d)|manager)-settings.conf|dhclient.conf.template.default)|u-ftpd/ftp(?:acces|host|user)s|ebmin/miniserv.(?:users|conf))|v(?:mware-tools/(?:(?:vmware-tools-libraries|tpvmlp).conf|config)|sftpd(?:.c(?:hroot_list|onf)|/vsftpd.conf)|hcs2/proftpd/proftpd.conf)|l(?:og(?:rotate.(?:d/(?:vsftpd.log|proftpd|ftp)|conf)|in.defs)|(?:ighttpd/lighthttpd|d(?:ap/ldap|.so)|trace).conf)|r(?:e(?:solv(?:conf/update-libc.d/sendmail|.conf)|d(?:is(?:-sentinel)?.conf|hat-release))|c.(?:d/rc.httpd|conf))|d(?:e(?:b(?:ian_version|conf.conf)|fault/grub|luser.conf)|(?:hcp(?:3/dhc(?:lient|pd)|/dhclient)|ns2tcpd).conf)|f(?:tp(?:(?:host|user)s|chroot)|(?:oremost|use).conf|edora-release|irewall.rules|stab)|b(?:luetooth/(?:network|rfcomm|input|main).conf|ash(?:_completion.d/debconf|.bashrc))|x11/xorg.conf(?:.(?:beforevmwaretoolsinstall|orig)|-v(?:mware|esa))?|i(?:n(?:it(?:tab|.d|/)|etd.conf)|pfw.(?:rules|conf)|ssue(?:.net)?)|t(?:i(?:nyproxy/tinyproxy.conf|mezone)|(?:or/tor-t)?socks.conf)|o(?:s(?:xhttpd/osxhttpd.conf|-release)|penldap/ldap.conf)|u(?:pdatedb.conf(?:.beforevmwaretoolsinstall)?|tmp)|n(?:e(?:wsyslog.conf|twork[/s])|ginx/nginx.conf)|e(?:(?:sound/esd|2fsck|tter).conf|xports)|k(?:ernel-(?:im|pk)g.conf|bd/config)|group-?)|usr(?:/(?:l(?:ocal/(?:p(?:hp(?:4/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini)|5/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini)|/(?:apache(?:2.conf(?:.php)?|.conf(?:.php)?)|httpd.conf(?:.php)?|lib/php.ini))|sa/admin/(?:htdocs/domains/databases/phpmyadmin/libraries/config.default.php|conf/(?:site_isolation_settings|php).ini|logs/(?:httpsd_access_|panel.)log)|gsql/(?:data/p(?:ostgresql.(?:conf|log)|g_(?:hba.conf|log)|asswd)|bin/pg_passwd)|ureftpd/(?:etc/pure(?:-ftpd.conf|ftpd.pdb)|sbin/pure-config.pl))|ap(?:ache(?:2(?:/(?:(?:conf/(?:(?:extra/httpd-)?ssl|vhosts(?:-custom)?|apache2?|modsec|httpd)|apache2?|httpd).conf|logs/(?:a(?:ccess.|udit_))?log)|2(?:/conf)?/httpd.conf)|/(?:conf/(?:(?:a(?:pache2?|ccess)|vhosts(?:-custom)?|modsec).conf|httpd.conf(?:.default)?|php.ini)|logs/(?:a(?:ccess.|udit_))?log|(?:apache2?|httpd).conf)|1.3/conf/httpd.conf)|ps/apache(?:2?2)?/conf/httpd.conf)|jakarta/(?:tomcat/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml|jakarta.conf)|logs/(?:catalina.(?:err|out)|mod_jk.log))|dist/tomcat/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml|jakarta.conf)|logs/mod_jk.log))|etc/(?:(?:(?:apache(?:2(?:/(?:(?:conf/)?httpd|vhosts)|2(?:/conf)?/httpd)|/(?:(?:conf/)?httpd|vhosts))|nginx/nginx|smb).|httpd/(?:conf/httpd.)?)conf|p(?:ure(?:-ftpd.conf|ftpd.pdb)|hp.ini)|webmin/miniserv.(?:users|conf)|lighttpd.conf(?:.new)?)|l(?:i(?:ghttpd/(?:log/(?:lighttpd.error|access).log|conf/lighttpd.conf)|b/php.ini)|sws/(?:conf/httpd_conf.xml|logs/error.log)|ogs/(?:access|samba).log)|mysql/data/mysql(?:-(?:bin.(?:index|log)|slow.log)|.(?:err|log)|derror.log)|s(?:amba/lib/(?:smb.conf|log).user|quirrelmail/www/readme|b/config)|cpanel/logs/(?:l(?:icense|ogin)|(?:acces|stat)s|error)_log|ze(?:us/web/(?:global.cfg|log/errors)|nd/etc/php.ini)|(?:httpd/conf/httpd|nginx/conf/nginx).conf)|ib/(?:security/mkuser.default|(?:php/)?php.ini|cron/log))|s(?:hare/(?:tomcat(?:6/(?:conf/(?:(?:logging|workers).properties|(?:context|server).xml)|logs/catalina.(?:err|out))|/logs/catalina.(?:err|out))|squirrelmail/(?:plugins/squirrel_logger/setup|config/config).php|logs/catalina.(?:err|out)|adduser/adduser.conf)|bin/(?:mud(?:passw|log)d|pure-config.pl)|pool/(?:mqueue/sys|lp/)log)|p(?:orts/(?:contrib/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|ftp/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|net/pure-ftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf))|kg(?:src/net/pureftpd/pure(?:ftpd.p(?:asswd|db)|-ftpd.conf)|/etc/httpd/httpd(?:-(?:default|vhosts))?.conf))|home/user/(?:var/log/(?:lighttpd.error|apache).log|lighttpd/lighttpd.conf)|internet/pgsql/data/p(?:ostmaster.log|g_hba.conf)|(?:apache2?/conf/ht|etc/pure-f)tpd.conf)|\/local\/(?:[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|mysql\/data\/\{host\}.err))|v(?:ar(?:/(?:l(?:o(?:g(?:/(?:p(?:(?:o(?:stgres(?:ql(?:/(?:postgres(?:ql(?:-(?:8.[134]|9.[01])-main)?)?|main))?|/p(?:g_backup|ostgres)).|p)|(?:ure(?:-ftpd/pure-)?ftpd|m-powersave).|gsql(?:(?:/pgsql|8).|_))log|roftpd(?:.(?:access_|xfer)log|/xferlog.legacy)?)|(?:(?:v(?:mware/hostd(?:-1)?|sftpd)|cron/var/log/postgres|webmin/miniserv|boot).|a(?:pache(?:2/(?:(?:access|error).)|/(?:access.))|ccess.|uth.?)|e(?:xim[/_](?:reject|panic|main)|rror.)|httpd/(?:access.)|x(?:org.0.|fer))log|m(?:ysql(?:/(?:mysql(?:-(?:bin.(?:index|log)|slow.log)|.log)|data/mysql-bin.index)|.(?:err|log)|-bin.index|derror.log)|ail(?:.(?:info|warn|err|log)|log)|uddleftpd(?:.conf)?|essages(?:.1)?)|n(?:ews(?:/(?:news.(?:notice|crit|all|err)|suck.(?:notice|err))|.all)|ginx(?:.(?:access|error)_|/(?:access.))log)|s(?:(?:(?:quirrelmail|so/sso).|w-cp-server/error_)log|amba(?:/log.[ns]mbd|.log[12]?)|yslog(?:.1)?)|l(?:ighttpd(?:/(?:(?:access|error)(?:.www)?.log)?|.(?:access|error).log)|og.smb)|da(?:ta/mysql-bin.index|emon.log(?:.1)?)|ftp(?:-proxy(?:/ftp-proxy.log)?|log)|ipfw(?:.(?:today|log)|/ipfw.log)?|u(?:ser.log(?:.1)?|fw.log)|tomcat6/catalina.out|kern.log(?:.1)?)|s/access.log)|cal/www/conf/php.ini)|i(?:b/(?:(?:pgsql/data/postgresql.co|mysql/my.c)nf|squirrelmail/prefs/squirrelmail.log)|ghttpd.log)|p/logs/(?:lp(?:sched|net)|requests))|a(?:dm/(?:l(?:og(?:/(?:asppp.|xfer)|in)log|astlog/username|p/lpd-errs)|(?:ras/(?:boot|err)|s(?:ys|u)|vold.)log|cr(?:ash/(?:vmcore|unix)|on/log)|ac(?:ct/sum/loginlog|ulogs?)|(?:message|x0msg)s|[pq]acct|utmpx?|wtmpx?|dtmp)|pache/conf/httpd.conf)|www/(?:(?:html/squirrelmail(?:-1.2.9)?|squirrelmail)/config/config.php|(?:conf/httpd.)?conf|logs/(?:access.)log|.lighttpdpassword)|postgresql/(?:db/postgresql.conf|log/postgresql.log)|c(?:panel/(?:tomcat.options|cpanel.config)|ron/log)|m(?:ysql(?:-bin.index|.log)|ail/www-data)|data/mysql-bin.index|nm2/postgresql.conf|saf/(?:port/|_)log)|\/log\/lighttpd\/\{domain\}\/(?:access|error).log)|olumes/(?:macintosh_hd1/(?:usr/local/php(?:/(?:httpd.conf.php|lib/php.ini)|[45]/httpd.conf.php)|opt/(?:apache2?|httpd)/conf/httpd.conf)|webbackup/(?:private/etc/httpd/httpd.conf(?:.default)?|opt/apache2/conf/httpd.conf)))|p(?:r(?:o(?:gram files(?:/(?:apache (?:group/apache(?:/(?:(?:conf/(?:apache2?|httpd)|apache2?).conf|logs/(?:access|error).log)|2/conf/(?:apache2?|httpd).conf)|software foundation/apache2.2/(?:logs/(?:access|error).log|conf/httpd.conf))|mysql/(?:my(?:sql server 5.0/(?:data/mysql(?:-bin.(?:index|log)|.(?:err|log))|my.(?:cnf|ini))|.(?:cnf|ini))|data/mysql(?:-bin.(?:index|log)|.(?:err|log)))|(?:postgresql/(?:8.[34]|9.[01])/data/p(?:g_(?:ident|hba)|ostgresql)|xampp/apache/conf/(?:apache2?|httpd)|vidalia bundle/polipo/polipo).conf)|\/(?:[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|mysql(?:\/mysql server 5.0)?\/data\/\{host\}.err))|c/(?:self/(?:fd/(?:[023456789]|1[012345]?)|stat(?:us)?|cmdline|environ|mounts)|(?:cpu|mem)info|net/(?:tc|ud)p|devices|version))|ivate(?:\/tmp\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|/etc/(?:httpd/(?:httpd.conf(?:.default)?|apache2?.conf)|squirrelmail/config/config.php)))|a(?:ckage(?:-lock)?.json|rameters.yml)|ostgresql/log/pgadmin.log|hp[45]?/php.ini)|w(?:in(?:dows/(?:s(?:ystem32/(?:logfiles/(?:firewall/pfirewall.log(?:.old)?|w3svc[123]?/inetsvn1.log|smtpsvc[12345]?|msftpsvc[12]?)|drivers/etc/(?:(?:network|service|host)s|lmhosts.sam|protocol)|macromed/flash/(?:flash)?install.log)|etup(?:a(?:ct|pi)|err).log)|(?:(?:debug/net|repair/|com)setup|w(?:indowsupdate|msetup)|updspapi).log|(?:odbc|php).ini)|nt/(?:system32/logfiles/(?:firewall/pfirewall.log(?:.old)?|w3svc[123]?/inetsvn1.log|smtpsvc[12345]?|msftpsvc[12]?)|repair/sam._|php.ini))|amp/(?:bin/(?:apache/apache2.2.2(?:2/(?:(?:conf/(?:wampserver|httpd)|wampserver).conf|logs/(?:access|error).log)|1/(?:(?:conf/httpd|wampserver).conf|logs/(?:access|error).log))|mysql/mysql5.5.(?:16/(?:data/mysql-bin.index|wampserver.conf|my.ini)|24/(?:data/mysql-bin.index|wampserver.conf|my.ini))|php/php5.(?:3.8|4.3)/php.ini)|logs/(?:a(?:pache_error|ccess)|(?:slow|gen)query|mysql).log)|ww/(?:logs/(?:freebsddiary-(?:access_|error.)|proftpd.system.)log|(?:apache/)?conf/httpd.conf)|p-config.(?:t(?:e?mp|xt)|bak|old|php)|eb(?:pack.config.js|/conf/php.ini))|\.(?:s(?:sh/(?:id(?:_(?:dsa(?:.pub)?|rsa(?:.pub)?)|entity(?:.pub)?)|(?:authorized_key|known_host)s|config)|ubversion/(?:servers|config|auth)|(?:qlite|h)_history)|c(?:onfig/odesk/odesk team.conf|ache/notify-osd.log|shrc)|l(?:(?:ocal/share/mc|ftp)/|(?:ldb-)?history|esshst)|h(?:t(?:access|digest|passwd)|plip/hplip.conf)|p(?:(?:ython|sql|hp)_history|rofile|earrc|ki/)|bash(?:_(?:history|profile|config|logout)|rc)|(?:(?:(?:rediscli|ksh)_|R)histor|xauthorit)y|vi(?:dalia/vidalia.conf|m(?:info|rc))|n(?:(?:ode_repl|ano)_history|sr)|z(?:sh(?:_history|rc)|history)|tc(?:onn/tconn.conf|shrc)|my(?:sql_history|.cnf)|g(?:itconfig|nupg/)|aptitude/config|drush/)|o(?:pt(?:/(?:(?:apache(?:2(?:/(?:conf/(?:apache2?|httpd)|apache2?)|2/conf/httpd)|/(?:conf/(?:apache2?|httpd)|apache2?))|httpd/(?:conf/)?apache2?).conf|l(?:sws/(?:logs/(?:access|error).log|conf/httpd_conf.xml)|ampp/(?:logs/(?:access.)log|etc/httpd.conf))|xampp/(?:logs/(?:access.)log|etc/php.ini)|tomcat/logs/catalina.(?:err|out))|\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log))|rmconfig.json)|xampp(?:/(?:apache/(?:logs/(?:access|error).log|conf/httpd.conf|bin/php.ini)|m(?:ysql/data/mysql(?:-bin.index|.err)|ercurymail/mercury.ini)|htdocs/(?:a(?:dmin.php|ca.txt)|leer.txt)|php(?:myadmin/config.inc.php|/php.ini)|filezillaftp/filezilla server.xml|sendmail/sendmail.(?:ini|log)|webalizer/webalizer.conf)|\/mysql\/data\/\{host\}.err)|s(?:ystem(?:32/(?:inetsrv/config/(?:a(?:pplicationhost|dministration)|redirection).config|config/(?:s(?:(?:yste|a)m|oftware)|default))|/library/webobjects/adaptors/apache2.2/apache.conf)|(?:ites/default/(?:settings(?:.local)?|default.settings)|rv/www/htdos/squirrelmail/config/config).php|e(?:curity|rvices).yml|ftp-config.json)|t(?:mp(?:\/[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|/access.log)|ypo3conf/localconf.php|sconfig.json)|[jboss]\/server\/default\/(?:conf\/(?:s(?:tandardj(?:bos|aw)s.xml|erver.log.properties)|j(?:boss-(?:minimal|service).xml|ndi.properties)|log(?:in-config|4j).xml)|deploy\/jboss-logging.xml|log\/(?:server|boot).log)|h(?:ome(?:/(?:postgres/data/p(?:g_(?:(?:ident|hba).conf|version)|ostgresql.conf)|user/lighttpd/lighttpd.conf|bin/stable/apache/php.ini)|2/bin/stable/apache/php.ini)|ttp/httpd.conf)|ap(?:ache(?:/(?:logs/(?:access|error).log|conf/httpd.conf|php/php.ini)|2/logs/(?:access|error).log)|p/etc/local.xml)|l(?:ibrary/webserver/documents/(?:default.(?:html?|php)|index.(?:html?|php))|ogs/(?:security(?:_debug)?_)?log)|mysql(?:/(?:data/mysql(?:-bin.(?:index|log)|.(?:err|log))|my.(?:cnf|ini)|bin/my.ini)|\/data\/\{host\}.err)|ro(?:ot/.(?:bash(?:_(?:history|config|logout)|rc)|(?:ksh_histor|xauthorit)y)|uting.yml)|config(?:/(?:database|custom|app).php|_(?:prod|test|dev).yml|.(?:inc.php|yml))|in(?:c(?:ludes/config(?:ure)?|/config).php|etpub/wwwroot/global.asa)|n(?:etserver/bin/stable/apache/php.ini|pm-debug.log)|b(?:oot/grub/(?:grub.cfg|menu.lst)|in/php.ini)|/(?:config(?:uration)?.php|boot.ini|etc/)|LocalSettings.php|gruntfile.js|Web.config|yarn.lock)#" );
4
+ $score['LFI'][1] = array( 5 , 5, 5, 5 );
5
  ?>
handler/signature/APSQLI.php CHANGED
@@ -1,11 +1,11 @@
1
- <?php
2
- $regex['SQL'][1] = array( "#(?i:\b(?:(?:m(?:s(?:ys(?:ac(?:cess(?:objects|storage|xml)|es)|(?:relationship|object|querie)s|modules2?)|db)|aster\.\.sysdatabases|ysql\.db)|pg_(?:catalog|toast)|information_schema|northwind|tempdb)\b|s(?:(?:ys(?:\.database_name|aux)|qlite(?:_temp)?_master)\b|chema(?:_name\b|\W*\())|d(?:atabas|b_nam)e\W*\())#" , "#(?i:sleep\(\s*?\d*?\s*?\)|benchmark\(.*?\,.*?\))#" , "#(?i:(?:select|;)\s+(?:benchmark|sleep|if)\s*?\(\s*?\(?\s*?\w+)#" , "#(?i:(?:[\'`](?:;?\s*?(?:having|select|union)\b\s*?[^\s]|\s*?!\s*?[\'`\w])|(?:c(?:onnection_id|urrent_user)|database)\s*?\([^\)]*?|u(?:nion(?:[\w(\s]*?select|select@)|ser\s*?\([^\)]*?)|s(?:chema\s*?\([^\)]*?|elect.*?\w?user\()|into[\s+]+(?:dump|out)file\s*?[\'`]|\s*?exec(?:ute)?.*?\Wxp_cmdshell|from\W+information_schema\W|exec(?:ute)?\s+master\.|\wiif\s*?\())#" , "#^(?i:-0000023456|4294967295|4294967296|2147483648|2147483647|0000012345|-2147483648|-2147483649|0000023456|3.0.00738585072007e-308|1e309)$#" , "#(?i:[\s()]case\s*?\(|\)\s*?like\s*?\(|having\s*?[^\s]+\s*?[^\w\s]|if\s?\([\d\w]\s*?[=<>~])#" , "#(?i:(?:[\'`](?:;*?\s*?waitfor\s+(?:delay|time)\s+[\'`]|;.*?:\s*?goto)|alter\s*?\w+.*?cha(?:racte)?r\s+set\s+\w+))#" , "#(?i:merge.*?using\s*?\(|execute\s*?immediate\s*?[\'`]|match\s*?[\w(),+-]+\s*?against\s*?\()#" , "#(?i)union.*?select.*?from#" , "@(?i:(?:;\s*?shutdown\s*?(?:[#;]|\/\*|--|\{)|waitfor\s*?delay\s?[\'`]+\s?\d|select\s*?pg_sleep))@" , "#(?i:(?:\[\$(?:ne|eq|lte?|gte?|n?in|mod|all|size|exists|type|slice|x?or|div|like|between|and)\]))#" , "%(?i:(?:create\s+(?:procedure|function)\s*?\w+\s*?\(\s*?\)\s*?-|;\s*?(?:declare|open)\s+[\w-]+|procedure\s+analyse\s*?\(|declare[^\w]+[@#]\s*?\w+|exec\s*?\(\s*?\@))%" , "#(?i:(?:;\s*?(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s*?[\[(]?\w{2,}|create\s+function\s+.+\s+returns))#" , "#(?i:(?:^[\W\d]+\s*?(?:alter\s*(?:a(?:(?:pplication\s*rol|ggregat)e|s(?:ymmetric\s*ke|sembl)y|u(?:thorization|dit)|vailability\s*group)|c(?:r(?:yptographic\s*provider|edential)|o(?:l(?:latio|um)|nversio)n|ertificate|luster)|s(?:e(?:rv(?:ice|er)|curity|quence|ssion|arch)|y(?:mmetric\s*key|nonym)|togroup|chema)|m(?:a(?:s(?:ter\s*key|k)|terialized)|e(?:ssage\s*type|thod)|odule)|l(?:o(?:g(?:file\s*group|in)|ckdown)|a(?:ngua|r)ge|ibrary)|t(?:(?:abl(?:espac)?|yp)e|r(?:igger|usted)|hreshold|ext)|p(?:a(?:rtition|ckage)|ro(?:cedur|fil)e|ermission)|d(?:i(?:mension|skgroup)|atabase|efault|omain)|r(?:o(?:l(?:lback|e)|ute)|e(?:sourc|mot)e)|f(?:u(?:lltext|nction)|lashback|oreign)|e(?:xte(?:nsion|rnal)|(?:ndpoi|ve)nt)|in(?:dex(?:type)?|memory|stance)|b(?:roker\s*priority|ufferpool)|x(?:ml\s*schema|srobject)|w(?:ork(?:load)?|rapper)|hi(?:erarchy|stogram)|o(?:perator|utline)|(?:nicknam|queu)e|us(?:age|er)|group|java|view)|u(?:nion\s*(?:(?:distin|sele)ct|all)|pdate)|(?:(?:trunc|cre)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|load)\b|(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s+(?:group_concat|load_file|char)\s?\(?|[\d\W]\s+as\s*?[\'`\w]+\s*?from|[\s(]load_file\s*?\(|[\'`]\s+regexp\W|end\s*?\);))#" , "#(?i:/\*[!+](?:[\w\s=_\-()]+)?\*/)#" );
3
- $score['SQL'][1] = array( 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 );
4
- $regex['SQL'][2] = array( "#(?:^\s*[\'`;]+|[\'`]+\s*$)#" , "#(?i:(?:(?:^|\W)in[+\s]*\([\s\d\]+[^()]*\)|\b(?:r(?:egexp|like)|isnull|xor)\b|<(?:>(?:\s+binary)?|=>?|<)|r(?:egexp|like)\s+binary|not\s+between\s+0\s+and|(?:like|is)\s+null|>[=>]|\|\||!=|&&))#" , "#(?i:[\s'\`()]*?([\d\w]++)[\s'\`()]*?(?:<(?:=(?:[\s'\`()]*?(?!\1)[\d\w]+|>[\s'\`()]*?(?:\1))|>?[\s'\`()]*?(?!\1)[\d\w]+)|(?:not\s+(?:regexp|like)|is\s+not|>=?|!=|\^)[\s'\`()]*?(?!\1)[\d\w]+|(?:(?:sounds\s+)?like|r(?:egexp|like)|=)[\s'\`()]*?(?:\1)))#" , "#(?i)\b(?:c(?:o(?:n(?:v(?:ert(?:_tz)?)?|cat(?:_ws)?|nection_id)|(?:mpres)?s|ercibility|(?:un)?t|llation|alesce)|ur(?:rent_(?:time(?:stamp)?|date|user)|(?:dat|tim)e)|h(?:ar(?:(?:acter)?_length|set)?|r)|iel(?:ing)?|ast|r32)|s(?:u(?:b(?:str(?:ing(?:_index)?)?|(?:dat|tim)e)|m)|t(?:d(?:dev_(?:sam|po)p)?|r(?:_to_date|cmp))|e(?:c(?:_to_time|ond)|ssion_user)|ys(?:tem_user|date)|ha[12]?|oundex|chema|ig?n|leep|pace|qrt)|i(?:s(?:_(?:ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull)|(?:free|used)_lock)|null)|n(?:et(?:6_(?:aton|ntoa)|_(?:aton|ntoa))|s(?:ert|tr)|terval)?|f(?:null)?)|d(?:a(?:t(?:e(?:_(?:format|add|sub)|diff)?|abase)|y(?:of(?:month|week|year)|name)?)|e(?:(?:s_(?:de|en)cryp|faul)t|grees|code)|count|ump)|l(?:o(?:ca(?:l(?:timestamp)?|te)|g(?:10|2)?|ad_file|wer)|ast(?:_(?:inser_id|day))?|e(?:(?:as|f)t|ngth)|case|trim|pad|n)|u(?:n(?:compress(?:ed_length)?|ix_timestamp|hex)|tc_(?:time(?:stamp)?|date)|p(?:datexml|per)|uid(?:_short)?|case|ser)|t(?:ime(?:_(?:format|to_sec)|stamp(?:diff|add)?|diff)?|o(?:(?:second|day)s|_base64|n?char)|r(?:uncate|im)|an)|m(?:a(?:ke(?:_set|date)|ster_pos_wait|x)|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:nth(?:name)?|d)|d5)|r(?:e(?:p(?:lace|eat)|lease_lock|verse)|a(?:wtohex|dians|nd)|o(?:w_count|und)|ight|trim|pad)|f(?:i(?:eld(?:_in_set)?|nd_in_set)|rom_(?:unixtime|base64|days)|o(?:und_rows|rmat)|loor)|p(?:o(?:w(?:er)?|sition)|eriod_(?:diff|add)|rocedure_analyse|assword|g_sleep|i)|a(?:s(?:cii(?:str)?|in)|es_(?:de|en)crypt|dd(?:dat|tim)e|(?:co|b)s|tan2?|vg)|b(?:i(?:t_(?:length|count|x?or|and)|n(?:_to_num)?)|enchmark)|e(?:x(?:tract(?:value)?|p(?:ort_set)?)|nc(?:rypt|ode)|lt)|g(?:r(?:oup_conca|eates)t|et_(?:format|lock))|v(?:a(?:r(?:_(?:sam|po)p|iance)|lues)|ersion)|o(?:(?:ld_passwo)?rd|ct(?:et_length)?)|we(?:ek(?:ofyear|day)?|ight_string)|n(?:o(?:t_in|w)|ame_const|ullif)|h(?:ex(?:toraw)?|our)|qu(?:arter|ote)|year(?:week)?|xmltype)\W*\(#" , "@(?i:[\'`](?:\s*?(?:(?:between|x?or|and|div)[\w\s-]+\s*?[+<>=(),-]\s*?[\d\'`]|like(?:[\w\s-]+\s*?[+<>=(),-]\s*?[\d\'`]|\W+[\w\'`(])|[!=|](?:[\d\s!=+-]+.*?[\'`(].*?|[\d\s!=]+.*?\d+)$|[^\w\s]?=\s*?[\'`])|(?:\W*?[+=]+\W*?|[<>~]+)[\'`])|(?:/\*)+[\'`]+\s?(?:\/\*|--|\{|#)?|\d[\'`]\s+[\'`]\s+\d|where\s[\s\w\.,-]+\s=|^admin\s*?[\'`]|\sis\s*?0\W)@" , "#(?i:(?:(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s*?\(\s*?space\s*?\(|,.*?[)\da-f\'`][\'`](?:[\'`].*?[\'`]|(?:\r?\n)?\z|[^\'`]+)|\Wselect.+\W*?from))#" , "%(?i:(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\'`=()]|\/\w+;?\s+(?:between|having|select|like|x?or|and|div)\W|\d+\s*?(?:between|like|x?or|and|div)\s*?\d+\s*?[\-+]|--\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|#\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|;\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|\@.+=\s*?\(\s*?select|\d\s+group\s+by.+\(|[^\w]SET\s*?\@\w+))%" , "#(?i:[\'`]\s*?(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||and|div|&&)\s+[\s\w]+=\s*?\w+\s*?having\s+|like(?:\s+[\s\w]+=\s*?\w+\s*?having\s+|\W*?[\'`\d])|[^?\w\s=.,;)(]++\s*?[(@\'`]*?\s*?\w+\W+\w|\*\s*?\w+\W+[\'`])|(?:union\s*?(?:distinct|[(!@]*?|all)?\s*?[([]*?\s*?select|select\s+?[\[\]()\s\w\.,\'`-]+from)\s+|\w+\s+like\s+[\'`]|find_in_set\s*?\(|like\s*?[\'`]%)#" , "@(?i:(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)\s+\s*?\w+\(|\)\s*?when\s*?\d+\s*?then|[\'`]\s*?(?:--|\{|#)|cha?r\s*?\(\s*?\d|\/\*!\s?\d+))@" , "#(?i:(?:[\'`](?:;\s*?(?:begin|while|if)|[\s\d]+=\s*?\d|\s+and\s*?=\W)|(?:\(\s*?select\s*?\w+|order\s+by\s+if\w*?|coalesce)\s*?\(|\w[\'`]\s*?(?:(?:[-+=|@]+\s+?)+|[-+=|@]+)[\d(]|[\s(]+case\d*?\W.+[tw]hen[\s(]|\+\s*?\d+\s*?\+\s*?\@|\@\@\w+\s*?[^\w\s]|\W!+[\'`]\w|\*\/from))#" , "#(?i:(?:(?:(?:^[\'`\\\\]*?[^\'`]+[\'`])+|(?:^[\'`\\\\]*?[\d\'`]+)+)\s*?(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)\s*?[\w\'`][+&!@(),.-]|\@(?:[\w-]+\s(?:between|like|x?or|and|div)\s*?[^\w\s]|\w+\s+(?:between|like|x?or|and|div)\s*?[\'`\d]+)|[\'`]\s*?(?:between|like|x?or|and|div)\s*?[\'`]?\d|[^\w\s:]\s*?\d\W+[^\w\s]\s*?[\'`].|[^\w\s]\w+\s*?[|-]\s*?[\'`]\s*?\w|\Winformation_schema|\\\\x(?:23|27|3d)|table_name\W|^.?[\'`]$))#" , "@(?i:(?:[\'`](?:\s*?(?:is\s*?(?:[\d.]+\s*?\W.*?[\'`]|\d.+[\'`]?\w)|\d\s*?(?:--|#))|(?:\W+[\w+-]+\s*?=\s*?\d\W+|\|?[\w-]{3,}[^\w\s.,]+)[\'`]|[\%&<>^=]+\d\s*?(?:between|like|x?or|and|div|=))|(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+(?:sounds\s+like\s*?[\'`]|regexp\s*?\(|[=\d]+x)|in\s*?\(+\s*?select))@" , "#(?i:^[\W\d]+\s*?(?:alter|union)\b)#" , "@(?i:[\'`](?:\s*?(?:(?:\*.+(?:(?:an|i)d|between|like|x?or|div)\W*?[\'`]|(?:between|like|x?or|and|div)\s[^\d]+[\w-]+.*?)\d|[^\w\s?]+\s*?[^\w\s]+\s*?[\'`]|[^\w\s]+\s*?[\W\d].*?(?:--|#))|.*?\*\s*?\d)|[()\*<>%+-][\w-]+[^\w\s]+[\'`][^,]|\^[\'`])@" , "#(?:\b(?:having\b?(?:[\'\][^=]{1,10}[\'\?[=<>]+|\d{1,10}?[=<>]+)|(?i:having)\b\s+(?:'[^=]{1,10}'|\d{1,10})\s*?[=<>])|exists\s(?:s(?:elect\S(?:if(?:null)?\s\(|concat|top)|ystem\s\()|\b(?i:having)\b\s+\d{1,10}|'[^=]{1,10}'|\sselect)|(?i:\bexecute\s{1,5}[\w\.$]{1,5}\s{0,3})|(?i:\bcreate\s+?table.{0,20}?\()|(?i:\blike\W*?char\W*?\()|(?i:select.*?case)|(?i:from.*?limit)|(?i:\bexecute\()|(?i:order\sby))#" , "#(?:\b(?:(?i:xor)\b\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?)|(?i:or)\b\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?))|(?i:\bor\b?[\'\][^=]{1,10}[\'\]?[=<>]+)|(?i:'\s+xor\s+.{1,20}[+\-!<>=])|(?i:'\s+or\s+.{1,20}[+\-!<>=])|(?i:\bor\b?\d{1,10}?[=<>]+))#" , "#(?i:\band\b(?:\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?)|?(?:[\'\][^=]{1,10}[\'\]|\d{1,10})?[=<>]+))#" , "#(?i:\b(?:c(?:o(?:n(?:v(?:ert(?:_tz)?)?|cat(?:_ws)?|nection_id)|(?:mpres)?s|ercibility|(?:un)?t|alesce)|ur(?:rent_(?:time(?:stamp)?|date|user)|(?:dat|tim)e)|h(?:ar(?:(?:acter)?_length|set)?|r)|iel(?:ing)?|ast|r32)|s(?:t(?:d(?:dev(?:_(?:sam|po)p)?)?|r(?:_to_date|cmp))|u(?:b(?:str(?:ing(?:_index)?)?|(?:dat|tim)e)|m)|e(?:c(?:_to_time|ond)|ssion_user)|ys(?:tem_user|date)|ha[12]?|oundex|chema|ig?n|leep|pace|qrt)|i(?:s(?:_(?:ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull)|(?:free|used)_lock)|null)?|n(?:et(?:6_(?:aton|ntoa)|_(?:aton|ntoa))|s(?:ert|tr)|terval)?|f(?:null)?)|d(?:a(?:t(?:e(?:_(?:format|add|sub)|diff)?|abase)|y(?:of(?:month|week|year)|name)?)|e(?:(?:s_(?:de|en)cryp|faul)t|grees|code)|count|ump)|l(?:o(?:ca(?:l(?:timestamp)?|te)|g(?:10|2)?|ad_file|wer)|ast(?:_(?:insert_id|day))?|e(?:(?:as|f)t|ngth)|case|trim|pad|n)|u(?:n(?:compress(?:ed_length)?|ix_timestamp|hex)|tc_(?:time(?:stamp)?|date)|p(?:datexml|per)|uid(?:_short)?|case|ser)|r(?:a(?:wto(?:nhex(?:toraw)?|hex)|dians|nd)|e(?:p(?:lace|eat)|lease_lock|verse)|o(?:w_count|und)|ight|trim|pad)|t(?:ime(?:_(?:format|to_sec)|stamp(?:diff|add)?|diff)?|o_(?:(?:second|day)s|base64|n?char)|r(?:uncate|im)|an)|m(?:a(?:ke(?:_set|date)|ster_pos_wait|x)|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:nth(?:name)?|d)|d5)|f(?:i(?:eld(?:_in_set)?|nd_in_set)|rom_(?:unixtime|base64|days)|o(?:und_rows|rmat)|loor)|p(?:o(?:w(?:er)?|sition)|eriod_(?:diff|add)|rocedure_analyse|assword|g_sleep|i)|a(?:s(?:cii(?:str)?|in)|es_(?:de|en)crypt|dd(?:dat|tim)e|(?:co|b)s|tan2?|vg)|b(?:i(?:t_(?:length|count|x?or|and)|n(?:_to_num)?)|enchmark)|e(?:x(?:tract(?:value)?|p(?:ort_set)?)|nc(?:rypt|ode)|lt)|g(?:r(?:oup_conca|eates)t|et_(?:format|lock))|v(?:a(?:r(?:_(?:sam|po)p|iance)|lues)|ersion)|o(?:(?:ld_passwo)?rd|ct(?:et_length)?)|we(?:ek(?:ofyear|day)?|ight_string)|n(?:o(?:t_in|w)|ame_const|ullif)|h(?:ex(?:toraw)?|our)|qu(?:arter|ote)|year(?:week)?|xmltype)\W*?\()#" , "#(?i:(?:xp_(?:reg(?:re(?:movemultistring|ad)|delete(?:value|key)|enum(?:value|key)s|addmultistring|write)|(?:servicecontro|cmdshel)l|e(?:xecresultset|numdsn)|ntsec(?:_enumdomains)?|terminate(?:_process)?|availablemedia|loginconfig|filelist|dirtree|makecab)|s(?:p_(?:(?:addextendedpro|sqlexe)c|p(?:assword|repare)|replwritetovarbin|is_srvrolemember|execute(?:sql)?|makewebtask|oacreate|help)|ql_(?:longvarchar|variant))|open(?:owa_util|rowset|query)|(?:n?varcha|tbcreato)r|autonomous_transaction|db(?:a_users|ms_java)|utl_(?:file|http)))#" , "#(?i:(?:\b(?:(?:s(?:elect\b.{1,100}?\b(?:(?:(?:length|count)\b.{1,100}?|.*?\bdump\b.*)\bfrom|to(?:p\b.{1,100}?\bfrom|_(?:numbe|cha)r)|(?:from\b.{1,100}?\bwher|data_typ)e|instr)|ys_context)|in(?:to\b\W*?\b(?:dump|out)file|sert\b\W*?\binto|ner\b\W*?\bjoin)|u(?:nion\b.{1,100}?\bselect|tl_inaddr)|group\b.*?\bby\b.{1,100}?\bhaving|d(?:elete\b\W*?\bfrom|bms_\w+\.)|load\b\W*?\bdata\b.*?\binfile)\b|print\b\W*?\@\@)|(?:;\W*?\b(?:shutdown|drop)|collation\W*?\(a|\@\@version)\b|'(?:s(?:qloledb|a)|msdasql|dbo)'))#" , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){12})/ " , "@(?:/\*!?|\*/|[';]--|--[\s\r\n\v\f]|--[^-]*?-|[^&-]#.*?[\s\r\n\v\f]|;?\\x00)@" , "#(?i:(?:\A|[^\d])0x[a-f\d]{3,})#" , " (?:`((?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+\/]{4})+(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)`)" );
5
- $score['SQL'][2] = array( 3 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 3 , 5 , 5 , 5 );
6
- $regex['SQL'][3] = array( "#(?i)\W+\d*?\s*?having\s*?[^\s\-]#" , "#[\'`][\s\d]*?[^\w\s]\W*?\d\W*?.*?[\'`\d]#" , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){8})/ " , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){6})/ " , " /(?:'((?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+\/]{4})+(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)')/ " );
7
- $score['SQL'][3] = array( 5 , 5 , 3 , 3 , 3 , 5 );
8
- $regex['SQL'][4] = array( "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){3})/ " , " /((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){2})/" );
9
- $score['SQL'][4] = array( 3 , 3 );
10
-
11
  ?>
1
+ <?php
2
+ $regex['SQL'][1] = array( "#(?i:\b(?:(?:m(?:s(?:ys(?:ac(?:cess(?:objects|storage|xml)|es)|(?:relationship|object|querie)s|modules2?)|db)|aster\.\.sysdatabases|ysql\.db)|pg_(?:catalog|toast)|information_schema|northwind|tempdb)\b|s(?:(?:ys(?:\.database_name|aux)|qlite(?:_temp)?_master)\b|chema(?:_name\b|\W*\())|d(?:atabas|b_nam)e\W*\())#" , "#(?i:sleep\(\s*?\d*?\s*?\)|benchmark\(.*?\,.*?\))#" , "#(?i:(?:select|;)\s+(?:benchmark|sleep|if)\s*?\(\s*?\(?\s*?\w+)#" , "#(?i:(?:[\'`](?:;?\s*?(?:having|select|union)\b\s*?[^\s]|\s*?!\s*?[\'`\w])|(?:c(?:onnection_id|urrent_user)|database)\s*?\([^\)]*?|u(?:nion(?:[\w(\s]*?select|select@)|ser\s*?\([^\)]*?)|s(?:chema\s*?\([^\)]*?|elect.*?\w?user\()|into[\s+]+(?:dump|out)file\s*?[\'`]|\s*?exec(?:ute)?.*?\Wxp_cmdshell|from\W+information_schema\W|exec(?:ute)?\s+master\.|\wiif\s*?\())#" , "#^(?i:-0000023456|4294967295|4294967296|2147483648|2147483647|0000012345|-2147483648|-2147483649|0000023456|3.0.00738585072007e-308|1e309)$#" , "#(?i:[\s()]case\s*?\(|\)\s*?like\s*?\(|having\s*?[^\s]+\s*?[^\w\s]|if\s?\([\d\w]\s*?[=<>~])#" , "#(?i:(?:[\'`](?:;*?\s*?waitfor\s+(?:delay|time)\s+[\'`]|;.*?:\s*?goto)|alter\s*?\w+.*?cha(?:racte)?r\s+set\s+\w+))#" , "#(?i:merge.*?using\s*?\(|execute\s*?immediate\s*?[\'`]|match\s*?[\w(),+-]+\s*?against\s*?\()#" , "#(?i)union.*?select.*?from#" , "@(?i:(?:;\s*?shutdown\s*?(?:[#;]|\/\*|--|\{)|waitfor\s*?delay\s?[\'`]+\s?\d|select\s*?pg_sleep))@" , "#(?i:(?:\[\$(?:ne|eq|lte?|gte?|n?in|mod|all|size|exists|type|slice|x?or|div|like|between|and)\]))#" , "%(?i:(?:create\s+(?:procedure|function)\s*?\w+\s*?\(\s*?\)\s*?-|;\s*?(?:declare|open)\s+[\w-]+|procedure\s+analyse\s*?\(|declare[^\w]+[@#]\s*?\w+|exec\s*?\(\s*?\@))%" , "#(?i:(?:;\s*?(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s*?[\[(]?\w{2,}|create\s+function\s+.+\s+returns))#" , "#(?i:(?:^[\W\d]+\s*?(?:alter\s*(?:a(?:(?:pplication\s*rol|ggregat)e|s(?:ymmetric\s*ke|sembl)y|u(?:thorization|dit)|vailability\s*group)|c(?:r(?:yptographic\s*provider|edential)|o(?:l(?:latio|um)|nversio)n|ertificate|luster)|s(?:e(?:rv(?:ice|er)|curity|quence|ssion|arch)|y(?:mmetric\s*key|nonym)|togroup|chema)|m(?:a(?:s(?:ter\s*key|k)|terialized)|e(?:ssage\s*type|thod)|odule)|l(?:o(?:g(?:file\s*group|in)|ckdown)|a(?:ngua|r)ge|ibrary)|t(?:(?:abl(?:espac)?|yp)e|r(?:igger|usted)|hreshold|ext)|p(?:a(?:rtition|ckage)|ro(?:cedur|fil)e|ermission)|d(?:i(?:mension|skgroup)|atabase|efault|omain)|r(?:o(?:l(?:lback|e)|ute)|e(?:sourc|mot)e)|f(?:u(?:lltext|nction)|lashback|oreign)|e(?:xte(?:nsion|rnal)|(?:ndpoi|ve)nt)|in(?:dex(?:type)?|memory|stance)|b(?:roker\s*priority|ufferpool)|x(?:ml\s*schema|srobject)|w(?:ork(?:load)?|rapper)|hi(?:erarchy|stogram)|o(?:perator|utline)|(?:nicknam|queu)e|us(?:age|er)|group|java|view)|u(?:nion\s*(?:(?:distin|sele)ct|all)|pdate)|(?:(?:trunc|cre)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|load)\b|(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s+(?:group_concat|load_file|char)\s?\(?|[\d\W]\s+as\s*?[\'`\w]+\s*?from|[\s(]load_file\s*?\(|[\'`]\s+regexp\W|end\s*?\);))#" , "#(?i:/\*[!+](?:[\w\s=_\-()]+)?\*/)#" );
3
+ $score['SQL'][1] = array( 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 );
4
+ $regex['SQL'][2] = array( "#(?:^\s*[\'`;]+|[\'`]+\s*$)#" , "#(?i:(?:(?:^|\W)in[+\s]*\([\s\d\]+[^()]*\)|\b(?:r(?:egexp|like)|isnull|xor)\b|<(?:>(?:\s+binary)?|=>?|<)|r(?:egexp|like)\s+binary|not\s+between\s+0\s+and|(?:like|is)\s+null|>[=>]|\|\||!=|&&))#" , "#(?i:[\s'\`()]*?([\d\w]++)[\s'\`()]*?(?:<(?:=(?:[\s'\`()]*?(?!\1)[\d\w]+|>[\s'\`()]*?(?:\1))|>?[\s'\`()]*?(?!\1)[\d\w]+)|(?:not\s+(?:regexp|like)|is\s+not|>=?|!=|\^)[\s'\`()]*?(?!\1)[\d\w]+|(?:(?:sounds\s+)?like|r(?:egexp|like)|=)[\s'\`()]*?(?:\1)))#" , "#(?i)\b(?:c(?:o(?:n(?:v(?:ert(?:_tz)?)?|cat(?:_ws)?|nection_id)|(?:mpres)?s|ercibility|(?:un)?t|llation|alesce)|ur(?:rent_(?:time(?:stamp)?|date|user)|(?:dat|tim)e)|h(?:ar(?:(?:acter)?_length|set)?|r)|iel(?:ing)?|ast|r32)|s(?:u(?:b(?:str(?:ing(?:_index)?)?|(?:dat|tim)e)|m)|t(?:d(?:dev_(?:sam|po)p)?|r(?:_to_date|cmp))|e(?:c(?:_to_time|ond)|ssion_user)|ys(?:tem_user|date)|ha[12]?|oundex|chema|ig?n|leep|pace|qrt)|i(?:s(?:_(?:ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull)|(?:free|used)_lock)|null)|n(?:et(?:6_(?:aton|ntoa)|_(?:aton|ntoa))|s(?:ert|tr)|terval)?|f(?:null)?)|d(?:a(?:t(?:e(?:_(?:format|add|sub)|diff)?|abase)|y(?:of(?:month|week|year)|name)?)|e(?:(?:s_(?:de|en)cryp|faul)t|grees|code)|count|ump)|l(?:o(?:ca(?:l(?:timestamp)?|te)|g(?:10|2)?|ad_file|wer)|ast(?:_(?:inser_id|day))?|e(?:(?:as|f)t|ngth)|case|trim|pad|n)|u(?:n(?:compress(?:ed_length)?|ix_timestamp|hex)|tc_(?:time(?:stamp)?|date)|p(?:datexml|per)|uid(?:_short)?|case|ser)|t(?:ime(?:_(?:format|to_sec)|stamp(?:diff|add)?|diff)?|o(?:(?:second|day)s|_base64|n?char)|r(?:uncate|im)|an)|m(?:a(?:ke(?:_set|date)|ster_pos_wait|x)|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:nth(?:name)?|d)|d5)|r(?:e(?:p(?:lace|eat)|lease_lock|verse)|a(?:wtohex|dians|nd)|o(?:w_count|und)|ight|trim|pad)|f(?:i(?:eld(?:_in_set)?|nd_in_set)|rom_(?:unixtime|base64|days)|o(?:und_rows|rmat)|loor)|p(?:o(?:w(?:er)?|sition)|eriod_(?:diff|add)|rocedure_analyse|assword|g_sleep|i)|a(?:s(?:cii(?:str)?|in)|es_(?:de|en)crypt|dd(?:dat|tim)e|(?:co|b)s|tan2?|vg)|b(?:i(?:t_(?:length|count|x?or|and)|n(?:_to_num)?)|enchmark)|e(?:x(?:tract(?:value)?|p(?:ort_set)?)|nc(?:rypt|ode)|lt)|g(?:r(?:oup_conca|eates)t|et_(?:format|lock))|v(?:a(?:r(?:_(?:sam|po)p|iance)|lues)|ersion)|o(?:(?:ld_passwo)?rd|ct(?:et_length)?)|we(?:ek(?:ofyear|day)?|ight_string)|n(?:o(?:t_in|w)|ame_const|ullif)|h(?:ex(?:toraw)?|our)|qu(?:arter|ote)|year(?:week)?|xmltype)\W*\(#" , "@(?i:[\'`](?:\s*?(?:(?:between|x?or|and|div)[\w\s-]+\s*?[+<>=(),-]\s*?[\d\'`]|like(?:[\w\s-]+\s*?[+<>=(),-]\s*?[\d\'`]|\W+[\w\'`(])|[!=|](?:[\d\s!=+-]+.*?[\'`(].*?|[\d\s!=]+.*?\d+)$|[^\w\s]?=\s*?[\'`])|(?:\W*?[+=]+\W*?|[<>~]+)[\'`])|(?:/\*)+[\'`]+\s?(?:\/\*|--|\{|#)?|\d[\'`]\s+[\'`]\s+\d|where\s[\s\w\.,-]+\s=|^admin\s*?[\'`]|\sis\s*?0\W)@" , "#(?i:(?:(?:(?:(?:trunc|cre|upd)at|renam)e|(?:inser|selec)t|de(?:lete|sc)|alter|load)\s*?\(\s*?space\s*?\(|,.*?[)\da-f\'`][\'`](?:[\'`].*?[\'`]|(?:\r?\n)?\z|[^\'`]+)|\Wselect.+\W*?from))#" , "%(?i:(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)[\s(]+\w+[\s)]*?[!=+]+[\s\d]*?[\'`=()]|\/\w+;?\s+(?:between|having|select|like|x?or|and|div)\W|\d+\s*?(?:between|like|x?or|and|div)\s*?\d+\s*?[\-+]|--\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|#\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|;\s*?(?:(?:insert|update)\s*?\w{2,}|alter|drop)|\@.+=\s*?\(\s*?select|\d\s+group\s+by.+\(|[^\w]SET\s*?\@\w+))%" , "#(?i:[\'`]\s*?(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||and|div|&&)\s+[\s\w]+=\s*?\w+\s*?having\s+|like(?:\s+[\s\w]+=\s*?\w+\s*?having\s+|\W*?[\'`\d])|[^?\w\s=.,;)(]++\s*?[(@\'`]*?\s*?\w+\W+\w|\*\s*?\w+\W+[\'`])|(?:union\s*?(?:distinct|[(!@]*?|all)?\s*?[([]*?\s*?select|select\s+?[\[\]()\s\w\.,\'`-]+from)\s+|\w+\s+like\s+[\'`]|find_in_set\s*?\(|like\s*?[\'`]%)#" , "@(?i:(?:(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)\s+\s*?\w+\(|\)\s*?when\s*?\d+\s*?then|[\'`]\s*?(?:--|\{|#)|cha?r\s*?\(\s*?\d|\/\*!\s?\d+))@" , "#(?i:(?:[\'`](?:;\s*?(?:begin|while|if)|[\s\d]+=\s*?\d|\s+and\s*?=\W)|(?:\(\s*?select\s*?\w+|order\s+by\s+if\w*?|coalesce)\s*?\(|\w[\'`]\s*?(?:(?:[-+=|@]+\s+?)+|[-+=|@]+)[\d(]|[\s(]+case\d*?\W.+[tw]hen[\s(]|\+\s*?\d+\s*?\+\s*?\@|\@\@\w+\s*?[^\w\s]|\W!+[\'`]\w|\*\/from))#" , "#(?i:(?:(?:(?:^[\'`\\\\]*?[^\'`]+[\'`])+|(?:^[\'`\\\\]*?[\d\'`]+)+)\s*?(?:n(?:and|ot)|(?:x?x)?or|between|\|\||like|and|div|&&)\s*?[\w\'`][+&!@(),.-]|\@(?:[\w-]+\s(?:between|like|x?or|and|div)\s*?[^\w\s]|\w+\s+(?:between|like|x?or|and|div)\s*?[\'`\d]+)|[\'`]\s*?(?:between|like|x?or|and|div)\s*?[\'`]?\d|[^\w\s:]\s*?\d\W+[^\w\s]\s*?[\'`].|[^\w\s]\w+\s*?[|-]\s*?[\'`]\s*?\w|\Winformation_schema|\\\\x(?:23|27|3d)|table_name\W|^.?[\'`]$))#" , "@(?i:(?:[\'`](?:\s*?(?:is\s*?(?:[\d.]+\s*?\W.*?[\'`]|\d.+[\'`]?\w)|\d\s*?(?:--|#))|(?:\W+[\w+-]+\s*?=\s*?\d\W+|\|?[\w-]{3,}[^\w\s.,]+)[\'`]|[\%&<>^=]+\d\s*?(?:between|like|x?or|and|div|=))|(?i:n?and|x?x?or|div|like|between|not|\|\||\&\&)\s+[\s\w+]+(?:sounds\s+like\s*?[\'`]|regexp\s*?\(|[=\d]+x)|in\s*?\(+\s*?select))@" , "#(?i:^[\W\d]+\s*?(?:alter|union)\b)#" , "@(?i:[\'`](?:\s*?(?:(?:\*.+(?:(?:an|i)d|between|like|x?or|div)\W*?[\'`]|(?:between|like|x?or|and|div)\s[^\d]+[\w-]+.*?)\d|[^\w\s?]+\s*?[^\w\s]+\s*?[\'`]|[^\w\s]+\s*?[\W\d].*?(?:--|#))|.*?\*\s*?\d)|[()\*<>%+-][\w-]+[^\w\s]+[\'`][^,]|\^[\'`])@" , "#(?:\b(?:having\b?(?:[\'\][^=]{1,10}[\'\?[=<>]+|\d{1,10}?[=<>]+)|(?i:having)\b\s+(?:'[^=]{1,10}'|\d{1,10})\s*?[=<>])|exists\s(?:s(?:elect\S(?:if(?:null)?\s\(|concat|top)|ystem\s\()|\b(?i:having)\b\s+\d{1,10}|'[^=]{1,10}'|\sselect)|(?i:\bexecute\s{1,5}[\w\.$]{1,5}\s{0,3})|(?i:\bcreate\s+?table.{0,20}?\()|(?i:\blike\W*?char\W*?\()|(?i:select.*?case)|(?i:from.*?limit)|(?i:\bexecute\()|(?i:order\sby))#" , "#(?:\b(?:(?i:xor)\b\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?)|(?i:or)\b\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?))|(?i:\bor\b?[\'\][^=]{1,10}[\'\]?[=<>]+)|(?i:'\s+xor\s+.{1,20}[+\-!<>=])|(?i:'\s+or\s+.{1,20}[+\-!<>=])|(?i:\bor\b?\d{1,10}?[=<>]+))#" , "#(?i:\band\b(?:\s+(?:'[^=]{1,10}'(?:\s*?[=<>])?|\d{1,10}(?:\s*?[=<>])?)|?(?:[\'\][^=]{1,10}[\'\]|\d{1,10})?[=<>]+))#" , "#(?i:\b(?:c(?:o(?:n(?:v(?:ert(?:_tz)?)?|cat(?:_ws)?|nection_id)|(?:mpres)?s|ercibility|(?:un)?t|alesce)|ur(?:rent_(?:time(?:stamp)?|date|user)|(?:dat|tim)e)|h(?:ar(?:(?:acter)?_length|set)?|r)|iel(?:ing)?|ast|r32)|s(?:t(?:d(?:dev(?:_(?:sam|po)p)?)?|r(?:_to_date|cmp))|u(?:b(?:str(?:ing(?:_index)?)?|(?:dat|tim)e)|m)|e(?:c(?:_to_time|ond)|ssion_user)|ys(?:tem_user|date)|ha[12]?|oundex|chema|ig?n|leep|pace|qrt)|i(?:s(?:_(?:ipv(?:4(?:_(?:compat|mapped))?|6)|n(?:ot(?:_null)?|ull)|(?:free|used)_lock)|null)?|n(?:et(?:6_(?:aton|ntoa)|_(?:aton|ntoa))|s(?:ert|tr)|terval)?|f(?:null)?)|d(?:a(?:t(?:e(?:_(?:format|add|sub)|diff)?|abase)|y(?:of(?:month|week|year)|name)?)|e(?:(?:s_(?:de|en)cryp|faul)t|grees|code)|count|ump)|l(?:o(?:ca(?:l(?:timestamp)?|te)|g(?:10|2)?|ad_file|wer)|ast(?:_(?:insert_id|day))?|e(?:(?:as|f)t|ngth)|case|trim|pad|n)|u(?:n(?:compress(?:ed_length)?|ix_timestamp|hex)|tc_(?:time(?:stamp)?|date)|p(?:datexml|per)|uid(?:_short)?|case|ser)|r(?:a(?:wto(?:nhex(?:toraw)?|hex)|dians|nd)|e(?:p(?:lace|eat)|lease_lock|verse)|o(?:w_count|und)|ight|trim|pad)|t(?:ime(?:_(?:format|to_sec)|stamp(?:diff|add)?|diff)?|o_(?:(?:second|day)s|base64|n?char)|r(?:uncate|im)|an)|m(?:a(?:ke(?:_set|date)|ster_pos_wait|x)|i(?:(?:crosecon)?d|n(?:ute)?)|o(?:nth(?:name)?|d)|d5)|f(?:i(?:eld(?:_in_set)?|nd_in_set)|rom_(?:unixtime|base64|days)|o(?:und_rows|rmat)|loor)|p(?:o(?:w(?:er)?|sition)|eriod_(?:diff|add)|rocedure_analyse|assword|g_sleep|i)|a(?:s(?:cii(?:str)?|in)|es_(?:de|en)crypt|dd(?:dat|tim)e|(?:co|b)s|tan2?|vg)|b(?:i(?:t_(?:length|count|x?or|and)|n(?:_to_num)?)|enchmark)|e(?:x(?:tract(?:value)?|p(?:ort_set)?)|nc(?:rypt|ode)|lt)|g(?:r(?:oup_conca|eates)t|et_(?:format|lock))|v(?:a(?:r(?:_(?:sam|po)p|iance)|lues)|ersion)|o(?:(?:ld_passwo)?rd|ct(?:et_length)?)|we(?:ek(?:ofyear|day)?|ight_string)|n(?:o(?:t_in|w)|ame_const|ullif)|h(?:ex(?:toraw)?|our)|qu(?:arter|ote)|year(?:week)?|xmltype)\W*?\()#" , "#(?i:(?:xp_(?:reg(?:re(?:movemultistring|ad)|delete(?:value|key)|enum(?:value|key)s|addmultistring|write)|(?:servicecontro|cmdshel)l|e(?:xecresultset|numdsn)|ntsec(?:_enumdomains)?|terminate(?:_process)?|availablemedia|loginconfig|filelist|dirtree|makecab)|s(?:p_(?:(?:addextendedpro|sqlexe)c|p(?:assword|repare)|replwritetovarbin|is_srvrolemember|execute(?:sql)?|makewebtask|oacreate|help)|ql_(?:longvarchar|variant))|open(?:owa_util|rowset|query)|(?:n?varcha|tbcreato)r|autonomous_transaction|db(?:a_users|ms_java)|utl_(?:file|http)))#" , "#(?i:(?:\b(?:(?:s(?:elect\b.{1,100}?\b(?:(?:(?:length|count)\b.{1,100}?|.*?\bdump\b.*)\bfrom|to(?:p\b.{1,100}?\bfrom|_(?:numbe|cha)r)|(?:from\b.{1,100}?\bwher|data_typ)e|instr)|ys_context)|in(?:to\b\W*?\b(?:dump|out)file|sert\b\W*?\binto|ner\b\W*?\bjoin)|u(?:nion\b.{1,100}?\bselect|tl_inaddr)|group\b.*?\bby\b.{1,100}?\bhaving|d(?:elete\b\W*?\bfrom|bms_\w+\.)|load\b\W*?\bdata\b.*?\binfile)\b|print\b\W*?\@\@)|(?:;\W*?\b(?:shutdown|drop)|collation\W*?\(a|\@\@version)\b|'(?:s(?:qloledb|a)|msdasql|dbo)'))#" , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){12})/ " , "@(?:/\*!?|\*/|[';]--|--[\s\r\n\v\f]|--[^-]*?-|[^&-]#.*?[\s\r\n\v\f]|;?\\x00)@" , "#(?i:(?:\A|[^\d])0x[a-f\d]{3,})#" , " (?:`((?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+\/]{4})+(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)`)" );
5
+ $score['SQL'][2] = array( 3 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 3 , 5 , 5 , 5 );
6
+ $regex['SQL'][3] = array( "#(?i)\W+\d*?\s*?having\s*?[^\s\-]#" , "#[\'`][\s\d]*?[^\w\s]\W*?\d\W*?.*?[\'`\d]#" , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){8})/ " , "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){6})/ " , " /(?:'((?:[\w\s=_\-+{}()<@]){2,29}|(?:[A-Za-z0-9+\/]{4})+(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?)')/ " );
7
+ $score['SQL'][3] = array( 5 , 5 , 3 , 3 , 3 , 5 );
8
+ $regex['SQL'][4] = array( "/((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\'´’‘`<>]*?){3})/ " , " /((?:[~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>][^~!@#\$%\^&\*\(\)\-\+=\{\}\[\]\|:;\"'´’‘`<>]*?){2})/" );
9
+ $score['SQL'][4] = array( 3 , 3 );
10
+
11
  ?>
handler/twofa/two_fa_constants.php CHANGED
@@ -1,441 +1,441 @@
1
- <?php
2
- if ( ! defined( 'ABSPATH' ) ) {
3
- exit;
4
- }
5
-
6
- class Mo2fConstants {
7
- static function langTranslate( $text ) {
8
- switch ( $text ) {
9
- case 'Successfully validated.':
10
- return mo2f_lt( 'Successfully validated.' );
11
- break;
12
- case 'SCAN_QR_CODE':
13
- return mo2f_lt( 'Please scan the QR Code now.' );
14
- break;
15
- case 'miniOrange QR Code Authentication':
16
- return mo2f_lt( 'miniOrange QR Code Authentication' );
17
- break;
18
- case 'miniOrange Push Notification':
19
- return mo2f_lt( 'miniOrange Push Notification' );
20
- break;
21
- case 'miniOrange Soft Token':
22
- return mo2f_lt( 'miniOrange Soft Token' );
23
- break;
24
- case 'Security Questions':
25
- return mo2f_lt( 'Security Questions' );
26
- break;
27
- case 'Google Authenticator':
28
- return mo2f_lt( 'Google Authenticator' );
29
- break;
30
- case 'Authy Authenticator':
31
- return mo2f_lt( 'Authy Authenticator' );
32
- break;
33
- case 'Email Verification':
34
- return mo2f_lt( 'Email Verification' );
35
- break;
36
- case 'OTP Over SMS':
37
- return mo2f_lt( 'OTP Over SMS' );
38
- break;
39
- case 'OTP Over SMS And Email':
40
- return mo2f_lt( 'OTP Over SMS And Email' );
41
- break;
42
- case 'Your license has expired. Please renew your license to continue using our service.':
43
- return mo2f_lt( 'Your license has expired. Please renew your license to continue using our service.' );
44
- break;
45
- case 'The total transaction limit has been exceeded. Please upgrade your premium plan.':
46
- return mo2f_lt( 'The total transaction limit has been exceeded. Please upgrade your premium plan.' );
47
- break;
48
- case 'The transaction limit has exceeded.':
49
- return mo2f_lt( 'The transaction limit has exceeded.' );
50
- break;
51
- case 'GenerateOtpRequest is null':
52
- return mo2f_lt( 'GenerateOtpRequest is null' );
53
- break;
54
- case 'The sms transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.':
55
- return mo2f_lt( 'The sms transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.' );
56
- break;
57
- case 'The email transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.':
58
- return mo2f_lt( 'The email transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.' );
59
- break;
60
- case 'Transaction limit exceeded. Please contact your administrator':
61
- return mo2f_lt( 'Transaction limit exceeded. Please contact your administrator' );
62
- break;
63
- case 'Free Trial has already been taken or expired for this plugin. Please upgrade to a premium plan.':
64
- return mo2f_lt( 'Free Trial has already been taken or expired for this plugin. Please upgrade to a premium plan.' );
65
- break;
66
- case 'Invalid format.':
67
- return mo2f_lt( 'Invalid format.' );
68
- break;
69
- case 'Mobile registration failed.':
70
- return mo2f_lt( 'Mobile registration failed.' );
71
- break;
72
- case 'Invalid mobile authentication request.':
73
- return mo2f_lt( 'Invalid mobile authentication request.' );
74
- break;
75
- case 'Exception during SMS sending':
76
- return mo2f_lt( 'Exception during SMS sending' );
77
- break;
78
- case 'There was an error during sending an SMS.':
79
- return mo2f_lt( 'There was an error during sending an SMS.' );
80
- break;
81
- case 'Exception during logUserTransaction':
82
- return mo2f_lt( 'Exception during logUserTransaction' );
83
- break;
84
- case 'There was an error processing the challenge user request.':
85
- return mo2f_lt( 'There was an error processing the challenge user request.' );
86
- break;
87
- case 'What is your first company name?':
88
- return mo2f_lt( 'What is your first company name?' );
89
- break;
90
- case 'What was your childhood nickname?':
91
- return mo2f_lt( 'What was your childhood nickname?' );
92
- break;
93
- case 'In what city did you meet your spouse/significant other?':
94
- return mo2f_lt( 'In what city did you meet your spouse/significant other?' );
95
- break;
96
- case 'What is the name of your favorite childhood friend?':
97
- return mo2f_lt( 'What is the name of your favorite childhood friend?' );
98
- break;
99
- case "What was your first vehicle's registration number?":
100
- return mo2f_lt( "What was your first vehicle's registration number?" );
101
- break;
102
- case "What is your grandmother's maiden name?":
103
- return mo2f_lt( "What is your grandmother's maiden name?" );
104
- break;
105
- case 'Who is your favourite sports player?':
106
- return mo2f_lt( 'Who is your favourite sports player?' );
107
- break;
108
- case 'What is your favourite sport?':
109
- return mo2f_lt( 'What is your favourite sport?' );
110
- break;
111
- case 'In what city or town was your first job':
112
- return mo2f_lt( 'In what city or town was your first job' );
113
- break;
114
- case 'What school did you attend for sixth grade?':
115
- return mo2f_lt( 'What school did you attend for sixth grade?' );
116
- break;
117
- case 'G_AUTH':
118
- return mo2f_lt( 'Google Authenticator' );
119
- break;
120
- case 'AUTHY_2FA':
121
- return mo2f_lt( 'Authy 2-Factor Authentication' );
122
- break;
123
- case 'An unknown error occurred while creating the end user.':
124
- return mo2f_lt( 'An unknown error occurred while creating the end user.' );
125
- break;
126
- case 'An unknown error occurred while challenging the user':
127
- return mo2f_lt( 'An unknown error occurred while challenging the user.' );
128
- break;
129
- case 'An unknown error occurred while generating QR Code for registering mobile.':
130
- return mo2f_lt( 'An unknown error occurred while generating QR Code for registering mobile.' );
131
- break;
132
- case 'An unknown error occurred while validating the user\'s identity.':
133
- return mo2f_lt( 'An unknown error occurred while validating the user\'s identity.' );
134
- break;
135
- case 'Customer not found.':
136
- return mo2f_lt( 'Customer not found.' );
137
- break;
138
- case 'The customer is not valid ':
139
- return mo2f_lt( 'The customer is not valid' );
140
- break;
141
- case 'The user is not valid ':
142
- return mo2f_lt( 'The user is not valid ' );
143
- break;
144
- case 'Customer already exists.':
145
- return mo2f_lt( 'Customer already exists.' );
146
- break;
147
- case 'Customer Name is null':
148
- return mo2f_lt( 'Customer Name is null' );
149
- break;
150
- case 'Customer check request failed.':
151
- return mo2f_lt( 'Customer check request failed.' );
152
- break;
153
- case 'Invalid username or password. Please try again.':
154
- return mo2f_lt( 'Invalid username or password. Please try again.' );
155
- break;
156
- case 'You are not authorized to perform this operation.':
157
- return mo2f_lt( 'You are not authorized to perform this operation.' );
158
- break;
159
- case 'Invalid request. No such challenge request was initiated.':
160
- return mo2f_lt( 'Invalid request. No such challenge request was initiated.' );
161
- break;
162
- case 'No OTP Token for the given request was found.':
163
- return mo2f_lt( 'No OTP Token for the given request was found.' );
164
- break;
165
- case 'Query submitted.':
166
- return mo2f_lt( 'Query submitted.' );
167
- break;
168
- case 'Invalid parameters.':
169
- return mo2f_lt( 'Invalid parameters.' );
170
- break;
171
- case 'Alternate email cannot be same as primary email.':
172
- return mo2f_lt( 'Alternate email cannot be same as primary email.' );
173
- break;
174
- case 'CustomerId is null.':
175
- return mo2f_lt( 'CustomerId is null.' );
176
- break;
177
- case 'You are not authorized to create users. Please upgrade to premium plan. ':
178
- return mo2f_lt( 'You are not authorized to create users. Please upgrade to premium plan. ' );
179
- break;
180
- case 'Your user creation limit has been completed. Please upgrade your license to add more users.':
181
- return mo2f_lt( 'Your user creation limit has been completed. Please upgrade your license to add more users.' );
182
- break;
183
- case 'Username cannot be blank.':
184
- return mo2f_lt( 'Username cannot be blank.' );
185
- break;
186
- case 'End user created successfully.':
187
- return mo2f_lt( 'End user created successfully.' );
188
- break;
189
- case 'There was an exception processing the update user request.':
190
- return mo2f_lt( 'There was an exception processing the update user request.' );
191
- break;
192
- case 'End user found.':
193
- return mo2f_lt( 'End user found.' );
194
- break;
195
- case 'End user found under different customer. ':
196
- return mo2f_lt( 'End user found under different customer. ' );
197
- break;
198
- case 'End user not found.':
199
- return mo2f_lt( 'End user not found.' );
200
- break;
201
- case 'Customer successfully registered.':
202
- return mo2f_lt( 'Customer successfully registered.' );
203
- break;
204
- case 'Customer registration failed.':
205
- return mo2f_lt( 'Customer registration failed.' );
206
- break;
207
- case 'There was an error processing the register mobile request.':
208
- return mo2f_lt( 'There was an error processing the register mobile request.' );
209
- break;
210
- case 'There was an exception processing the get user request.':
211
- return mo2f_lt( 'There was an exception processing the get user request.' );
212
- break;
213
- case 'End User retrieved successfully.':
214
- return mo2f_lt( 'End User retrieved successfully.' );
215
- break;
216
- case 'COMPLETED_TEST':
217
- Return mo2f_lt( 'You have successfully completed the test.' );
218
- break;
219
- case 'INVALID_EMAIL_VER_REQ':
220
- Return mo2f_lt( 'Invalid request. test case failed.');
221
- break;
222
- case 'INVALID_ENTRY':
223
- Return mo2f_lt( 'All the fields are required. Please enter valid entries.' );
224
- break;
225
- case 'INVALID_PASSWORD':
226
- Return mo2f_lt( 'You already have an account with miniOrange. Please enter a valid password.' );
227
- break;
228
- case 'INVALID_REQ':
229
- Return mo2f_lt( 'Invalid request. Please try again' );
230
- break;
231
- case 'INVALID_OTP':
232
- Return mo2f_lt( 'Invalid OTP. Please try again.' );
233
- break;
234
- case 'INVALID_EMAIL_OR_PASSWORD':
235
- Return mo2f_lt( 'Invalid email or password. Please try again.' );
236
- break;
237
- case 'PASSWORDS_MISMATCH':
238
- Return mo2f_lt( 'Password and Confirm password do not match.' );
239
- break;
240
- case 'ENTER_YOUR_EMAIL_PASSWORD':
241
- Return mo2f_lt( 'Please enter your registered email and password.' );
242
- break;
243
- case 'OTP_SENT':
244
- Return mo2f_lt( 'One Time Passcode has been sent for verification to ' );
245
- break;
246
- case 'ERROR_IN_SENDING_OTP_OVER_EMAIL':
247
- Return mo2f_lt( 'There was an error in sending OTP over email. Please click on Resend OTP to try again.' );
248
- break;
249
- case 'ERROR_DURING_REGISTRATION':
250
- Return mo2f_lt( 'Error occured while registration. Please try again.' );
251
- break;
252
- case 'ERROR_DURING_PROCESS':
253
- Return mo2f_lt( 'An error occured while processing your request. Please Try again.' );
254
- break;
255
- case 'ERROR_DURING_PROCESS_EMAIL':
256
- Return mo2f_lt( 'An error occured while processing your request. Please check your SMTP server is configured.' );
257
- break;
258
- case 'ERROR_WHILE_SENDING_SMS':
259
- Return mo2f_lt( 'There was an error in sending sms. Please click on Resend OTP to try again.' );
260
- break;
261
- case 'ERROR_DURING_USER_REGISTRATION':
262
- Return mo2f_lt( 'Error occurred while registering the user. Please try again.' );
263
- break;
264
- case 'VALIDATE_DUO':
265
- Return mo2f_lt( 'Duo push notification validate successfully.' );
266
- break;
267
- case 'SET_AS_2ND_FACTOR':
268
- Return mo2f_lt( 'is set as your 2 factor authentication method.' );
269
- break;
270
- case 'ERROR_WHILE_SAVING_KBA':
271
- Return mo2f_lt( 'Error occured while saving your kba details. Please try again.' );
272
- break;
273
- case 'ANSWER_SECURITY_QUESTIONS':
274
- Return mo2f_lt( 'Please answer the following security questions.' );
275
- break;
276
- case 'RESET_DUO_CONFIGURATON':
277
- Return mo2f_lt( 'Your Duo configuration has been reset successfully.' );
278
- break;
279
- case 'ERROR_FETCHING_QUESTIONS':
280
- Return mo2f_lt( 'There was an error fetching security questions. Please try again.' );
281
- break;
282
- case 'INVALID_ANSWERS':
283
- Return mo2f_lt( 'Invalid Answers. Please try again.' );
284
- break;
285
- case 'MIN_PASS_LENGTH':
286
- Return mo2f_lt( 'Choose a password with minimum length 6.' );
287
- break;
288
- case 'ACCOUNT_RETRIEVED_SUCCESSFULLY':
289
- Return mo2f_lt( 'Your account has been retrieved successfully.' );
290
- break;
291
- case 'DEFAULT_2ND_FACTOR':
292
- Return mo2f_lt( 'has been set as your default 2nd factor method' );
293
- break;
294
- case 'RESENT_OTP':
295
- Return mo2f_lt( 'Another One Time Passcode has been sent' );
296
- break;
297
- case 'VERIFY':
298
- Return mo2f_lt( 'for verification to' );
299
- break;
300
- case 'ERROR_IN_SENDING_EMAIL':
301
- Return mo2f_lt( 'There was an error in sending email. Please click on Resend OTP to try again.' );
302
- break;
303
- case 'EMAIL_IN_USE':
304
- Return mo2f_lt( 'The email is already used by other user. Please register with other email.' );
305
- break;
306
- case 'EMAIL_MANDATORY':
307
- Return mo2f_lt( 'Please submit your query with email' );
308
- break;
309
- case 'ERROR_WHILE_SUBMITTING_QUERY':
310
- Return mo2f_lt( 'Your query could not be submitted. Please try again.' );
311
- break;
312
- case 'QUERY_SUBMITTED_SUCCESSFULLY':
313
- Return mo2f_lt( 'Thanks for getting in touch! We shall get back to you shortly.' );
314
- break;
315
- case 'SETTINGS_SAVED':
316
- Return mo2f_lt( 'Your settings are saved successfully.' );
317
- break;
318
- case 'AUTHENTICATION_FAILED':
319
- Return mo2f_lt( 'Authentication failed. Please try again to test the configuration.' );
320
- break;
321
- case 'REGISTER_WITH_MO':
322
- Return mo2f_lt( 'Invalid request. Please register with miniOrange before configuring your mobile.' );
323
- break;
324
- case 'ENTER_EMAILID':
325
- Return mo2f_lt( 'Please enter email-id to register.' );
326
- break;
327
- case 'ENTER_VALUE':
328
- Return mo2f_lt( 'Please enter a value to test your authentication.' );
329
- break;
330
- case 'ENTER_OTP':
331
- Return mo2f_lt( 'Please enter the one time passcode below.' );
332
- break;
333
- case 'ERROR_IN_SENDING_OTP':
334
- Return mo2f_lt( 'There was an error in sending one-time passcode. Your transaction limit might have exceeded. Please contact miniOrange or upgrade to our premium plan.' );
335
- break;
336
- case 'ERROR_IN_SENDING_OTP_ONPREM':
337
- Return mo2f_lt( 'There was an error in sending one-time passcode. Please check your SMTP Setup and remaining transactions.' );
338
- break;
339
- case 'SMTP_CHECK_FOR_EMAIL_VERIFICATON':
340
- Return mo2f_lt('Please set your SMTP to get the email to verify the email at the time of login otherwise you will get logged out');
341
- break;
342
- case 'PUSH_NOTIFICATION_SENT':
343
- Return mo2f_lt( 'A Push notification has been sent to your miniOrange Authenticator App.' );
344
- break;
345
- case 'ERROR_WHILE_VALIDATING_OTP':
346
- Return mo2f_lt( 'Error occurred while validating the OTP. Please try again.' );
347
- break;
348
- case 'TEST_GAUTH_METHOD':
349
- Return mo2f_lt( 'to test Google Authenticator method.' );
350
- break;
351
- case 'ERROR_IN_SENDING_OTP_CAUSES':
352
- Return mo2f_lt( 'Error occurred while validating the OTP. Please try again. Possible causes:' );
353
- break;
354
- case 'APP_TIME_SYNC':
355
- Return mo2f_lt( 'Your App Time is not in sync.Go to settings and tap on tap on Sync Time now .' );
356
- break;
357
- case 'SERVER_TIME_SYNC':
358
- Return mo2f_lt( 'Please make sure your System and device have the same time as the displayed Server time.' );
359
- break;
360
- case 'ERROR_WHILE_VALIDATING_USER':
361
- Return mo2f_lt( 'Error occurred while validating the user. Please try again.' );
362
- break;
363
- case 'ONLY_DIGITS_ALLOWED':
364
- Return mo2f_lt( 'Only digits are allowed. Please enter again.' );
365
- break;
366
- case 'TEST_AUTHY_2FA':
367
- Return mo2f_lt( 'to test Authy 2-Factor Authentication method.' );
368
- break;
369
- case 'METHOD':
370
- Return mo2f_lt( 'method.' );
371
- break;
372
- case 'TO_TEST':
373
- Return mo2f_lt( 'to test' );
374
- break;
375
- case 'SET_2FA':
376
- Return mo2f_lt( 'is set as your Two-Factor method.' );
377
- break;
378
-
379
- case 'SET_2FA_otp':
380
- Return mo2f_lt( 'is set as your Two-Factor method.' );
381
- break;
382
-
383
-
384
- case 'VERIFICATION_EMAIL_SENT':
385
- Return mo2f_lt( 'A verification email is sent to' );
386
- break;
387
- case 'ACCEPT_LINK_TO_VERIFY_EMAIL':
388
- Return mo2f_lt( 'Please click on accept link to verify your email.' );
389
- break;
390
- case 'ACCOUNT_CREATED':
391
- Return mo2f_lt( 'Your account has been created successfully.' );
392
- break;
393
- case 'ACCOUNT_REMOVED':
394
- Return mo2f_lt( 'Your account has been removed. Please contact your administrator.' );
395
- break;
396
- case 'REGISTRATION_SUCCESS':
397
- Return mo2f_lt( 'You are registered successfully.' );
398
- break;
399
- case 'DENIED_REQUEST':
400
- Return mo2f_lt( 'You have denied the request.' );
401
- break;
402
- case 'DENIED_DUO_REQUEST':
403
- Return mo2f_lt( 'You have denied the request or you have not set duo push notification yet' );
404
- break;
405
- case 'DISABLED_2FA':
406
- Return mo2f_lt( 'Two-Factor plugin has been disabled.' );
407
- break;
408
- case 'ERROR_WHILE_SAVING_SETTINGS':
409
- Return mo2f_lt( 'Error occurred while saving the settings.Please try again.' );
410
- break;
411
- case 'INVALID_REQUEST':
412
- Return mo2f_lt( 'Invalid request. Please register with miniOrange and configure 2-Factor to save your login settings.' );
413
- break;
414
- case 'ACCOUNT_ALREADY_EXISTS':
415
- Return mo2f_lt( 'You already have an account with miniOrange, please sign in.' );
416
- break;
417
- case 'CONFIGURE_2FA':
418
- Return mo2f_lt( 'to configure another 2 Factor authentication method.' );
419
- break;
420
- case 'PHONE_NOT_CONFIGURED':
421
- Return mo2f_lt( 'Your phone number is not configured. Please configure it before selecting OTP Over SMS as your 2-factor method.' );
422
- break;
423
- case 'CLICK_HERE':
424
- Return mo2f_lt( 'Click Here' );
425
- break;
426
- case 'ERROR_CREATE_ACC_OTP':
427
- Return mo2f_lt( 'An error occured while creating your account. Please try again by sending OTP again.' );
428
- break;
429
- case 'LOGIN_WITH_2ND_FACTOR':
430
- Return mo2f_lt( 'Please disable 2FA prompt on WP login page to enable Login with 2nd facor only.' );
431
- break;
432
- case 'USER_LIMIT_EXCEEDED':
433
- Return mo2f_lt( 'Your limit of 3 users has exceeded. Please upgrade to premium plans for more users.' );
434
- break;
435
- default:
436
- return $text;
437
- }
438
- }
439
- }
440
-
441
- new Mo2fConstants;
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) {
3
+ exit;
4
+ }
5
+
6
+ class Mo2fConstants {
7
+ static function langTranslate( $text ) {
8
+ switch ( $text ) {
9
+ case 'Successfully validated.':
10
+ return mo2f_lt( 'Successfully validated.' );
11
+ break;
12
+ case 'SCAN_QR_CODE':
13
+ return mo2f_lt( 'Please scan the QR Code now.' );
14
+ break;
15
+ case 'miniOrange QR Code Authentication':
16
+ return mo2f_lt( 'miniOrange QR Code Authentication' );
17
+ break;
18
+ case 'miniOrange Push Notification':
19
+ return mo2f_lt( 'miniOrange Push Notification' );
20
+ break;
21
+ case 'miniOrange Soft Token':
22
+ return mo2f_lt( 'miniOrange Soft Token' );
23
+ break;
24
+ case 'Security Questions':
25
+ return mo2f_lt( 'Security Questions' );
26
+ break;
27
+ case 'Google Authenticator':
28
+ return mo2f_lt( 'Google Authenticator' );
29
+ break;
30
+ case 'Authy Authenticator':
31
+ return mo2f_lt( 'Authy Authenticator' );
32
+ break;
33
+ case 'Email Verification':
34
+ return mo2f_lt( 'Email Verification' );
35
+ break;
36
+ case 'OTP Over SMS':
37
+ return mo2f_lt( 'OTP Over SMS' );
38
+ break;
39
+ case 'OTP Over SMS And Email':
40
+ return mo2f_lt( 'OTP Over SMS And Email' );
41
+ break;
42
+ case 'Your license has expired. Please renew your license to continue using our service.':
43
+ return mo2f_lt( 'Your license has expired. Please renew your license to continue using our service.' );
44
+ break;
45
+ case 'The total transaction limit has been exceeded. Please upgrade your premium plan.':
46
+ return mo2f_lt( 'The total transaction limit has been exceeded. Please upgrade your premium plan.' );
47
+ break;
48
+ case 'The transaction limit has exceeded.':
49
+ return mo2f_lt( 'The transaction limit has exceeded.' );
50
+ break;
51
+ case 'GenerateOtpRequest is null':
52
+ return mo2f_lt( 'GenerateOtpRequest is null' );
53
+ break;
54
+ case 'The sms transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.':
55
+ return mo2f_lt( 'The sms transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.' );
56
+ break;
57
+ case 'The email transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.':
58
+ return mo2f_lt( 'The email transaction limit has been exceeded. Please refer to the Licensing Plans tab for purchasing your SMS transactions.' );
59
+ break;
60
+ case 'Transaction limit exceeded. Please contact your administrator':
61
+ return mo2f_lt( 'Transaction limit exceeded. Please contact your administrator' );
62
+ break;
63
+ case 'Free Trial has already been taken or expired for this plugin. Please upgrade to a premium plan.':
64
+ return mo2f_lt( 'Free Trial has already been taken or expired for this plugin. Please upgrade to a premium plan.' );
65
+ break;
66
+ case 'Invalid format.':
67
+ return mo2f_lt( 'Invalid format.' );
68
+ break;
69
+ case 'Mobile registration failed.':
70
+ return mo2f_lt( 'Mobile registration failed.' );
71
+ break;
72
+ case 'Invalid mobile authentication request.':
73
+ return mo2f_lt( 'Invalid mobile authentication request.' );
74
+ break;
75
+ case 'Exception during SMS sending':
76
+ return mo2f_lt( 'Exception during SMS sending' );
77
+ break;
78
+ case 'There was an error during sending an SMS.':
79
+ return mo2f_lt( 'There was an error during sending an SMS.' );
80
+ break;
81
+ case 'Exception during logUserTransaction':
82
+ return mo2f_lt( 'Exception during logUserTransaction' );
83
+ break;
84
+ case 'There was an error processing the challenge user request.':
85
+ return mo2f_lt( 'There was an error processing the challenge user request.' );
86
+ break;
87
+ case 'What is your first company name?':
88
+ return mo2f_lt( 'What is your first company name?' );
89
+ break;
90
+ case 'What was your childhood nickname?':
91
+ return mo2f_lt( 'What was your childhood nickname?' );
92
+ break;
93
+ case 'In what city did you meet your spouse/significant other?':
94
+ return mo2f_lt( 'In what city did you meet your spouse/significant other?' );
95
+ break;
96
+ case 'What is the name of your favorite childhood friend?':
97
+ return mo2f_lt( 'What is the name of your favorite childhood friend?' );
98
+ break;
99
+ case "What was your first vehicle's registration number?":
100
+ return mo2f_lt( "What was your first vehicle's registration number?" );
101
+ break;
102
+ case "What is your grandmother's maiden name?":
103
+ return mo2f_lt( "What is your grandmother's maiden name?" );
104
+ break;
105
+ case 'Who is your favourite sports player?':
106
+ return mo2f_lt( 'Who is your favourite sports player?' );
107
+ break;
108
+ case 'What is your favourite sport?':
109
+ return mo2f_lt( 'What is your favourite sport?' );
110
+ break;
111
+ case 'In what city or town was your first job':
112
+ return mo2f_lt( 'In what city or town was your first job' );
113
+ break;
114
+ case 'What school did you attend for sixth grade?':
115
+ return mo2f_lt( 'What school did you attend for sixth grade?' );
116
+ break;
117
+ case 'G_AUTH':
118
+ return mo2f_lt( 'Google Authenticator' );
119
+ break;
120
+ case 'AUTHY_2FA':
121
+ return mo2f_lt( 'Authy 2-Factor Authentication' );
122
+ break;
123
+ case 'An unknown error occurred while creating the end user.':
124
+ return mo2f_lt( 'An unknown error occurred while creating the end user.' );
125
+ break;
126
+ case 'An unknown error occurred while challenging the user':
127
+ return mo2f_lt( 'An unknown error occurred while challenging the user.' );
128
+ break;
129
+ case 'An unknown error occurred while generating QR Code for registering mobile.':
130
+ return mo2f_lt( 'An unknown error occurred while generating QR Code for registering mobile.' );
131
+ break;
132
+ case 'An unknown error occurred while validating the user\'s identity.':
133
+ return mo2f_lt( 'An unknown error occurred while validating the user\'s identity.' );
134
+ break;
135
+ case 'Customer not found.':
136
+ return mo2f_lt( 'Customer not found.' );
137
+ break;
138
+ case 'The customer is not valid ':
139
+ return mo2f_lt( 'The customer is not valid' );
140
+ break;
141
+ case 'The user is not valid ':
142
+ return mo2f_lt( 'The user is not valid ' );
143
+ break;
144
+ case 'Customer already exists.':
145
+ return mo2f_lt( 'Customer already exists.' );
146
+ break;
147
+ case 'Customer Name is null':
148
+ return mo2f_lt( 'Customer Name is null' );
149
+ break;
150
+ case 'Customer check request failed.':
151
+ return mo2f_lt( 'Customer check request failed.' );
152
+ break;
153
+ case 'Invalid username or password. Please try again.':
154
+ return mo2f_lt( 'Invalid username or password. Please try again.' );
155
+ break;
156
+ case 'You are not authorized to perform this operation.':
157
+ return mo2f_lt( 'You are not authorized to perform this operation.' );
158
+ break;
159
+ case 'Invalid request. No such challenge request was initiated.':
160
+ return mo2f_lt( 'Invalid request. No such challenge request was initiated.' );
161
+ break;
162
+ case 'No OTP Token for the given request was found.':
163
+ return mo2f_lt( 'No OTP Token for the given request was found.' );
164
+ break;
165
+ case 'Query submitted.':
166
+ return mo2f_lt( 'Query submitted.' );
167
+ break;
168
+ case 'Invalid parameters.':
169
+ return mo2f_lt( 'Invalid parameters.' );
170
+ break;
171
+ case 'Alternate email cannot be same as primary email.':
172
+ return mo2f_lt( 'Alternate email cannot be same as primary email.' );
173
+ break;
174
+ case 'CustomerId is null.':
175
+ return mo2f_lt( 'CustomerId is null.' );
176
+ break;
177
+ case 'You are not authorized to create users. Please upgrade to premium plan. ':
178
+ return mo2f_lt( 'You are not authorized to create users. Please upgrade to premium plan. ' );
179
+ break;
180
+ case 'Your user creation limit has been completed. Please upgrade your license to add more users.':
181
+ return mo2f_lt( 'Your user creation limit has been completed. Please upgrade your license to add more users.' );
182
+ break;
183
+ case 'Username cannot be blank.':
184
+ return mo2f_lt( 'Username cannot be blank.' );
185
+ break;
186
+ case 'End user created successfully.':
187
+ return mo2f_lt( 'End user created successfully.' );
188
+ break;
189
+ case 'There was an exception processing the update user request.':
190
+ return mo2f_lt( 'There was an exception processing the update user request.' );
191
+ break;
192
+ case 'End user found.':
193
+ return mo2f_lt( 'End user found.' );
194
+ break;
195
+ case 'End user found under different customer. ':
196
+ return mo2f_lt( 'End user found under different customer. ' );
197
+ break;
198
+ case 'End user not found.':
199
+ return mo2f_lt( 'End user not found.' );
200
+ break;
201
+ case 'Customer successfully registered.':
202
+ return mo2f_lt( 'Customer successfully registered.' );
203
+ break;
204
+ case 'Customer registration failed.':
205
+ return mo2f_lt( 'Customer registration failed.' );
206
+ break;
207
+ case 'There was an error processing the register mobile request.':
208
+ return mo2f_lt( 'There was an error processing the register mobile request.' );
209
+ break;
210
+ case 'There was an exception processing the get user request.':
211
+ return mo2f_lt( 'There was an exception processing the get user request.' );
212
+ break;
213
+ case 'End User retrieved successfully.':
214
+ return mo2f_lt( 'End User retrieved successfully.' );
215
+ break;
216
+ case 'COMPLETED_TEST':
217
+ Return mo2f_lt( 'You have successfully completed the test.' );
218
+ break;
219
+ case 'INVALID_EMAIL_VER_REQ':
220
+ Return mo2f_lt( 'Invalid request. test case failed.');
221
+ break;
222
+ case 'INVALID_ENTRY':
223
+ Return mo2f_lt( 'All the fields are required. Please enter valid entries.' );
224
+ break;
225
+ case 'INVALID_PASSWORD':
226
+ Return mo2f_lt( 'You already have an account with miniOrange. Please enter a valid password.' );
227
+ break;
228
+ case 'INVALID_REQ':
229
+ Return mo2f_lt( 'Invalid request. Please try again' );
230
+ break;
231
+ case 'INVALID_OTP':
232
+ Return mo2f_lt( 'Invalid OTP. Please try again.' );
233
+ break;
234
+ case 'INVALID_EMAIL_OR_PASSWORD':
235
+ Return mo2f_lt( 'Invalid email or password. Please try again.' );
236
+ break;
237
+ case 'PASSWORDS_MISMATCH':
238
+ Return mo2f_lt( 'Password and Confirm password do not match.' );
239
+ break;
240
+ case 'ENTER_YOUR_EMAIL_PASSWORD':
241
+ Return mo2f_lt( 'Please enter your registered email and password.' );
242
+ break;
243
+ case 'OTP_SENT':
244
+ Return mo2f_lt( 'One Time Passcode has been sent for verification to ' );
245
+ break;
246
+ case 'ERROR_IN_SENDING_OTP_OVER_EMAIL':
247
+ Return mo2f_lt( 'There was an error in sending OTP over email. Please click on Resend OTP to try again.' );
248
+ break;
249
+ case 'ERROR_DURING_REGISTRATION':
250
+ Return mo2f_lt( 'Error occured while registration. Please try again.' );
251
+ break;
252
+ case 'ERROR_DURING_PROCESS':
253
+ Return mo2f_lt( 'An error occured while processing your request. Please Try again.' );
254
+ break;
255
+ case 'ERROR_DURING_PROCESS_EMAIL':
256
+ Return mo2f_lt( 'An error occured while processing your request. Please check your SMTP server is configured.' );
257
+ break;
258
+ case 'ERROR_WHILE_SENDING_SMS':
259
+ Return mo2f_lt( 'There was an error in sending sms. Please click on Resend OTP to try again.' );
260
+ break;
261
+ case 'ERROR_DURING_USER_REGISTRATION':
262
+ Return mo2f_lt( 'Error occurred while registering the user. Please try again.' );
263
+ break;
264
+ case 'VALIDATE_DUO':
265
+ Return mo2f_lt( 'Duo push notification validate successfully.' );
266
+ break;
267
+ case 'SET_AS_2ND_FACTOR':
268
+ Return mo2f_lt( 'is set as your 2 factor authentication method.' );
269
+ break;
270
+ case 'ERROR_WHILE_SAVING_KBA':
271
+ Return mo2f_lt( 'Error occured while saving your kba details. Please try again.' );
272
+ break;
273
+ case 'ANSWER_SECURITY_QUESTIONS':
274
+ Return mo2f_lt( 'Please answer the following security questions.' );
275
+ break;
276
+ case 'RESET_DUO_CONFIGURATON':
277
+ Return mo2f_lt( 'Your Duo configuration has been reset successfully.' );
278
+ break;
279
+ case 'ERROR_FETCHING_QUESTIONS':
280
+ Return mo2f_lt( 'There was an error fetching security questions. Please try again.' );
281
+ break;
282
+ case 'INVALID_ANSWERS':
283
+ Return mo2f_lt( 'Invalid Answers. Please try again.' );
284
+ break;
285
+ case 'MIN_PASS_LENGTH':
286
+ Return mo2f_lt( 'Choose a password with minimum length 6.' );
287
+ break;
288
+ case 'ACCOUNT_RETRIEVED_SUCCESSFULLY':
289
+ Return mo2f_lt( 'Your account has been retrieved successfully.' );
290
+ break;
291
+ case 'DEFAULT_2ND_FACTOR':
292
+ Return mo2f_lt( 'has been set as your default 2nd factor method' );
293
+ break;
294
+ case 'RESENT_OTP':
295
+ Return mo2f_lt( 'Another One Time Passcode has been sent' );
296
+ break;
297
+ case 'VERIFY':
298
+ Return mo2f_lt( 'for verification to' );
299
+ break;
300
+ case 'ERROR_IN_SENDING_EMAIL':
301
+ Return mo2f_lt( 'There was an error in sending email. Please click on Resend OTP to try again.' );
302
+ break;
303
+ case 'EMAIL_IN_USE':
304
+ Return mo2f_lt( 'The email is already used by other user. Please register with other email.' );
305
+ break;
306
+ case 'EMAIL_MANDATORY':
307
+ Return mo2f_lt( 'Please submit your query with email' );
308
+ break;
309
+ case 'ERROR_WHILE_SUBMITTING_QUERY':
310
+ Return mo2f_lt( 'Your query could not be submitted. Please try again.' );
311
+ break;
312
+ case 'QUERY_SUBMITTED_SUCCESSFULLY':
313
+ Return mo2f_lt( 'Thanks for getting in touch! We shall get back to you shortly.' );
314
+ break;
315
+ case 'SETTINGS_SAVED':
316
+ Return mo2f_lt( 'Your settings are saved successfully.' );
317
+ break;
318
+ case 'AUTHENTICATION_FAILED':
319
+ Return mo2f_lt( 'Authentication failed. Please try again to test the configuration.' );
320
+ break;
321
+ case 'REGISTER_WITH_MO':
322
+ Return mo2f_lt( 'Invalid request. Please register with miniOrange before configuring your mobile.' );
323
+ break;
324
+ case 'ENTER_EMAILID':
325
+ Return mo2f_lt( 'Please enter email-id to register.' );
326
+ break;
327
+ case 'ENTER_VALUE':
328
+ Return mo2f_lt( 'Please enter a value to test your authentication.' );
329
+ break;
330
+ case 'ENTER_OTP':
331
+ Return mo2f_lt( 'Please enter the one time passcode below.' );
332
+ break;
333
+ case 'ERROR_IN_SENDING_OTP':
334
+ Return mo2f_lt( 'There was an error in sending one-time passcode. Your transaction limit might have exceeded. Please contact miniOrange or upgrade to our premium plan.' );
335
+ break;
336
+ case 'ERROR_IN_SENDING_OTP_ONPREM':
337
+ Return mo2f_lt( 'There was an error in sending one-time passcode. Please check your SMTP Setup and remaining transactions.' );
338
+ break;
339
+ case 'SMTP_CHECK_FOR_EMAIL_VERIFICATON':
340
+ Return mo2f_lt('Please set your SMTP to get the email to verify the email at the time of login otherwise you will get logged out');
341
+ break;
342
+ case 'PUSH_NOTIFICATION_SENT':
343
+ Return mo2f_lt( 'A Push notification has been sent to your miniOrange Authenticator App.' );
344
+ break;
345
+ case 'ERROR_WHILE_VALIDATING_OTP':
346
+ Return mo2f_lt( 'Error occurred while validating the OTP. Please try again.' );
347
+ break;
348
+ case 'TEST_GAUTH_METHOD':
349
+ Return mo2f_lt( 'to test Google Authenticator method.' );
350
+ break;
351
+ case 'ERROR_IN_SENDING_OTP_CAUSES':
352
+ Return mo2f_lt( 'Error occurred while validating the OTP. Please try again. Possible causes:' );
353
+ break;
354
+ case 'APP_TIME_SYNC':
355
+ Return mo2f_lt( 'Your App Time is not in sync.Go to settings and tap on tap on Sync Time now .' );
356
+ break;
357
+ case 'SERVER_TIME_SYNC':
358
+ Return mo2f_lt( 'Please make sure your System and device have the same time as the displayed Server time.' );
359
+ break;
360
+ case 'ERROR_WHILE_VALIDATING_USER':
361
+ Return mo2f_lt( 'Error occurred while validating the user. Please try again.' );
362
+ break;
363
+ case 'ONLY_DIGITS_ALLOWED':
364
+ Return mo2f_lt( 'Only digits are allowed. Please enter again.' );
365
+ break;
366
+ case 'TEST_AUTHY_2FA':
367
+ Return mo2f_lt( 'to test Authy 2-Factor Authentication method.' );
368
+ break;
369
+ case 'METHOD':
370
+ Return mo2f_lt( 'method.' );
371
+ break;
372
+ case 'TO_TEST':
373
+ Return mo2f_lt( 'to test' );
374
+ break;
375
+ case 'SET_2FA':
376
+ Return mo2f_lt( 'is set as your Two-Factor method.' );
377
+ break;
378
+
379
+ case 'SET_2FA_otp':
380
+ Return mo2f_lt( 'is set as your Two-Factor method.' );
381
+ break;
382
+
383
+
384
+ case 'VERIFICATION_EMAIL_SENT':
385
+ Return mo2f_lt( 'A verification email is sent to' );
386
+ break;
387
+ case 'ACCEPT_LINK_TO_VERIFY_EMAIL':
388
+ Return mo2f_lt( 'Please click on accept link to verify your email.' );
389
+ break;
390
+ case 'ACCOUNT_CREATED':
391
+ Return mo2f_lt( 'Your account has been created successfully.' );
392
+ break;
393
+ case 'ACCOUNT_REMOVED':
394
+ Return mo2f_lt( 'Your account has been removed. Please contact your administrator.' );
395
+ break;
396
+ case 'REGISTRATION_SUCCESS':
397
+ Return mo2f_lt( 'You are registered successfully.' );
398
+ break;
399
+ case 'DENIED_REQUEST':
400
+ Return mo2f_lt( 'You have denied the request.' );
401
+ break;
402
+ case 'DENIED_DUO_REQUEST':
403
+ Return mo2f_lt( 'You have denied the request or you have not set duo push notification yet' );
404
+ break;
405
+ case 'DISABLED_2FA':
406
+ Return mo2f_lt( 'Two-Factor plugin has been disabled.' );
407
+ break;
408
+ case 'ERROR_WHILE_SAVING_SETTINGS':
409
+ Return mo2f_lt( 'Error occurred while saving the settings.Please try again.' );
410
+ break;
411
+ case 'INVALID_REQUEST':
412
+ Return mo2f_lt( 'Invalid request. Please register with miniOrange and configure 2-Factor to save your login settings.' );
413
+ break;
414
+ case 'ACCOUNT_ALREADY_EXISTS':
415
+ Return mo2f_lt( 'You already have an account with miniOrange, please sign in.' );
416
+ break;
417
+ case 'CONFIGURE_2FA':
418
+ Return mo2f_lt( 'to configure another 2 Factor authentication method.' );
419
+ break;
420
+ case 'PHONE_NOT_CONFIGURED':
421
+ Return mo2f_lt( 'Your phone number is not configured. Please configure it before selecting OTP Over SMS as your 2-factor method.' );
422
+ break;
423
+ case 'CLICK_HERE':
424
+ Return mo2f_lt( 'Click Here' );
425
+ break;
426
+ case 'ERROR_CREATE_ACC_OTP':
427
+ Return mo2f_lt( 'An error occured while creating your account. Please try again by sending OTP again.' );
428
+ break;
429
+ case 'LOGIN_WITH_2ND_FACTOR':
430
+ Return mo2f_lt( 'Please disable 2FA prompt on WP login page to enable Login with 2nd facor only.' );
431
+ break;
432
+ case 'USER_LIMIT_EXCEEDED':
433
+ Return mo2f_lt( 'Your limit of 3 users has exceeded. Please upgrade to premium plans for more users.' );
434
+ break;
435
+ default:
436
+ return $text;
437
+ }
438
+ }
439
+ }
440
+
441
+ new Mo2fConstants;
handler/twofa/two_fa_get_details.php CHANGED
@@ -1,24 +1,24 @@
1
- <?php
2
-
3
- class two_fa_get_details {
4
-
5
- function getUserMethod($userid){
6
- $userMethod = get_user_meta($userid,'currentMethod',true);
7
- return $userMethod;
8
- }
9
- function setUserMethod($userid,$currentMethod){
10
- $response= update_user_meta($userid,'currentMethod',$currentMethod);
11
- return $response;
12
- }
13
-
14
- function setUserEmail($userid,$email){
15
- $response= update_user_meta($userid,'email',$email);
16
- return $response;
17
- }
18
-
19
- function getUserEmail($userid){
20
- $userEmail = get_user_meta($userid , 'email',true);
21
- return $userEmail;
22
-
23
- }
24
  }
1
+ <?php
2
+
3
+ class two_fa_get_details {
4
+
5
+ function getUserMethod($userid){
6
+ $userMethod = get_user_meta($userid,'currentMethod',true);
7
+ return $userMethod;
8
+ }
9
+ function setUserMethod($userid,$currentMethod){
10
+ $response= update_user_meta($userid,'currentMethod',$currentMethod);
11
+ return $response;
12
+ }
13
+
14
+ function setUserEmail($userid,$email){
15
+ $response= update_user_meta($userid,'email',$email);
16
+ return $response;
17
+ }
18
+
19
+ function getUserEmail($userid){
20
+ $userEmail = get_user_meta($userid , 'email',true);
21
+ return $userEmail;
22
+
23
+ }
24
  }
handler/twofa/two_fa_pass2login.php CHANGED
@@ -1,3526 +1,3526 @@
1
- <?php
2
- /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
- * Copyright (C) 2015 miniOrange
4
- *
5
- * This program is free software: you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, either version 3 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>
17
- * @package miniOrange OAuth
18
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
- */
20
- /**
21
- * This library is miniOrange Authentication Service.
22
- * Contains Request Calls to Customer service.
23
- **/
24
-
25
- include 'two_fa_login.php';
26
- class Miniorange_Password_2Factor_Login {
27
-
28
- private $mo2f_kbaquestions;
29
- private $mo2f_userID;
30
- private $mo2f_rbastatus;
31
- private $mo2f_transactionid;
32
-
33
- function mo2f_inline_login(){
34
- global $moWpnsUtility;
35
- $email = sanitize_email( $_POST['email'] );
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');
43
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
44
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
45
- return;
46
- }
47
- $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
48
- }
49
- function mo2f_inline_register(){
50
- global $moWpnsUtility, $Mo2fdbQueries;
51
- $email = sanitize_email($_POST['email']);
52
- $company = $_SERVER["SERVER_NAME"];
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
- {
62
- $login_message=MoWpnsMessages::showMessage('PASS_LENGTH');
63
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
64
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
65
- }
66
- if( $password != $confirmPassword )
67
- {
68
- $login_message=MoWpnsMessages::showMessage('PASS_MISMATCH');
69
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
70
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
71
- }
72
- if( MoWpnsUtility::check_empty_or_null( $email ) || MoWpnsUtility::check_empty_or_null( $password )
73
- || MoWpnsUtility::check_empty_or_null( $confirmPassword ) )
74
- {
75
- $login_message=MoWpnsMessages::showMessage('REQUIRED_FIELDS');
76
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
77
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
78
- }
79
-
80
- update_option( 'mo2f_email', $email );
81
-
82
- update_option( 'mo_wpns_company' , $company );
83
-
84
- update_option( 'mo_wpns_password' , $password );
85
-
86
- $customer = new MocURL();
87
- $content = json_decode($customer->check_customer($email), true);
88
- $Mo2fdbQueries->insert_user( $user_id );
89
- switch ($content['status'])
90
- {
91
- case 'CUSTOMER_NOT_FOUND':
92
- $customerKey = json_decode($customer->create_customer($email, $company, $password, $phone = '', $first_name = '', $last_name = ''), true);
93
-
94
- if(strcasecmp($customerKey['status'], 'SUCCESS') == 0)
95
- {
96
- $this->inline_save_success_customer_config($user_id,$email, $customerKey['id'], $customerKey['apiKey'], $customerKey['token'], $customerKey['appSecret']);
97
- $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
98
- }
99
-
100
- break;
101
- default:
102
- $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
103
- break;
104
- }
105
-
106
- }
107
-
108
- function mo2f_download_backup_codes_inline(){
109
- $nonce = sanitize_text_field($_POST['mo2f_inline_backup_nonce']);
110
- $backups= sanitize_text_field($_POST['mo2f_inline_backup_codes']);
111
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-backup-nonce' ) ) {
112
- $error = new WP_Error();
113
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
114
- return $error;
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);
124
- }
125
- }
126
-
127
- function mo2f_goto_wp_dashboard(){
128
- global $Mo2fdbQueries;
129
- $nonce = sanitize_text_field($_POST['mo2f_inline_wp_dashboard_nonce']);
130
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-wp-dashboard-nonce' ) ) {
131
- $error = new WP_Error();
132
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
133
- return $error;
134
- } else {
135
- $pass2fa= new Miniorange_Password_2Factor_Login();
136
- $pass2fa->mo2fa_pass2login(esc_url_raw($_POST['redirect_to']),sanitize_text_field($_POST['session_id']));
137
- exit;
138
- }
139
- }
140
-
141
- function mo2f_use_backup_codes($POSTED){
142
- $nonce = sanitize_text_field($POSTED['miniorange_backup_nonce']);
143
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-backup-nonce' ) ) {
144
- $error = new WP_Error();
145
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
146
- return $error;
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';
153
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
154
- }
155
- }
156
-
157
- function check_backup_codes_validation($POSTED){
158
- global $Mo2fdbQueries;
159
- $nonce = sanitize_text_field($POSTED['miniorange_validate_backup_nonce']);
160
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
161
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-validate-backup-nonce' ) ) {
162
- $error = new WP_Error();
163
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
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';
173
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
174
- }
175
- $backup_codes=get_user_meta($currentuser_id,'mo2f_backup_codes',true);
176
- $mo2f_backup_code= sanitize_text_field($POSTED[ 'mo2f_backup_code' ]);
177
- $mo2f_backup_code=md5($mo2f_backup_code);
178
- if(!empty($backup_codes)){
179
- if(in_array($mo2f_backup_code,$backup_codes)){
180
- foreach ($backup_codes as $key => $value) {
181
- if($value==$mo2f_backup_code){
182
- unset($backup_codes[$key]);
183
- update_user_meta($currentuser_id,'mo2f_backup_codes', $backup_codes);
184
- }
185
- }
186
-
187
- if(sizeof($backup_codes) <= 2){
188
- $codes_remaining = sizeof($backup_codes);
189
- $mo2f_user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser_id );
190
- if(empty($mo2f_user_email)){
191
- $currentuser = get_user_by( 'id', $currentuser_id );
192
- $mo2f_user_email = $currentuser->user_email;
193
- }
194
- $subject = '2-Factor Authentication(Backup Codes)';
195
- $headers = array('Content-Type: text/html; charset=UTF-8');
196
- $message = MO2f_Utility::get_codes_warning_email_content($codes_remaining);
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';
204
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
205
- }
206
- }else{
207
- $mo2fa_login_message = __('There are no codes left.','miniorange-2-factor-authentication');
208
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
209
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
210
- }
211
- }else{
212
- $this->remove_current_activity($session_id_encrypt);
213
- return new WP_Error('invalid_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') . '</strong>: ' . __('Please try again..', 'miniorange-2-factor-authentication'));
214
- }
215
- }
216
- }
217
-
218
- function mo2f_create_backup_codes(){
219
- $nonce = sanitize_text_field($_POST['miniorange_generate_backup_nonce']);
220
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-generate-backup-nonce' ) ) {
221
- $error = new WP_Error();
222
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
223
- return $error;
224
- }else {
225
- global $Mo2fdbQueries;
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);
233
- $str1="";
234
- for ($x = 0; $x < 5; $x++) {
235
- $str = $codes[$x];
236
- $str1.=$str;
237
- if($x != 4){
238
- $str1.=',';
239
- }
240
- }
241
- update_user_meta($id,'mo2f_backup_codes', $codes_hash);
242
- $key = get_option( 'mo2f_encryption_key' );
243
- $codes_encrypt = MO2f_Utility::encrypt_data($str1, $key);
244
- update_user_meta($id,'chqwetcsdvnvd', $codes_encrypt);
245
-
246
- $mo2f_user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $id );
247
- if(empty($mo2f_user_email)){
248
- $currentuser = get_user_by( 'id', $id );
249
- $mo2f_user_email = $currentuser->user_email;
250
- }
251
- $result = MO2f_Utility::mo2f_email_backup_codes($codes, $mo2f_user_email);
252
- update_user_meta($id, 'mo_backup_code_generated', 1);
253
-
254
- $mo2fa_login_message = "An email containing the backup codes has been sent. Please click on Use backup codes to login using the backup codes.";
255
- $mo2fa_login_status = sanitize_text_field($_POST['login_status']);
256
-
257
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null ,$session_id);
258
- }
259
- }
260
-
261
- function inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt)
262
- {
263
- global $Mo2fdbQueries;
264
- $customer = new MocURL();
265
-
266
- $content = $customer->get_customer_key($email, $password);
267
- $customerKey = json_decode($content, true);
268
- if(json_last_error() == JSON_ERROR_NONE)
269
- {
270
- if(isset($customerKey['phone'])){
271
- update_option( 'mo_wpns_admin_phone', $customerKey['phone'] );
272
- $Mo2fdbQueries->update_user_details( $user_id, array( 'mo2f_user_phone' => $customerKey['phone'] ) );
273
- }
274
- update_option('mo2f_email',$email);
275
- $this->inline_save_success_customer_config($user_id,$email, $customerKey['id'], $customerKey['apiKey'], $customerKey['token'], $customerKey['appSecret']);
276
- $login_message=MoWpnsMessages::showMessage('REG_SUCCESS');
277
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
278
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
279
- }
280
- else
281
- {
282
- $Mo2fdbQueries->update_user_details( $user_id, array( 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_VERIFY_CUSTOMER' ) );
283
- $login_message=MoWpnsMessages::showMessage('ACCOUNT_EXISTS');
284
- $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
285
- $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
286
- }
287
- }
288
-
289
- function inline_save_success_customer_config($user_id,$email, $id, $apiKey, $token, $appSecret)
290
- {
291
- global $Mo2fdbQueries;
292
- update_option( 'mo2f_customerKey' , $id );
293
- update_option( 'mo2f_api_key' , $apiKey );
294
- update_option( 'mo2f_customer_token' , $token );
295
- update_option( 'mo2f_app_secret' , $appSecret );
296
- update_option( 'mo_wpns_enable_log_requests' , true );
297
- update_option( 'mo2f_miniorange_admin', $id );
298
- update_option( 'mo_2factor_admin_registration_status', 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' );
299
- update_option( 'mo_2factor_user_registration_status', 'MO_2_FACTOR_PLUGIN_SETTINGS' );
300
- $Mo2fdbQueries->update_user_details( $user_id, array(
301
- 'mo2f_user_email' =>$email
302
- ) );
303
- }
304
- function mo2f_inline_validate_otp(){
305
- if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
306
- $nonce = sanitize_text_field($_POST['miniorange_inline_validate_otp_nonce']);
307
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-otp-nonce' ) ) {
308
- $error = new WP_Error();
309
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
310
- return $error;
311
- } else {
312
- global $Mo2fdbQueries;
313
- $this->miniorange_pass2login_start_session();
314
- $otp_token = '';
315
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
316
- $mo2fa_login_message = '';
317
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
318
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
319
- if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
320
- $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
321
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
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
-
330
- if($selected_2factor_method == 'OTP Over Telegram')
331
- {
332
-
333
- $userID = $current_user;
334
- $otp = $otp_token;
335
- $otpToken = get_user_meta($userID,'mo2f_otp_token',true);
336
- $time = get_user_meta($userID,'mo2f_telegram_time',true);
337
- $accepted_time = time()-300;
338
- $time = (int)$time;
339
-
340
-
341
- if($otp == $otpToken)
342
- {
343
- if($accepted_time<$time){
344
- update_user_meta($userID,'mo2f_chat_id',get_user_meta($userID,'mo2f_temp_chatID',true));
345
- delete_user_meta($userID,'mo2f_temp_chatID');
346
- delete_user_meta($userID,'mo2f_otp_token');
347
- delete_user_meta($userID,'mo2f_telegram_time');
348
- $Mo2fdbQueries->update_user_details($userID, array(
349
- "mo2f_configured_2FA_method" => 'OTP Over Telegram',
350
- 'mo2f_OTPOverTelegram_config_status' => true,
351
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
352
- ) );
353
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
354
- }
355
- else
356
- {
357
- delete_user_meta($userID,'mo2f_otp_token');
358
- delete_user_meta($userID,'mo2f_telegram_time');
359
- $mo2fa_login_message = __('OTP has been expired please initiate a new transaction by clicking on verify button.','miniorange-2-factor-authentication');
360
- }
361
- }
362
- else
363
- {
364
- $mo2fa_login_message = __('Invalid OTP. Please try again.','miniorange-2-factor-authentication');
365
- }
366
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
367
- }
368
-
369
- $user_phone = $Mo2fdbQueries->get_user_detail('mo2f_user_phone',$current_user);
370
- $customer = new Customer_Setup();
371
- $content = json_decode($customer->validate_otp_token( $selected_2factor_method, null, get_user_meta($current_user,'mo2f_transactionId',true), $otp_token, get_site_option('mo2f_customerKey'), get_site_option('mo2f_api_key') ),true);
372
- if($content['status'] == 'ERROR'){
373
- $mo2fa_login_message = Mo2fConstants::langTranslate($content['message']);
374
- }else if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated
375
- $phone = get_user_meta($current_user,'mo2f_user_phone',true) ;
376
- if($user_phone && strlen($user_phone) >= 4){
377
- if($phone != $user_phone ){
378
-
379
- $Mo2fdbQueries->update_user_details( $current_user, array(
380
- 'mobile_registration_status' =>false
381
- ) );
382
- }
383
- }
384
-
385
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user);
386
- if(!($Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user)=='OTP OVER EMAIL')){
387
- $Mo2fdbQueries->update_user_details( $current_user, array(
388
- 'mo2f_OTPOverSMS_config_status' =>true,
389
- 'mo2f_user_phone' =>$phone
390
- ) );
391
- }else{
392
- $Mo2fdbQueries->update_user_details( $current_user, array('mo2f_email_otp_registration_status'=>true) );
393
-
394
- }
395
- $Mo2fdbQueries->update_user_details($current_user, array(
396
- "mo2f_configured_2FA_method" => 'OTP Over SMS',
397
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
398
- ) );
399
- $TwoF_setup = new Two_Factor_Setup();
400
- $response = json_decode($TwoF_setup->mo2f_update_userinfo($email,'SMS',null,null,null),true);
401
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
402
-
403
- }else{ // OTP Validation failed.
404
- $mo2fa_login_message = __('Invalid OTP. Please try again.','miniorange-2-factor-authentication');
405
- }
406
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
407
- }
408
- }
409
-
410
- }
411
- function mo2f_inline_send_otp(){
412
- if(isset($_POST['miniorange_inline_verify_phone_nonce'])){
413
- $nonce = sanitize_text_field($_POST['miniorange_inline_verify_phone_nonce']);
414
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-verify-phone-nonce' ) ) {
415
- $error = new WP_Error();
416
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
417
- return $error;
418
- } else {
419
- global $Mo2fdbQueries;
420
- $this->miniorange_pass2login_start_session();
421
- if(isset($_POST['verify_phone']))
422
- $phone = sanitize_text_field( $_POST['verify_phone'] );
423
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
424
-
425
- $current_user = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
426
-
427
-
428
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
429
- $customer = new Customer_Setup();
430
- $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
431
- $parameters = array();
432
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user);
433
-
434
- $mo2fa_login_message = '';
435
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
436
- if($selected_2factor_method=='SMS' || $selected_2factor_method=='PHONE VERIFICATION' ||$selected_2factor_method== 'SMS AND EMAIL'){
437
- $phone = sanitize_text_field( $_POST['verify_phone'] );
438
- if( MO2f_Utility::mo2f_check_empty_or_null( $phone ) ){
439
- $mo2fa_login_message = __('Please enter your phone number.','miniorange-2-factor-authentication');
440
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
441
- }
442
- $phone = str_replace(' ', '', $phone);
443
- update_user_meta($current_user,'mo2f_user_phone',$phone);
444
- }
445
- if($selected_2factor_method == 'OTP_OVER_SMS' || $selected_2factor_method == 'SMS' ){
446
- $currentMethod = "SMS";
447
- }else if($selected_2factor_method == 'SMS AND EMAIL'){
448
- $currentMethod = "OTP_OVER_SMS_AND_EMAIL";
449
- $parameters = array("phone" => $phone, "email" => $email);
450
- }else if($selected_2factor_method == 'PHONE VERIFICATION'){
451
- $currentMethod = "PHONE_VERIFICATION";
452
- }else if($selected_2factor_method == 'OTP OVER EMAIL'){
453
- $currentMethod = "OTP_OVER_EMAIL";
454
- $parameters = $email;
455
- }
456
-
457
- else if($selected_2factor_method == 'OTP Over Telegram')
458
- {
459
- $currentMethod = "OTP Over Telegram";
460
- $user_id = $current_user;
461
- $chatID = sanitize_text_field($_POST['verify_chatID']);
462
- $otpToken = '';
463
- for($i=1;$i<7;$i++)
464
- {
465
- $otpToken .= rand(0,9);
466
- }
467
-
468
- update_user_meta($user_id,'mo2f_otp_token',$otpToken);
469
- update_user_meta($user_id,'mo2f_telegram_time',time());
470
- update_user_meta($user_id,'mo2f_temp_chatID',$chatID);
471
- $url = 'https://sitestats.xecurify.com/teleTest/send_otp.php';
472
- $postdata = array( 'mo2f_otp_token' => $otpToken,
473
- 'mo2f_chatid' => $chatID
474
- );
475
-
476
- $handle = curl_init();
477
-
478
- curl_setopt_array($handle,
479
- array(
480
- CURLOPT_URL => $url,
481
- CURLOPT_POST => true,
482
- CURLOPT_POSTFIELDS => $postdata,
483
- CURLOPT_RETURNTRANSFER => true,
484
- CURLOPT_SSL_VERIFYHOST => FALSE,
485
- CURLOPT_SSL_VERIFYPEER => FALSE,
486
-
487
- )
488
- );
489
-
490
- $data = curl_exec($handle);
491
- curl_close($handle);
492
- if($data == 'SUCCESS')
493
- $mo2fa_login_message = 'An OTP has been sent to your given chat ID. Please enter it below for verification.';
494
- else
495
- $mo2fa_login_message = 'There were an erroe while sending the OTP. Please confirm your chatID and try again.';
496
-
497
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
498
-
499
- }
500
- if($selected_2factor_method == 'SMS AND EMAIL'){
501
- $content = json_decode($customer->send_otp_token($parameters,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
502
- }
503
- else if($selected_2factor_method == 'OTP OVER EMAIL'){
504
- $content = json_decode($customer->send_otp_token($email,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
505
- }
506
- else{
507
- $content = json_decode($customer->send_otp_token($phone,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
508
-
509
- }
510
- if(json_last_error() == JSON_ERROR_NONE) { /* Generate otp token */
511
- if($content['status'] == 'ERROR'){
512
- $mo2fa_login_message = Mo2fConstants::langTranslate($content['message']);
513
- }else if($content['status'] == 'SUCCESS'){
514
- update_user_meta($current_user,'mo2f_transactionId',$content['txId']);
515
- if($selected_2factor_method == 'SMS'){
516
- if(get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')>0)
517
- update_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z',get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')-1);
518
- $mo2fa_login_message = __('The One Time Passcode has been sent to','miniorange-2-factor-authentication'). $phone . '.' . __('Please enter the one time passcode below to verify your number.','miniorange-2-factor-authentication');
519
- }else if($selected_2factor_method == 'SMS AND EMAIL'){
520
- $mo2fa_login_message = 'The One Time Passcode has been sent to ' . $parameters["phone"] . ' and '. $parameters["email"] . '. Please enter the one time passcode sent to your email and phone to verify.';
521
- }else if($selected_2factor_method == 'OTP OVER EMAIL'){
522
- $mo2fa_login_message = __('The One Time Passcode has been sent to ','miniorange-2-factor-authentication') . $parameters . '.' . __('Please enter the one time passcode sent to your email to verify.','miniorange-2-factor-authentication');
523
- }else if($selected_2factor_method== 'PHONE VERIFICATION'){
524
- $mo2fa_login_message = __('You will receive a phone call on this number ','miniorange-2-factor-authentication') . $phone . '.' . __('Please enter the one time passcode below to verify your number.','miniorange-2-factor-authentication');
525
- }
526
- }else if($content['status'] == 'FAILED'){
527
- $mo2fa_login_message = __($content['message'],'miniorange-2-factor-authentication');
528
- }else{
529
- $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
530
- }
531
- }else{
532
- $mo2fa_login_message = __('Invalid request. Please try again','miniorange-2-factor-authentication');
533
- }
534
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
535
- }
536
- }
537
-
538
- }
539
- function mo2f_inline_validate_kba(){
540
- if(isset($_POST['mo2f_inline_save_kba_nonce'])){
541
- $nonce = sanitize_text_field($_POST['mo2f_inline_save_kba_nonce']);
542
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-kba-nonce' ) ) {
543
- $error = new WP_Error();
544
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
545
- return $error;
546
- } else {
547
- global $Mo2fdbQueries;
548
- $this->miniorange_pass2login_start_session();
549
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
550
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
551
- $mo2fa_login_message = '';
552
- $mo2fa_login_status = isset($_POST['mo2f_inline_kba_status']) ? 'MO_2_FACTOR_SETUP_SUCCESS' : 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
553
- $temp_array = array(sanitize_text_field($_POST['mo2f_kbaquestion_1']),sanitize_text_field($_POST['mo2f_kbaquestion_2']),sanitize_text_field($_POST['mo2f_kbaquestion_3']));
554
- $kba_questions = array();
555
- foreach($temp_array as $question){
556
- if(MO2f_Utility::mo2f_check_empty_or_null( $question)){
557
- $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
558
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
559
- }else{
560
- $ques = sanitize_text_field($question);
561
- $ques = addcslashes(stripslashes($ques), '"\\');
562
- array_push($kba_questions, $ques);
563
- }
564
- }
565
- if(!(array_unique($kba_questions) == $kba_questions)){
566
- $mo2fa_login_message = __('The questions you select must be unique.','miniorange-2-factor-authentication');
567
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
568
- }
569
- $temp_array_ans = array($_POST['mo2f_kba_ans1'],$_POST['mo2f_kba_ans2'],$_POST['mo2f_kba_ans3']);
570
- $kba_answers = array();
571
- foreach($temp_array_ans as $answer){
572
- if(MO2f_Utility::mo2f_check_empty_or_null( $answer)){
573
- $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
574
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
575
- }else{
576
- $ques = sanitize_text_field($answer);
577
- $answer = strtolower($answer);
578
- array_push($kba_answers, $answer);
579
- }
580
- }
581
- $size = sizeof($kba_questions);
582
- $kba_q_a_list = array();
583
- for($c = 0; $c < $size; $c++){
584
- array_push($kba_q_a_list, $kba_questions[$c]);
585
- array_push($kba_q_a_list, $kba_answers[$c]);
586
- }
587
-
588
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
589
-
590
-
591
- $current_user = get_user_by('id',$user_id);
592
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
593
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
594
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
595
- 'mo2f_SecurityQuestions_config_status' =>true,
596
- 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS'
597
- ) );
598
- if(!MO2F_IS_ONPREM)
599
- {
600
- $kba_q1 = sanitize_text_field($_POST['mo2f_kbaquestion_1']);
601
- $kba_a1 = sanitize_text_field( $_POST['mo2f_kba_ans1'] );
602
- $kba_q2 = sanitize_text_field($_POST['mo2f_kbaquestion_2']);
603
- $kba_a2 = sanitize_text_field( $_POST['mo2f_kba_ans2'] );
604
- $kba_q3 = sanitize_text_field( $_POST['mo2f_kbaquestion_3'] );
605
- $kba_a3 = sanitize_text_field( $_POST['mo2f_kba_ans3'] );
606
-
607
- $kba_q1 = addcslashes( stripslashes( $kba_q1 ), '"\\' );
608
- $kba_q2 = addcslashes( stripslashes( $kba_q2 ), '"\\' );
609
- $kba_q3 = addcslashes( stripslashes( $kba_q3 ), '"\\' );
610
-
611
- $kba_a1 = addcslashes( stripslashes( $kba_a1 ), '"\\' );
612
- $kba_a2 = addcslashes( stripslashes( $kba_a2 ), '"\\' );
613
- $kba_a3 = addcslashes( stripslashes( $kba_a3 ), '"\\' );
614
-
615
- $kba_registration = new Two_Factor_Setup();
616
- $kba_reg_reponse = json_decode( $kba_registration->register_kba_details( $email, $kba_q1, $kba_a1, $kba_q2, $kba_a2, $kba_q3, $kba_a3, $user_id ), true );
617
-
618
- if ( json_last_error() == JSON_ERROR_NONE ) {
619
-
620
- if ( $kba_reg_reponse['status'] == 'SUCCESS' ) {
621
- $response = json_decode( $kba_registration->mo2f_update_userinfo( $email, 'KBA', null, null, null ), true );
622
- }
623
-
624
- }
625
- }
626
-
627
- $kba_q1 = $kba_q_a_list[0];
628
- $kba_a1 = md5($kba_q_a_list[1]);
629
- $kba_q2 = $kba_q_a_list[2];
630
- $kba_a2 = md5($kba_q_a_list[3]);
631
- $kba_q3 = $kba_q_a_list[4];
632
- $kba_a3 = md5($kba_q_a_list[5]);
633
- $question_answer = array($kba_q1 => $kba_a1 ,$kba_q2 => $kba_a2 , $kba_q3 => $kba_a3 );
634
- update_user_meta( $current_user->ID , 'mo2f_kba_challenge', $question_answer );
635
- if(!isset($_POST['mo2f_inline_kba_status'])){
636
- update_user_meta($current_user->ID,'mo2f_2FA_method_to_configure','Security Questions');
637
- $Mo2fdbQueries->update_user_details( $current_user->ID, array( 'mo2f_configured_2FA_method' => 'Security Questions' ) );
638
- }
639
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
640
- }
641
- }
642
- }
643
-
644
- function mo2f_inline_validate_mobile_authentication(){
645
- if(isset($_POST['mo_auth_inline_mobile_registration_complete_nonce'])){
646
- $nonce = sanitize_text_field($_POST['mo_auth_inline_mobile_registration_complete_nonce']);
647
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-mobile-registration-complete-nonce' ) ) {
648
- $error = new WP_Error();
649
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
650
- return $error;
651
- } else {
652
- global $Mo2fdbQueries;
653
- $this->miniorange_pass2login_start_session();
654
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
655
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
656
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
657
-
658
-
659
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
660
- $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
661
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
662
- $mo2fa_login_message = '';
663
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
664
- $enduser = new Two_Factor_Setup();
665
- if($selected_2factor_method == 'SOFT TOKEN')
666
- $selected_2factor_method_onprem = 'miniOrange Soft Token';
667
- else if($selected_2factor_method == 'PUSH NOTIFICATIONS')
668
- $selected_2factor_method_onprem = 'miniOrange Push Notification';
669
- else if($selected_2factor_method == 'MOBILE AUTHENTICATION')
670
- $selected_2factor_method_onprem = 'miniOrange QR Code Authentication';
671
-
672
- $response = json_decode($enduser->mo2f_update_userinfo($email,$selected_2factor_method,null,null,null),true);
673
- if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
674
- if($response['status'] == 'ERROR'){
675
- $mo2fa_login_message = Mo2fConstants::langTranslate($response['message']);
676
- }else if($response['status'] == 'SUCCESS'){
677
- $Mo2fdbQueries->update_user_details( $user_id, array(
678
- 'mobile_registration_status' =>true,
679
- 'mo2f_miniOrangeQRCodeAuthentication_config_status' => true,
680
- 'mo2f_miniOrangeSoftToken_config_status' => true,
681
- 'mo2f_miniOrangePushNotification_config_status' => true,
682
- 'mo2f_configured_2FA_method' =>$selected_2factor_method_onprem ,
683
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
684
- ) );
685
- //
686
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
687
- }else{
688
- $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
689
- }
690
- }else{
691
- $mo2fa_login_message = __('Invalid request. Please try again','miniorange-2-factor-authentication');
692
- }
693
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
694
- }
695
- }
696
-
697
- }
698
-
699
- function mo2f_duo_mobile_send_push_notification_for_inline_form(){
700
- if(isset($_POST['duo_mobile_send_push_notification_inline_form_nonce'])){
701
- $nonce = sanitize_text_field($_POST['duo_mobile_send_push_notification_inline_form_nonce']);
702
- if ( ! wp_verify_nonce( $nonce, 'mo2f-send-duo-push-notification-inline-nonce' ) ) {
703
- $error = new WP_Error();
704
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
705
- return $error;
706
- } else {
707
-
708
- global $Mo2fdbQueries;
709
- $this->miniorange_pass2login_start_session();
710
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
711
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
712
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
713
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
714
-
715
- $Mo2fdbQueries->update_user_details( $user_id, array(
716
- 'mobile_registration_status' =>true,
717
- ) );
718
- $mo2fa_login_message = '';
719
-
720
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
721
-
722
-
723
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
724
-
725
- }
726
- }
727
- }
728
-
729
- function mo2f_inline_validate_duo_authentication(){
730
- if(isset($_POST['mo_auth_inline_duo_auth_mobile_registration_complete_nonce'])){
731
- $nonce = sanitize_text_field($_POST['mo_auth_inline_duo_auth_mobile_registration_complete_nonce']);
732
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-duo_auth-registration-complete-nonce' ) ) {
733
- $error = new WP_Error();
734
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
735
- return $error;
736
- } else {
737
-
738
- global $Mo2fdbQueries;
739
- $this->miniorange_pass2login_start_session();
740
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
741
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
742
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
743
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
744
- $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
745
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
746
- $Mo2fdbQueries->update_user_details( $user_id, array(
747
- 'mobile_registration_status' =>true,
748
- ) );
749
- $mo2fa_login_message = '';
750
-
751
- include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'handler'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_duo_handler.php';
752
- $ikey = get_site_option('mo2f_d_integration_key');
753
- $skey = get_site_option('mo2f_d_secret_key');
754
- $host = get_site_option('mo2f_d_api_hostname');
755
-
756
-
757
-
758
- $duo_preauth = preauth( $email ,true, $skey, $ikey, $host);
759
-
760
-
761
- if(isset($duo_preauth['response']['stat']) && $duo_preauth['response']['stat'] == 'OK'){
762
-
763
- if(isset($duo_preauth['response']['response']['status_msg']) && $duo_preauth['response']['response']['status_msg'] == 'Account is active'){
764
- $mo2fa_login_message = $email.' user is already exists, please go for step B duo will send push notification on your configured mobile.';
765
-
766
- }else if(isset($duo_preauth['response']['response']['enroll_portal_url'])){
767
- $duo_enroll_url = $duo_preauth['response']['response']['enroll_portal_url'];
768
- update_user_meta( $user_id , 'user_not_enroll_on_duo_before', $duo_enroll_url );
769
- update_user_meta( $user_id , 'user_not_enroll', true );
770
-
771
- }else{
772
- $mo2fa_login_message = 'Your account is inactive from duo side, please contact to your administrator.';
773
- }
774
-
775
- }else{
776
- $mo2fa_login_message = 'Error through during preauth.';
777
-
778
- }
779
-
780
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
781
-
782
-
783
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
784
-
785
- }
786
- }
787
- }
788
-
789
- function mo2f_inline_setup_success($current_user_id,$redirect_to,$session_id){
790
- global $Mo2fdbQueries;
791
- $Mo2fdbQueries->update_user_details( $current_user_id, array('mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS') );
792
-
793
- $code_generate = get_user_meta($current_user_id, 'mo_backup_code_generated', true);
794
- if(empty($code_generate)){
795
- $mo2fa_login_message = '';
796
- $mo2fa_login_status = 'MO_2_FACTOR_GENERATE_BACKUP_CODES';
797
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
798
- }else{
799
- $pass2fa= new Miniorange_Password_2Factor_Login();
800
- $pass2fa->mo2fa_pass2login($redirect_to,$session_id);
801
- exit;
802
- }
803
- }
804
-
805
- function mo2f_inline_get_qr_code_for_mobile($email,$id){
806
- $registerMobile = new Two_Factor_Setup();
807
- $content = $registerMobile->register_mobile($email);
808
- $response = json_decode($content, true);
809
- $message = '';
810
- $miniorageqr=array();
811
- if(json_last_error() == JSON_ERROR_NONE) {
812
- if($response['status'] == 'ERROR'){
813
- $miniorageqr['message']=Mo2fConstants::langTranslate($response['message']);;
814
- delete_user_meta( $id, 'miniorageqr' );
815
- }else{
816
- if($response['status'] == 'IN_PROGRESS'){
817
-
818
- $miniorageqr['message']='';
819
- $miniorageqr['mo2f-login-qrCode']=$response['qrCode'];
820
- $miniorageqr['mo2f-login-transactionId']=$response['txId'];
821
- $miniorageqr['mo2f_show_qr_code']='MO_2_FACTOR_SHOW_QR_CODE';
822
- update_user_meta($id,'miniorageqr',$miniorageqr);
823
- }else{
824
- $miniorageqr['message']=__('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
825
- delete_user_meta( $id, 'miniorageqr' );
826
- }
827
- }
828
- }
829
- return $miniorageqr;
830
- }
831
-
832
- function inline_mobile_configure(){
833
- if(isset($_POST['miniorange_inline_show_qrcode_nonce'])){
834
- $nonce = sanitize_text_field($_POST['miniorange_inline_show_qrcode_nonce']);
835
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-show-qrcode-nonce' ) ) {
836
- $error = new WP_Error();
837
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
838
- return $error;
839
- } else {
840
- global $Mo2fdbQueries;
841
- $this->miniorange_pass2login_start_session();
842
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
843
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
844
-
845
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
846
- $current_user = get_user_by('id',$user_id);
847
- $mo2fa_login_message = '';
848
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
849
- $user_registration_status = $Mo2fdbQueries->get_user_detail('mo_2factor_user_registration_status',$current_user->ID);
850
- if($user_registration_status == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') {
851
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
852
- $miniorageqr = $this->mo2f_inline_get_qr_code_for_mobile($email,$current_user->ID);
853
- $mo2fa_login_message=$miniorageqr['message'];
854
- MO2f_Utility::mo2f_set_transient( $session_id_encrypt,'mo2f_transactionId', $miniorageqr['mo2f-login-transactionId'] );
855
-
856
- $this->mo2f_transactionid=$miniorageqr['mo2f-login-transactionId'];
857
- }else{
858
- $mo2fa_login_message = __('Invalid request. Please register with miniOrange before configuring your mobile.','miniorange-2-factor-authentication');
859
- }
860
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,$miniorageqr,$session_id_encrypt);
861
- }
862
- }
863
- }
864
-
865
- function inline_validate_and_set_ga(){
866
- if(isset($_POST['mo2f_inline_validate_ga_nonce'])){
867
- $nonce = sanitize_text_field($_POST['mo2f_inline_validate_ga_nonce']);
868
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-google-auth-nonce' ) ) {
869
- $error = new WP_Error();
870
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
871
- return $error;
872
- } else {
873
- global $Mo2fdbQueries;
874
- $this->miniorange_pass2login_start_session();
875
- $otpToken = sanitize_text_field($_POST['google_auth_code']);
876
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
877
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
878
-
879
-
880
- $current_user = get_user_by('id',$user_id);
881
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
882
- $ga_secret = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'secret_ga');
883
-
884
- $mo2fa_login_message = '';
885
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
886
- if(MO2f_Utility::mo2f_check_number_length($otpToken)){
887
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
888
- $google_auth = new Miniorange_Rba_Attributes();
889
- $google_response = json_decode($google_auth->mo2f_validate_google_auth($email,$otpToken,$ga_secret),true);
890
- if(json_last_error() == JSON_ERROR_NONE) {
891
- if($google_response['status'] == 'SUCCESS'){
892
- $response = $google_response;
893
- if(json_last_error() == JSON_ERROR_NONE || MO2F_IS_ONPREM) {
894
- if($response['status'] == 'SUCCESS'){
895
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
896
- 'mo2f_GoogleAuthenticator_config_status' => true,
897
- 'mo2f_configured_2FA_method' => 'Google Authenticator',
898
- 'mo2f_AuthyAuthenticator_config_status' => false,
899
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS'
900
- ) );
901
-
902
- if(MO2F_IS_ONPREM){
903
- update_user_meta($current_user->ID,'mo2f_2FA_method_to_configure','GOOGLE AUTHENTICATOR');
904
- $gauth_obj= new Google_auth_onpremise();
905
- $gauth_obj->mo_GAuth_set_secret($current_user->ID, $ga_secret);
906
- }
907
- update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
908
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
909
-
910
- //When user sets method of another admin from USers section.
911
- if(!empty(get_user_meta($current_user->ID,'mo2fa_set_Authy_inline'))){
912
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
913
- 'mo2f_GoogleAuthenticator_config_status' => false,
914
- 'mo2f_AuthyAuthenticator_config_status' => true,
915
- 'mo2f_configured_2FA_method' => "Authy Authenticator",
916
- 'user_registration_with_miniorange' => 'SUCCESS',
917
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS'
918
- ) );
919
- update_user_meta( $current_user->ID, 'mo2f_external_app_type', "Authy Authenticator" );
920
- delete_user_meta($current_user->ID ,'mo2fa_set_Authy_inline');
921
- }
922
- }else{
923
- $mo2fa_login_message = __('An error occured while setting up Google/Authy Authenticator. Please Try again.','miniorange-2-factor-authentication');
924
- }
925
- }else{
926
- $mo2fa_login_message = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
927
- }
928
- }else{
929
- $mo2fa_login_message = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
930
- }
931
- }else{
932
- $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
933
- }
934
- }else{
935
- $mo2fa_login_message = __('Only digits are allowed. Please enter again.','miniorange-2-factor-authentication');
936
- }
937
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
938
- }
939
- }
940
- }
941
-
942
- function back_to_select_2fa(){
943
- if( isset($_POST['miniorange_inline_two_factor_setup'])){ /* return back to choose second factor screen */
944
- $nonce = sanitize_text_field($_POST['miniorange_inline_two_factor_setup']);
945
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-setup-nonce' ) ) {
946
- $error = new WP_Error();
947
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
948
- return $error;
949
- } else {
950
- global $Mo2fdbQueries;
951
- $this->miniorange_pass2login_start_session();
952
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
953
-
954
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
955
-
956
-
957
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
958
- $current_user = get_user_by('id',$user_id);
959
- $Mo2fdbQueries->update_user_details( $current_user->ID, array( "mo2f_configured_2FA_method" => '' ) );
960
- $mo2fa_login_message = '';
961
- $mo2fa_login_status ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
962
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
963
- }
964
- }
965
- }
966
-
967
- function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
968
- {
969
- $tempEmail = get_user_meta($current_user_id,'mo2f_email_miniOrange',true);
970
- if(isset($tempEmail) and $tempEmail != '')
971
- $email = $tempEmail;
972
- global $Mo2fdbQueries;
973
-
974
- $enduser = new Two_Factor_Setup();
975
- if($current_user_id == get_option('mo2f_miniorange_admin'))
976
- $email = get_option('mo2f_email');
977
-
978
- $check_user = json_decode( $enduser->mo_check_user_already_exist( $email ), true );
979
-
980
- if(json_last_error() == JSON_ERROR_NONE){
981
-
982
-
983
-
984
- if($check_user['status'] == 'ERROR'){
985
- return $check_user;
986
-
987
- }
988
- else if(strcasecmp($check_user['status' ], 'USER_FOUND') == 0){
989
-
990
- $Mo2fdbQueries->update_user_details( $current_user_id, array(
991
- 'user_registration_with_miniorange' =>'SUCCESS',
992
- 'mo2f_user_email' =>$email,
993
- 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
994
- ) );
995
- update_site_option(base64_encode("totalUsersCloud"),get_site_option(base64_encode("totalUsersCloud"))+1);
996
-
997
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
998
- return $check_user;
999
- }
1000
- else if(strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
1001
- $current_user = get_user_by('id',$current_user_id);
1002
- $content = json_decode($enduser->mo_create_user($current_user,$email), true);
1003
-
1004
- if(json_last_error() == JSON_ERROR_NONE) {
1005
- if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1006
- update_site_option(base64_encode("totalUsersCloud"),get_site_option(base64_encode("totalUsersCloud"))+1);
1007
- $Mo2fdbQueries->update_user_details( $current_user_id, array(
1008
- 'user_registration_with_miniorange' =>'SUCCESS',
1009
- 'mo2f_user_email' =>$email,
1010
- 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
1011
- ) );
1012
-
1013
- $mo2fa_login_message = '';
1014
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1015
- return $check_user;
1016
- }else{
1017
- $check_user['status']='ERROR';
1018
- $check_user['message']='There is an issue in user creation in miniOrange. Please skip and contact miniorange';
1019
- return $check_user;
1020
- }
1021
- }
1022
-
1023
-
1024
- }
1025
- else if(strcasecmp($check_user['status'], 'USER_FOUND_UNDER_DIFFERENT_CUSTOMER') == 0){
1026
- $mo2fa_login_message = __('The email associated with your account is already registered. Please contact your admin to change the email.','miniorange-2-factor-authentication');
1027
- $check_user['status']='ERROR';
1028
- $check_user['message']=$mo2fa_login_message;
1029
- return $check_user;
1030
- }
1031
-
1032
- }
1033
-
1034
- }
1035
- function mo2f_skip_2fa_setup()
1036
- {
1037
- if(isset($_POST['miniorange_skip_2fa_nonce'])){
1038
- $nonce = sanitize_text_field($_POST['miniorange_skip_2fa_nonce']);
1039
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-skip-nonce' ) ) {
1040
- $error = new WP_Error();
1041
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1042
- return $error;
1043
- }
1044
- else{
1045
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1046
- global $Mo2fdbQueries;
1047
- $redirect_to = esc_url_raw($_POST['redirect_to']);
1048
- $session_id_encrypt = sanitize_text_field($session_id_encrypt);
1049
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1050
-
1051
-
1052
- $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_2factor_enable_2fa_byusers' => 0) );
1053
-
1054
- $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
1055
- }
1056
- }
1057
- }
1058
-
1059
- function save_inline_2fa_method(){
1060
- if(isset($_POST['miniorange_inline_save_2factor_method_nonce'])){
1061
- $nonce = sanitize_text_field($_POST['miniorange_inline_save_2factor_method_nonce']);
1062
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-2factor-method-nonce' ) ) {
1063
- $error = new WP_Error();
1064
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1065
- return $error;
1066
- } else {
1067
-
1068
-
1069
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1070
- global $Mo2fdbQueries;
1071
- $this->miniorange_pass2login_start_session();
1072
- $mo2fa_login_message = '';
1073
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1074
-
1075
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1076
-
1077
-
1078
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1079
- $current_user = get_user_by('id',$user_id);
1080
- $currentUserId = $current_user->ID;
1081
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
1082
- $user_registration_with_miniorange = $Mo2fdbQueries->get_user_detail('user_registration_with_miniorange',$current_user->ID);
1083
- if($user_registration_with_miniorange == 'SUCCESS'){
1084
- $selected_method = isset($_POST['mo2f_selected_2factor_method']) ? sanitize_text_field($_POST['mo2f_selected_2factor_method']) : 'NONE';
1085
-
1086
- if($selected_method == 'OUT OF BAND EMAIL'){
1087
- if(!MO2F_IS_ONPREM)
1088
- {
1089
- $current_user = get_userdata($currentUserId);
1090
- $email = $current_user->user_email;
1091
- $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1092
-
1093
- if($response['status']=='ERROR') {
1094
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1095
- $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1096
- }
1097
- else
1098
- {
1099
- $enduser = new Two_Factor_Setup();
1100
-
1101
- $Mo2fdbQueries->update_user_details( $currentUserId, array(
1102
- 'mo2f_email_verification_status' =>true,
1103
- 'mo2f_configured_2FA_method' =>'Email Verification',
1104
- 'mo2f_user_email' => $email
1105
- ) );
1106
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1107
- }
1108
- }
1109
- else
1110
- {
1111
- $enduser = new Two_Factor_Setup();
1112
-
1113
- $Mo2fdbQueries->update_user_details( $currentUserId, array(
1114
- 'mo2f_email_verification_status' =>true,
1115
- 'mo2f_configured_2FA_method' =>'Email Verification',
1116
- 'mo2f_user_email' => $email
1117
- ) );
1118
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1119
- }
1120
- }
1121
- else if($selected_method == 'OTP OVER EMAIL'){
1122
- $email = $current_user->user_email;
1123
- if(!MO2F_IS_ONPREM)
1124
- {
1125
- $current_user = get_userdata($currentUserId);
1126
- $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1127
- if($response['status']=='ERROR') {
1128
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1129
- $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1130
- }
1131
- else
1132
- {
1133
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $current_user->ID );
1134
- if($user_email != '' and !is_null($user_email))
1135
- $email = $user_email;
1136
- $this->mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user);
1137
-
1138
- }
1139
- }
1140
- else
1141
- {
1142
- $this->mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user);
1143
- }
1144
- }else if($selected_method == "GOOGLE AUTHENTICATOR"){
1145
- $this->miniorange_pass2login_start_session();
1146
- $mo2fa_login_message = '';
1147
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1148
- $google_auth = new Miniorange_Rba_Attributes();
1149
-
1150
- $gauth_name= get_site_option('mo2f_google_appname');
1151
- $google_account_name= $gauth_name ? $gauth_name : 'miniOrangeAu';
1152
-
1153
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
1154
-
1155
- if ( MO2F_IS_ONPREM ) { //this should not be here
1156
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1157
- 'mo2f_configured_2FA_method' =>$selected_method,
1158
- ) );
1159
- include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'gaonprem.php';
1160
- $gauth_obj = new Google_auth_onpremise();
1161
-
1162
- $onpremise_secret = $gauth_obj->createSecret();
1163
- $issuer = get_site_option( 'mo2f_GA_account_name', 'miniOrangeAu' );
1164
- $url = $gauth_obj->geturl( $onpremise_secret, $issuer, $email );
1165
- $mo2f_google_auth = array();
1166
- $mo2f_google_auth['ga_qrCode'] = $url;
1167
- $mo2f_google_auth['ga_secret'] = $onpremise_secret;
1168
-
1169
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $onpremise_secret);
1170
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $url);
1171
-
1172
- }else{
1173
- $current_user = get_userdata($currentUserId);
1174
- $email = $current_user->user_email;
1175
- $tempemail = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentUserId );
1176
-
1177
- if(!isset($tempemail) and !is_null($tempemail) and $tempemail != '')
1178
- {
1179
- $email = $tempemail;
1180
- }
1181
-
1182
- $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1183
- if($response['status']=='ERROR') {
1184
- $mo2fa_login_message=$response['message'];
1185
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1186
-
1187
- }else{
1188
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1189
- 'mo2f_configured_2FA_method' =>$selected_method,
1190
- ) );
1191
- $google_response = json_decode( $google_auth->mo2f_google_auth_service( $email, $google_account_name ), true );
1192
- if ( json_last_error() == JSON_ERROR_NONE ) {
1193
- if ( $google_response['status'] == 'SUCCESS' ) {
1194
-
1195
- $mo2f_google_auth = array();
1196
- $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
1197
- $mo2f_google_auth['ga_secret'] = $google_response['secret'];
1198
-
1199
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $mo2f_google_auth['ga_secret']);
1200
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $mo2f_google_auth['ga_qrCode']);
1201
-
1202
- } else {
1203
- $mo2fa_login_message = __( 'Invalid request. Please register with miniOrange to configure 2 Factor plugin.', 'miniorange-2-factor-authentication' );
1204
- }
1205
- }
1206
- }
1207
- }
1208
-
1209
-
1210
- }else if($selected_method == "DUO PUSH NOTIFICATIONS"){
1211
- $this->miniorange_pass2login_start_session();
1212
- $mo2fa_login_message = '';
1213
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1214
-
1215
- $selected_method = "Duo Authenticator";
1216
-
1217
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1218
- 'mo2f_configured_2FA_method' =>$selected_method
1219
- ) );
1220
-
1221
-
1222
-
1223
-
1224
- }
1225
- else{
1226
- //inline for others
1227
- if(!MO2F_IS_ONPREM or $selected_method == 'MOBILE AUTHENTICATION' or $selected_method == 'PUSH NOTIFICATIONS' or $selected_method == 'SOFT TOKEN' )
1228
- {
1229
- $current_user = get_userdata($currentUserId);
1230
- $email = $current_user->user_email;
1231
- $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1232
- if(!is_null($response) && $response['status']=='ERROR') {
1233
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1234
- $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1235
- }
1236
- else {
1237
- if($selected_method == 'OTP OVER TELEGRAM')
1238
- {
1239
- $selected_method = 'OTP Over Telegram';
1240
- }
1241
- $Mo2fdbQueries->update_user_details( $current_user->ID, array('mo2f_configured_2FA_method' =>$selected_method) );
1242
- }
1243
- }else{
1244
- if($selected_method == 'OTP OVER TELEGRAM')
1245
- {
1246
- $selected_method = 'OTP Over Telegram';
1247
- }
1248
- $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1249
- 'mo2f_configured_2FA_method' =>$selected_method,
1250
- ) );
1251
- }
1252
- }
1253
- }else{
1254
- $mo2fa_login_message = __('Invalid request. Please register with miniOrange to configure 2 Factor plugin.','miniorange-2-factor-authentication');
1255
- }
1256
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
1257
- }
1258
- }
1259
- }
1260
-
1261
- function check_kba_validation($POSTED){
1262
- global $moWpnsUtility;
1263
- if ( isset( $POSTED['miniorange_kba_nonce'] ) ) { /*check kba validation*/
1264
- $nonce = $POSTED['miniorange_kba_nonce'];
1265
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' ) ) {
1266
- $error = new WP_Error();
1267
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1268
- return $error;
1269
- }else{
1270
- $this->miniorange_pass2login_start_session();
1271
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1272
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1273
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1274
- if ( isset( $user_id ) ) {
1275
- if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_2'] ) ) {
1276
- MO2f_Utility::mo2f_debug_file('Please provide both the answers of KBA'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1277
- $mo2fa_login_message = 'Please provide both the answers.';
1278
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
1279
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1280
- }
1281
- $otpToken = array();
1282
- $kba_questions = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo_2_factor_kba_questions' );
1283
- $otpToken[0] = $kba_questions[0]['question'];
1284
- $otpToken[1] = sanitize_text_field( $_POST['mo2f_answer_1'] );
1285
- $otpToken[2] = $kba_questions[1]['question'];
1286
- $otpToken[3] = sanitize_text_field( $_POST['mo2f_answer_2'] );
1287
- $check_trust_device = isset( $_POST['mo2f_trust_device'] ) ? sanitize_text_field($_POST['mo2f_trust_device']) : 'false';
1288
- //if the php session folder has insufficient permissions, cookies to be used
1289
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId', $session_id_encrypt );
1290
- MO2f_Utility::mo2f_debug_file('Transaction Id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1291
- $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
1292
- $kba_validate = new Customer_Setup();
1293
- $kba_validate_response = json_decode( $kba_validate->validate_otp_token( 'KBA', null, $mo2f_login_transaction_id, $otpToken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1294
- global $Mo2fdbQueries;
1295
- $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1296
- if ( strcasecmp( $kba_validate_response['status'], 'SUCCESS' ) == 0 ) {
1297
- if ( get_option( 'mo2f_remember_device' ) && $check_trust_device == 'on' ) {
1298
- try {
1299
- mo2f_register_profile( $email, 'true', $mo2f_rba_status );
1300
- } catch ( Exception $e ) {
1301
- echo $e->getMessage();
1302
- }
1303
- MO2f_Utility::mo2f_debug_file('Remeber device logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1304
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1305
- } else {
1306
- MO2f_Utility::mo2f_debug_file('Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1307
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1308
- }
1309
- } else {
1310
- MO2f_Utility::mo2f_debug_file('The answers you have provided for KBA are incorrect'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1311
- $mo2fa_login_message = 'The answers you have provided are incorrect.';
1312
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
1313
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
1314
- }
1315
- } else {
1316
- MO2f_Utility::mo2f_debug_file('User id not found'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1317
- $this->remove_current_activity($session_id_encrypt);
1318
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again..' ) );
1319
- }
1320
- }
1321
- }
1322
- }
1323
- function check_rba_cancalation($POSTED){
1324
- $nonce = sanitize_text_field($POSTED['mo2f_trust_device_cancel_nonce']);
1325
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-cancel-nonce' ) ) {
1326
- $error = new WP_Error();
1327
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1328
- return $error;
1329
- } else {
1330
- $this->miniorange_pass2login_start_session();
1331
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1332
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1333
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1334
- }
1335
- }
1336
- function check_rba_validation($POSTED){
1337
- $nonce = $POSTED['mo2f_trust_device_confirm_nonce'];
1338
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-confirm-nonce' ) ) {
1339
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id'] ): null;
1340
- $this->remove_current_activity($session_id_encrypt);
1341
- $error = new WP_Error();
1342
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR ' ) . '</strong>:' . mo2f_lt( 'Invalid Request.' ) );
1343
- return $error;
1344
- } else {
1345
- $this->miniorange_pass2login_start_session();
1346
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1347
- try {
1348
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1349
- Global $Mo2fdbQueries;
1350
- $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1351
- $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
1352
- mo2f_register_profile( $email, 'true', $mo2f_rba_status );
1353
- } catch ( Exception $e ) {
1354
- echo $e->getMessage();
1355
- }
1356
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1357
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1358
- }
1359
- }
1360
-
1361
- function miniorange2f_back_to_inline_registration($POSTED)
1362
- {
1363
- $nonce = sanitize_text_field($_POST['miniorange_back_inline_reg_nonce']);
1364
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-back-inline-reg-nonce' ) ) {
1365
- $error = new WP_Error();
1366
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1367
- return $error;
1368
- } else {
1369
-
1370
- $session_id_encrypt = sanitize_text_field($POSTED['session_id']);
1371
- $redirect_to = esc_url_raw($POSTED['redirect_to']);
1372
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1373
- $mo2fa_login_message = '';
1374
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
1375
- }
1376
-
1377
- }
1378
-
1379
- function check_miniorange_challenge_forgotphone($POSTED){/*check kba validation*/
1380
- $nonce = sanitize_text_field($_POST['miniorange_forgotphone']);
1381
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
1382
- $error = new WP_Error();
1383
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1384
- return $error;
1385
- } else {
1386
- $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1387
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1388
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1389
- $mo2fa_login_message = '';
1390
- $this->miniorange_pass2login_start_session();
1391
- $customer = new Customer_Setup();
1392
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1393
- Global $Mo2fdbQueries;
1394
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1395
- $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1396
- if ( $kba_configuration_status ) {
1397
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
1398
- $pass2fa_login = new Miniorange_Password_2Factor_Login();
1399
- $pass2fa_login->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1400
- } else {
1401
- $hidden_user_email = MO2f_Utility::mo2f_get_hidden_email( $user_email );
1402
- $content = json_decode( $customer->send_otp_token( $user_email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1403
- if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1404
- $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1405
- MO2f_Utility::unset_session_variables( $session_cookie_variables );
1406
- MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1407
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1408
- //if the php session folder has insufficient permissions, cookies to be used
1409
- MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_login_message', 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.' );
1410
- MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_transactionId', $content['txId'] );
1411
- $this->mo2f_transactionid=$content['txId'];
1412
- $mo2fa_login_message = 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.';
1413
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
1414
- } else {
1415
- $mo2fa_login_message = 'Error occurred while sending OTP over email. Please try again.';
1416
- }
1417
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id_encrypt );
1418
- }
1419
- $pass2fa_login = new Miniorange_Password_2Factor_Login();
1420
- $pass2fa_login->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1421
- }
1422
- }
1423
- function check_miniorange_alternate_login_kba($POSTED){
1424
- $nonce = $POSTED['miniorange_alternate_login_kba_nonce'];
1425
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' ) ) {
1426
- $error = new WP_Error();
1427
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1428
- return $error;
1429
- } else {
1430
- $this->miniorange_pass2login_start_session();
1431
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1432
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1433
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1434
- $this->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1435
- }
1436
- }
1437
-
1438
- function check_miniorange_duo_push_validation($POSTED){
1439
- global $moWpnsUtility;
1440
- $nonce = $POSTED['miniorange_duo_push_validation_nonce'];
1441
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-duo-validation-nonce' ) ) {
1442
- $error = new WP_Error();
1443
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1444
- return $error;
1445
- } else {
1446
- $this->miniorange_pass2login_start_session();
1447
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1448
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1449
-
1450
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1451
- if ( get_option( 'mo2f_remember_device' ) ) {
1452
-
1453
- MO2f_Utility::mo2f_debug_file('Remember device- Duo push notification logged in successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1454
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1455
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null,$session_id_encrypt );
1456
- } else {
1457
- MO2f_Utility::mo2f_debug_file('Duo push notification - Logged in successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1458
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1459
- }
1460
-
1461
- }
1462
- }
1463
-
1464
- function check_miniorange_duo_push_validation_failed($POSTED){
1465
- global $moWpnsUtility;
1466
- $nonce = $POSTED['miniorange_duo_push_validation_failed_nonce'];
1467
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-duo-push-validation-failed-nonce' ) ) {
1468
- $error = new WP_Error();
1469
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1470
- return $error;
1471
- } else {
1472
- MO2f_Utility::mo2f_debug_file('Denied duo push notification'.' User_IP-'.$moWpnsUtility->get_client_ip());
1473
- $this->miniorange_pass2login_start_session();
1474
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1475
- $this->remove_current_activity($session_id_encrypt);
1476
-
1477
- }
1478
-
1479
- }
1480
-
1481
- function check_miniorange_mobile_validation($POSTED){
1482
- /*check mobile validation */
1483
- global $moWpnsUtility;
1484
- $nonce = $POSTED['miniorange_mobile_validation_nonce'];
1485
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-nonce' ) ) {
1486
- $error = new WP_Error();
1487
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1488
- return $error;
1489
- } else {
1490
- if(MO2F_IS_ONPREM && (isset($POSTED['tx_type']) && $POSTED['tx_type'] !='PN'))
1491
- {
1492
- $txid = $POSTED['TxidEmail'];
1493
- $status = get_option($txid);
1494
- if($status != '')
1495
- {
1496
- if($status != 1)
1497
- {
1498
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1499
- }
1500
- }
1501
- }
1502
- $this->miniorange_pass2login_start_session();
1503
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1504
- //if the php session folder has insufficient permissions, cookies to be used
1505
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1506
- MO2f_Utility::mo2f_debug_file('Transaction_id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip());
1507
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1508
- $checkMobileStatus = new Two_Factor_Setup();
1509
- $content = $checkMobileStatus->check_mobile_status( $mo2f_login_transaction_id );
1510
- $response = json_decode( $content, true );
1511
- if(MO2F_IS_ONPREM)
1512
- {
1513
- MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip());
1514
- $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
1515
- }
1516
- if ( json_last_error() == JSON_ERROR_NONE ) {
1517
- if ( $response['status'] == 'SUCCESS' ) {
1518
- if ( get_option( 'mo2f_remember_device' ) ) {
1519
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1520
- MO2f_Utility::mo2f_debug_file('Remember device flow prompted'.' User_IP-'.$moWpnsUtility->get_client_ip());
1521
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null,$session_id_encrypt );
1522
- } else {
1523
- MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip());
1524
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1525
- }
1526
- } else {
1527
- MO2f_Utility::mo2f_debug_file('Invalid_username'.' User_IP-'.$moWpnsUtility->get_client_ip());
1528
- $this->remove_current_activity($session_id_encrypt);
1529
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1530
- }
1531
- } else {
1532
- MO2f_Utility::mo2f_debug_file('Invalid_username'.' User_IP-'.$moWpnsUtility->get_client_ip());
1533
- $this->remove_current_activity($session_id_encrypt);
1534
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1535
- }
1536
- }
1537
- }
1538
- function check_miniorange_mobile_validation_failed($POSTED){
1539
- /*Back to miniOrange Login Page if mobile validation failed and from back button of mobile challenge, soft token and default login*/
1540
- $nonce = $POSTED['miniorange_mobile_validation_failed_nonce'];
1541
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-failed-nonce' ) ) {
1542
- $error = new WP_Error();
1543
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1544
- return $error;
1545
- } else {
1546
- MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth denied.');
1547
- $this->miniorange_pass2login_start_session();
1548
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1549
- $this->remove_current_activity($session_id_encrypt);
1550
-
1551
- }
1552
- }
1553
-
1554
- function check_mo2f_duo_authenticator_success_form($POSTED){
1555
- if(isset($POSTED['mo2f_duo_authenticator_success_nonce'])){
1556
- $nonce = sanitize_text_field($POSTED['mo2f_duo_authenticator_success_nonce']);
1557
- if ( ! wp_verify_nonce( $nonce, 'mo2f-duo-authenticator-success-nonce' ) ) {
1558
- $error = new WP_Error();
1559
- $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1560
- return $error;
1561
- } else {
1562
-
1563
- global $Mo2fdbQueries;
1564
- $this->miniorange_pass2login_start_session();
1565
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1566
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1567
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1568
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1569
- $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
1570
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
1571
- $mo2fa_login_message = '';
1572
-
1573
-
1574
- delete_user_meta($user_id,'user_not_enroll');
1575
- delete_site_option('current_user_email');
1576
- $Mo2fdbQueries->update_user_details( $user_id, array(
1577
- 'mobile_registration_status' =>true,
1578
- 'mo2f_DuoAuthenticator_config_status' => true,
1579
- 'mo2f_configured_2FA_method' =>$selected_2factor_method ,
1580
- 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
1581
- ) );
1582
- $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1583
-
1584
-
1585
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
1586
-
1587
- }
1588
- }
1589
- }
1590
- function check_inline_mo2f_duo_authenticator_error($POSTED){
1591
- $nonce = $POSTED['mo2f_inline_duo_authentcator_error_nonce'];
1592
-
1593
- if ( ! wp_verify_nonce( $nonce, 'mo2f-inline-duo-authenticator-error-nonce' ) ) {
1594
- $error = new WP_Error();
1595
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1596
-
1597
- return $error;
1598
- } else {
1599
- global $Mo2fdbQueries;
1600
- $this->miniorange_pass2login_start_session();
1601
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1602
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1603
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1604
-
1605
-
1606
-
1607
- $Mo2fdbQueries->update_user_details( $user_id, array(
1608
- 'mobile_registration_status' =>false,
1609
- ) );
1610
-
1611
- }
1612
- }
1613
- function check_miniorange_forgotphone($POSTED){
1614
- $nonce = $POSTED['miniorange_forgotphone'];
1615
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
1616
- $error = new WP_Error();
1617
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1618
- return $error;
1619
- } else {
1620
- global $Mo2fdbQueries;
1621
- $mo2fa_login_status = isset( $POSTED['request_origin_method'] ) ? $POSTED['request_origin_method'] : null;
1622
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1623
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1624
- $mo2fa_login_message = '';
1625
- $this->miniorange_pass2login_start_session();
1626
- $customer = new Customer_Setup();
1627
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1628
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1629
- $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1630
- if ( $kba_configuration_status ) {
1631
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
1632
- $pass2fa_login = new Miniorange_Password_2Factor_Login();
1633
- $pass2fa_login->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1634
- } else {
1635
- $hidden_user_email = MO2f_Utility::mo2f_get_hidden_email( $user_email );
1636
- $content = json_decode( $customer->send_otp_token( $user_email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1637
- if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1638
- $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1639
- MO2f_Utility::unset_session_variables( $session_cookie_variables );
1640
- MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1641
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1642
- //if the php session folder has insufficient permissions, cookies to be used
1643
- MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_login_message', 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.' );
1644
- MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_transactionId', $content['txId'] );
1645
- $this->mo2f_transactionid=$content['txId'];
1646
- $mo2fa_login_message = 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.';
1647
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
1648
- } else {
1649
- $mo2fa_login_message = 'Error occurred while sending OTP over email. Please try again.';
1650
- }
1651
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id_encrypt );
1652
- }
1653
- $pass2fa_login = new Miniorange_Password_2Factor_Login();
1654
- $pass2fa_login->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1655
- }
1656
- }
1657
- function check_miniorange_softtoken($POSTED){
1658
- /*Click on the link of phone is offline */
1659
- $nonce = $POSTED['miniorange_softtoken'];
1660
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-softtoken' ) ) {
1661
- $error = new WP_Error();
1662
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1663
- return $error;
1664
- } else {
1665
- $this->miniorange_pass2login_start_session();
1666
- $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1667
- $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1668
- MO2f_Utility::unset_session_variables( $session_cookie_variables );
1669
- MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1670
- MO2f_Utility::unset_temp_user_details_in_table('mo2f_transactionId',$session_id_encrypt );
1671
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1672
- $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
1673
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
1674
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1675
- }
1676
- }
1677
- function check_miniorange_soft_token($POSTED){
1678
- /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
1679
- global $moWpnsUtility;
1680
- $nonce = sanitize_text_field($_POST['miniorange_soft_token_nonce']);
1681
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-soft-token-nonce' ) ) {
1682
- $error = new WP_Error();
1683
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1684
- return $error;
1685
- }else {
1686
- $this->miniorange_pass2login_start_session();
1687
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1688
- $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1689
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1690
- $softtoken = '';
1691
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1692
- $attempts = get_option('mo2f_attempts_before_redirect', 3);
1693
- if ( MO2f_utility::mo2f_check_empty_or_null( $_POST['mo2fa_softtoken'] ) ) {
1694
- if($attempts>1 || $attempts=='disabled')
1695
- {
1696
- update_option('mo2f_attempts_before_redirect', $attempts-1 );
1697
- $mo2fa_login_message = 'Please enter OTP to proceed.';
1698
- MO2f_Utility::mo2f_debug_file('Please enter OTP to proceed'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1699
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1700
- }else{
1701
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1702
- $this->remove_current_activity($session_id_encrypt);
1703
- MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1704
- return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1705
- }
1706
- } else {
1707
- $softtoken = sanitize_text_field( $_POST['mo2fa_softtoken'] );
1708
- if ( ! MO2f_utility::mo2f_check_number_length( $softtoken ) ) {
1709
- if($attempts>1|| $attempts=='disabled')
1710
- {
1711
- update_option('mo2f_attempts_before_redirect', $attempts-1 );
1712
- $mo2fa_login_message = 'Invalid OTP. Only digits within range 4-8 are allowed. Please try again.';
1713
- MO2f_Utility::mo2f_debug_file('Invalid OTP. Only digits within range 4-8 are allowed'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1714
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1715
- }else{
1716
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1717
- $this->remove_current_activity($session_id_encrypt);
1718
- update_option('mo2f_attempts_before_redirect', 3);
1719
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
1720
- $data = array('reload' => "reload", );
1721
- wp_send_json_success($data);
1722
- }
1723
- else{
1724
- MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1725
- return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1726
- }
1727
- }
1728
- }
1729
- }
1730
-
1731
- global $Mo2fdbQueries;
1732
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1733
- if ( isset( $user_id ) ) {
1734
- $customer = new Customer_Setup();
1735
- $content = '';
1736
- $current_user = get_userdata($user_id);
1737
- //if the php session folder has insufficient permissions, cookies to be used
1738
- $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1739
- $mo2f_login_transaction_id = isset($_POST['mo2fa_transaction_id'])?sanitize_text_field($_POST['mo2fa_transaction_id']):MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1740
- MO2f_Utility::mo2f_debug_file('Transaction_id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1741
- if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ) {
1742
- $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 );
1743
- }elseif (isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP' ) {
1744
-
1745
- $otpToken = get_user_meta($current_user->ID,'mo2f_otp_token_wa',true);
1746
- $time = get_user_meta($current_user->ID,'mo2f_whatsapp_time',true);
1747
- $accepted_time = time()-600;
1748
- $time = (int)$time;
1749
- global $Mo2fdbQueries;
1750
-
1751
- if($softtoken == $otpToken)
1752
- {
1753
- if($accepted_time<$time){
1754
- update_option('mo2f_attempts_before_redirect', 3);
1755
- if ( get_option( 'mo2f_remember_device' ) ) {
1756
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1757
- MO2f_Utility::mo2f_debug_file('Remeber device setup'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1758
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1759
- }
1760
- else{
1761
-
1762
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1763
- }
1764
- }
1765
- else
1766
- {
1767
- $this->remove_current_activity($session_id_encrypt);
1768
-
1769
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: OTP has been Expired please reinitiate another transaction.' ) );
1770
-
1771
- }
1772
- }
1773
- else
1774
- {
1775
-
1776
- update_option('mo2f_attempts_before_redirect', $attempts-1);
1777
- $message = 'Invalid OTP please enter again.';
1778
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1779
-
1780
- }
1781
- }
1782
- elseif (isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM' ) {
1783
-
1784
- $otpToken = get_user_meta($current_user->ID,'mo2f_otp_token',true);
1785
- $time = get_user_meta($current_user->ID,'mo2f_telegram_time',true);
1786
- $accepted_time = time()-300;
1787
- $time = (int)$time;
1788
- global $Mo2fdbQueries;
1789
-
1790
- if($softtoken == $otpToken)
1791
- {
1792
- if($accepted_time<$time){
1793
- update_option('mo2f_attempts_before_redirect', 3);
1794
- if ( get_option( 'mo2f_remember_device' ) ) {
1795
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1796
- MO2f_Utility::mo2f_debug_file('Remember device flow'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1797
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1798
- }
1799
- else{
1800
- MO2f_Utility::mo2f_debug_file('OTP over Telegram - Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1801
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1802
- }
1803
- }
1804
- else
1805
- {
1806
- $this->remove_current_activity($session_id_encrypt);
1807
- MO2f_Utility::mo2f_debug_file('OTP has been Expired please reinitiate another transaction'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1808
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: OTP has been Expired please reinitiate another transaction.' ) );
1809
-
1810
- }
1811
- }
1812
- else
1813
- {
1814
- MO2f_Utility::mo2f_debug_file('OTP over Telegram - Invalid OTP'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1815
- update_option('mo2f_attempts_before_redirect', $attempts-1);
1816
- $message = 'Invalid OTP please enter again.';
1817
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1818
-
1819
- }
1820
- }
1821
- else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' ) {
1822
- $content = json_decode( $customer->validate_otp_token( 'SMS', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1823
- } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION' ) {
1824
- $content = json_decode( $customer->validate_otp_token( 'PHONE VERIFICATION', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1825
- } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ) {
1826
- $content = json_decode( $customer->validate_otp_token( 'SOFT TOKEN', $user_email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1827
- } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION' ) {
1828
- $content = json_decode( $customer->validate_otp_token( 'GOOGLE AUTHENTICATOR', $user_email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1829
- } else {
1830
- $this->remove_current_activity($session_id_encrypt);
1831
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Invalid Request. Please try again.' ) );
1832
- }
1833
- if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1834
- update_option('mo2f_attempts_before_redirect', 3);
1835
- if ( get_option( 'mo2f_remember_device' ) ) {
1836
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1837
- MO2f_Utility::mo2f_debug_file('Remember device flow'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1838
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1839
- } else {
1840
- if($mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL')
1841
- {
1842
- $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_configured_2FA_method' =>'OTP Over Email','mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS', 'mo2f_OTPOverEmail_config_status' => 1) );
1843
- $enduser = new Two_Factor_Setup();
1844
-
1845
- $enduser->mo2f_update_userinfo( $user_email, 'OTP Over Email', null, null, null );
1846
-
1847
- }
1848
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1849
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1850
- }
1851
- } else {
1852
- if($attempts>1 || $attempts=='disabled')
1853
- {
1854
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Enter wrong OTP'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1855
- update_option('mo2f_attempts_before_redirect', $attempts-1);
1856
- $message = $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ? 'You have entered an invalid OTP.<br>Please click on <b>Sync Time</b> in the miniOrange Authenticator app to sync your phone time with the miniOrange servers and try again.' : 'Invalid OTP. Please try again.';
1857
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1858
- }else{
1859
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1860
- $this->remove_current_activity($session_id_encrypt);
1861
- update_option('mo2f_attempts_before_redirect', 3);
1862
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
1863
- $data = array('reload' => "reload", );
1864
- wp_send_json_success($data);
1865
- }
1866
- else{
1867
- MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1868
- return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1869
- }
1870
-
1871
- }
1872
- }
1873
- } else {
1874
- $this->remove_current_activity($session_id_encrypt);
1875
- MO2f_Utility::mo2f_debug_file('User id not found'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1876
- return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again..' ) );
1877
- }
1878
- }
1879
- }
1880
- function check_miniorange_attribute_collection($POSTED){
1881
- $nonce = $POSTED['miniorange_attribute_collection_nonce'];
1882
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-attribute-collection-nonce' ) ) {
1883
- $error = new WP_Error();
1884
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1885
- return $error;
1886
- } else {
1887
- $this->miniorange_pass2login_start_session();
1888
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1889
- $currentuser = get_user_by( 'id', $user_id );
1890
- $attributes = isset( $POSTED['miniorange_rba_attribures'] ) ? $POSTED['miniorange_rba_attribures'] : null;
1891
- $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1892
- $session_id = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1893
- $this->miniorange_initiate_2nd_factor( $currentuser, $attributes, $redirect_to,$session_id );
1894
- }
1895
- }
1896
- function check_miniorange_inline_skip_registration($POSTED){
1897
- $error = new WP_Error();
1898
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1899
- }
1900
- function miniorange_pass2login_redirect() {
1901
- do_action('mo2f_network_init');
1902
- global $Mo2fdbQueries;
1903
-
1904
- if ( ! MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option') ) {
1905
- if ( isset( $_POST['miniorange_login_nonce'] ) ) {
1906
- $nonce = sanitize_text_field($_POST['miniorange_login_nonce']);
1907
- $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1908
-
1909
- if(is_null($session_id)) {
1910
- $session_id=$this->create_session();
1911
- }
1912
-
1913
-
1914
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' ) ) {
1915
- $this->remove_current_activity($session_id);
1916
- $error = new WP_Error();
1917
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1918
- return $error;
1919
- } else {
1920
- $this->miniorange_pass2login_start_session();
1921
- $mobile_login = new Miniorange_Mobile_Login();
1922
- //validation and sanitization
1923
- $username = isset( $_POST['mo2fa_username'] ) ? sanitize_text_field($_POST['mo2fa_username']) : '';
1924
- if ( MO2f_Utility::mo2f_check_empty_or_null( $username ) ) {
1925
- MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please enter username to proceed' );
1926
- $mobile_login->mo_auth_show_error_message();
1927
- return;
1928
- } else {
1929
- $username = sanitize_text_field( $_POST['mo2fa_username'] );
1930
- }
1931
- if ( username_exists( $username ) ) { /*if username exists in wp site */
1932
- $user = new WP_User( $username );
1933
- $redirect_to = isset( $_REQUEST['redirect_to'] ) ? esc_url_raw($_REQUEST['redirect_to']) : null;
1934
-
1935
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_current_user_id', $user->ID, 600);
1936
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
1937
-
1938
-
1939
- $this->mo2f_userId=$user->ID;
1940
- $this->fstfactor='VALIDATE_SUCCESS';
1941
- $current_roles = miniorange_get_user_role( $user );
1942
- $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1943
- $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1944
- $mo_2factor_user_registration_status = $Mo2fdbQueries->get_user_detail( 'mo_2factor_user_registration_status', $user->ID );
1945
- $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user->ID );
1946
-
1947
- if(MO2F_IS_ONPREM )
1948
- {
1949
- $mo_2factor_user_registration_status = 'MO_2_FACTOR_PLUGIN_SETTINGS';
1950
-
1951
- }
1952
- if ( $mo2f_configured_2FA_method ) {
1953
- if ( $email && $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS' or (MO2F_IS_ONPREM and $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS')) {
1954
- if ( MO2f_Utility::check_if_request_is_from_mobile_device( $_SERVER['HTTP_USER_AGENT'] ) && $kba_configuration_status ) {
1955
- $this->mo2f_pass2login_kba_verification( $user->ID, $redirect_to, $session_id );
1956
- } else {
1957
- $mo2f_second_factor = '';
1958
-
1959
- if(MO2F_IS_ONPREM)
1960
- {
1961
- global $Mo2fdbQueries;
1962
- $mo2f_second_factor = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1963
- if($mo2f_second_factor == 'Security Questions')
1964
- {
1965
- $mo2f_second_factor = 'KBA';
1966
- }
1967
- else if($mo2f_second_factor == 'Google Authenticator')
1968
- {
1969
- $mo2f_second_factor = 'GOOGLE AUTHENTICATOR';
1970
- }
1971
- else if($mo2f_second_factor == 'Email Verification'){
1972
- $mo2f_second_factor = 'Email Verification';
1973
- }
1974
- else if($mo2f_second_factor == 'OTP Over SMS'){
1975
- $mo2f_second_factor = 'SMS';
1976
- }
1977
- else if($mo2f_second_factor == 'OTP Over Email'){
1978
- $mo2f_second_factor = 'EMAIL';
1979
- }
1980
- elseif($mo2f_second_factor == 'miniOrange Soft Token'){
1981
- $mo2f_second_factor = "SOFT TOKEN";
1982
- }
1983
- else if($mo2f_second_factor == "miniOrange Push Notification"){
1984
- $mo2f_second_factor = "PUSH NOTIFICATIONS";
1985
- }
1986
- else if($mo2f_second_factor == "miniOrange QR Code Authentication"){
1987
- $mo2f_second_factor = "MOBILE AUTHENTICATION";
1988
- }
1989
- }else{
1990
- $mo2f_second_factor = mo2f_get_user_2ndfactor( $user );
1991
- }
1992
- if ( $mo2f_second_factor == 'MOBILE AUTHENTICATION' ) {
1993
- $this->mo2f_pass2login_mobile_verification( $user, $redirect_to, $session_id );
1994
- } else if ( $mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL' ) {
1995
- $this->mo2f_pass2login_push_oobemail_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
1996
- }
1997
- else if($mo2f_second_factor == 'Email Verification'){
1998
- $this->mo2f_pass2login_push_oobemail_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
1999
- }
2000
- else if ( $mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' || $mo2f_second_factor == 'OTP Over Telegram'|| $mo2f_second_factor == 'EMAIL' || $mo2f_second_factor == "OTP Over Email") {
2001
- $this->mo2f_pass2login_otp_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
2002
- } else if ( $mo2f_second_factor == 'KBA' ) {
2003
- $this->mo2f_pass2login_kba_verification( $user->ID, $redirect_to, $session_id );
2004
- } else {
2005
- $this->remove_current_activity($session_id);
2006
- MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please try again or contact your admin.' );
2007
- $mobile_login->mo_auth_show_success_message();
2008
- }
2009
- }
2010
- } else {
2011
- MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please login into your account using password.' );
2012
- $mobile_login->mo_auth_show_success_message('Please login into your account using password.');
2013
- update_user_meta($user->ID,'userMessage','Please login into your account using password.');
2014
- $mobile_login->mo2f_redirectto_wp_login();
2015
- }
2016
- } else {
2017
- MO2f_Utility::set_user_values( $session_id, "mo2f_login_message", 'Please login into your account using password.' );
2018
- $mobile_login->mo_auth_show_success_message('Please login into your account using password.');
2019
- update_user_meta($user->ID,'userMessage','Please login into your account using password.');
2020
- $mobile_login->mo2f_redirectto_wp_login();
2021
- }
2022
- } else {
2023
- $mobile_login->remove_current_activity($session_id);
2024
- MO2f_Utility::set_user_values( $session_id, "mo2f_login_message", 'Invalid Username.' );
2025
- $mobile_login->mo_auth_show_error_message('Invalid Username.');
2026
- }
2027
- }
2028
- }
2029
-
2030
- }
2031
- if(isset($_GET['reconfigureMethod'])){
2032
- $userIDGet = isset($_GET['user_id'])?sanitize_text_field($_GET['user_id']):'';
2033
- $txidGet = isset($_GET['transactionId'])?sanitize_text_field($_GET['transactionId']):'';
2034
- $methodGet = isset($_GET['reconfigureMethod'])?sanitize_text_field($_GET['reconfigureMethod']):'';
2035
- if(get_site_option($txidGet) && get_site_option($userIDGet)){
2036
- $user_id = get_site_option($userIDGet);
2037
- $method = get_site_option($methodGet);
2038
- $Mo2fdbQueries->update_user_details( $user_id, array(
2039
- 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS',
2040
- 'mo2f_configured_2FA_method' => $method
2041
- ) );
2042
- $is_Authy_configured = $Mo2fdbQueries->get_user_detail('mo2f_AuthyAuthenticator_config_status',$user_id);
2043
- if($method == 'Google Authenticator' || $is_Authy_configured){
2044
- update_user_meta($user_id,'mo2fa_set_Authy_inline',true);
2045
- }
2046
- }else{
2047
- $head = "You are not authorized to perform this action";
2048
- $body = "Please contact to your admin";
2049
- $this->display_email_verification($head,$body,'red');
2050
- exit();
2051
- }
2052
- delete_site_option($userIDGet);
2053
- delete_site_option($txidGet);
2054
- }
2055
- if(isset($_GET['Txid'])&&isset($_GET['accessToken']))
2056
- {
2057
- $userIDGet = sanitize_text_field($_GET['userID']);
2058
- $txIdGet = sanitize_text_field($_GET['Txid']);
2059
- $otpToken = get_site_option($userIDGet);
2060
- $txidstatus = get_site_option($txIdGet);
2061
- $userIDd = $userIDGet.'D';
2062
- $otpTokenD = get_site_option($userIDd);
2063
- $mo2f_dirName = dirname(__FILE__);
2064
- $mo2f_dirName = explode('wp-content', $mo2f_dirName);
2065
- $mo2f_dirName = explode('handler', $mo2f_dirName[1]);
2066
-
2067
- $head = "You are not authorized to perform this action";
2068
- $body = "Please contact to your admin";
2069
- $color = "red";
2070
- if(3 == $txidstatus)
2071
- {
2072
- $time = "time".$txIdGet;
2073
- $currentTimeInMillis = round(microtime(true) * 1000);
2074
- $generatedTimeINMillis = get_site_option($time);
2075
- $difference = ($currentTimeInMillis-$generatedTimeINMillis)/1000 ;
2076
- if($difference <= 300)
2077
- {
2078
- $accessTokenGet = sanitize_text_field($_GET['accessToken']);
2079
- if( $accessTokenGet == $otpToken)
2080
- {
2081
- update_site_option($txIdGet,1);
2082
- $body = "Transaction has been successfully validated.<br><br>Please continue with the transaction.";
2083
- $head = "TRANSACTION SUCCESSFUL";
2084
- $color = "green";
2085
- }
2086
- else if($accessTokenGet==$otpTokenD)
2087
- {
2088
- update_site_option($txIdGet,0);
2089
- $body = "Transaction has been Canceled.<br><br>Please Try Again.";
2090
- $head = "TRANSACTION DENIED";
2091
- }
2092
- }
2093
- delete_site_option($userIDGet);
2094
- delete_site_option($userIDd);
2095
- delete_site_option($time);
2096
-
2097
- }
2098
-
2099
- $this->display_email_verification($head,$body,$color);
2100
- exit;
2101
-
2102
- }
2103
- elseif (isset($_POST['emailInlineCloud'])) {
2104
- $nonce = sanitize_text_field($_POST['miniorange_emailChange_nonce']);
2105
- if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-email-change-nonce' ) ) {
2106
- $error = new WP_Error();
2107
- $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
2108
- return $error;
2109
- } else {
2110
- $email = sanitize_text_field($_POST['emailInlineCloud']);
2111
- $current_user_id = sanitize_text_field($_POST['current_user_id']);
2112
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
2113
- $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
2114
- if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
2115
- global $Mo2fdbQueries;
2116
- $Mo2fdbQueries->update_user_details( $current_user_id, array( "mo2f_user_email" => $email, "mo2f_configured_2FA_method" => '' ) );
2117
- prompt_user_to_select_2factor_mthod_inline($current_user_id,'MO_2_FACTOR_INITIALIZE_TWO_FACTOR','',$redirect_to,$session_id_encrypt,null);
2118
- }
2119
- }
2120
- }
2121
- else if(isset($_POST['txid']))
2122
- {
2123
- $txidpost = sanitize_text_field($_POST['txid']);
2124
- $status = get_site_option($txidpost);
2125
- update_option('optionVal1',$status); //??
2126
- if($status ==1 || $status ==0)
2127
- delete_site_option($txidpost);
2128
- echo $status;
2129
- exit();
2130
- }
2131
-
2132
-
2133
-
2134
- else{
2135
-
2136
- $value=isset($_POST['option'])?sanitize_text_field($_POST['option']):false;
2137
-
2138
- switch ($value) {
2139
- case 'miniorange_rba_validate':
2140
- $this->check_rba_validation($_POST);
2141
- break;
2142
-
2143
- case 'miniorange_rba_cancle':
2144
-
2145
- $this->check_rba_cancalation($_POST);
2146
- break;
2147
-
2148
- case 'miniorange_forgotphone':
2149
- $this->check_miniorange_challenge_forgotphone($_POST);
2150
- break;
2151
-
2152
- case 'miniorange2f_back_to_inline_registration':
2153
- $this->miniorange2f_back_to_inline_registration($_POST);
2154
- exit;
2155
-
2156
- case 'miniorange_alternate_login_kba':
2157
-
2158
- $this->check_miniorange_alternate_login_kba($_POST);
2159
- break;
2160
-
2161
- case 'miniorange_kba_validate':
2162
- $this->check_kba_validation($_POST);
2163
-
2164
- break;
2165
-
2166
- case 'miniorange_mobile_validation':
2167
- $this->check_miniorange_mobile_validation($_POST);
2168
- break;
2169
-
2170
- case 'miniorange_duo_push_validation':
2171
- $this->check_miniorange_duo_push_validation($_POST);
2172
- break;
2173
-
2174
- case 'mo2f_inline_duo_authenticator_success_form':
2175
- $this->check_mo2f_duo_authenticator_success_form($_POST);
2176
- break;
2177
-
2178
- case 'mo2f_inline_duo_authenticator_error':
2179
- $this->check_inline_mo2f_duo_authenticator_error($_POST);
2180
- break;
2181
-
2182
- case 'miniorange_mobile_validation_failed':
2183
- $this->check_miniorange_mobile_validation_failed($_POST);
2184
- break;
2185
-
2186
- case 'miniorange_duo_push_validation_failed':
2187
- $this->check_miniorange_duo_push_validation_failed($_POST);
2188
- break;
2189
-
2190
- case 'miniorange_softtoken':
2191
- $this->check_miniorange_softtoken($_POST);
2192
-
2193
- break;
2194
-
2195
-
2196
- case 'miniorange_soft_token':
2197
-
2198
- $this->check_miniorange_soft_token($_POST);
2199
- break;
2200
-
2201
- case 'miniorange_inline_skip_registration':
2202
- $this->check_miniorange_inline_skip_registration($_POST);
2203
- break;
2204
-
2205
- case 'miniorange_attribute_collection':
2206
- $this->check_miniorange_attribute_collection($_POST);
2207
- break;
2208
-
2209
- case 'miniorange_inline_save_2factor_method':
2210
- $this->save_inline_2fa_method();
2211
- break;
2212
-
2213
- case 'mo2f_skip_2fa_setup':
2214
- $this->mo2f_skip_2fa_setup();
2215
- break;
2216
-
2217
- case 'miniorange_back_inline':
2218
- $this->back_to_select_2fa();
2219
- break;
2220
-
2221
- case 'miniorange_inline_ga_validate':
2222
- $this->inline_validate_and_set_ga();
2223
- break;
2224
-
2225
- case 'miniorange_inline_show_mobile_config':
2226
- $this->inline_mobile_configure();
2227
- break;
2228
-
2229
- case 'miniorange_inline_complete_mobile':
2230
- $this->mo2f_inline_validate_mobile_authentication();
2231
- break;
2232
- case 'miniorange_inline_duo_auth_mobile_complete':
2233
- $this->mo2f_inline_validate_duo_authentication();
2234
- break;
2235
- case 'duo_mobile_send_push_notification_for_inline_form':
2236
- $this->mo2f_duo_mobile_send_push_notification_for_inline_form();
2237
- break;
2238
- case 'mo2f_inline_kba_option':
2239
- $this->mo2f_inline_validate_kba();
2240
- break;
2241
-
2242
- case 'miniorange_inline_complete_otp_over_sms':
2243
- $this->mo2f_inline_send_otp();
2244
- break;
2245
-
2246
- case 'miniorange_inline_complete_otp':
2247
- $this->mo2f_inline_validate_otp();
2248
- break;
2249
-
2250
- case 'miniorange_inline_login':
2251
- $this->mo2f_inline_login();
2252
- break;
2253
- case 'miniorange_inline_register':
2254
- $this->mo2f_inline_register();
2255
- break;
2256
- case 'mo2f_users_backup1':
2257
- $this->mo2f_download_backup_codes_inline();
2258
- break;
2259
- case 'mo2f_goto_wp_dashboard':
2260
- $this->mo2f_goto_wp_dashboard();
2261
- break;
2262
- case 'miniorange_backup_nonce':
2263
- $this->mo2f_use_backup_codes($_POST);
2264
- break;
2265
- case 'miniorange_validate_backup_nonce':
2266
- $this->check_backup_codes_validation($_POST);
2267
- break;
2268
- case 'miniorange_create_backup_codes':
2269
- $this->mo2f_create_backup_codes();
2270
- break;
2271
- default:
2272
- $error = new WP_Error();
2273
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
2274
-
2275
- return $error;
2276
- break;
2277
-
2278
-
2279
- }
2280
- }
2281
- }
2282
-
2283
- function deniedMessage($message)
2284
- {
2285
- if(empty($message) && get_option("deniedMessage") )
2286
- {
2287
- delete_option('deniedMessage');
2288
- }
2289
- else
2290
- return $message;
2291
- }
2292
- function remove_current_activity($session_id) {
2293
- global $Mo2fdbQueries;
2294
- $session_variables = array(
2295
- 'mo2f_current_user_id',
2296
- 'mo2f_1stfactor_status',
2297
- 'mo_2factor_login_status',
2298
- 'mo2f-login-qrCode',
2299
- 'mo2f_transactionId',
2300
- 'mo2f_login_message',
2301
- 'mo2f_rba_status',
2302
- 'mo_2_factor_kba_questions',
2303
- 'mo2f_show_qr_code',
2304
- 'mo2f_google_auth',
2305
- 'mo2f_authy_keys'
2306
- );
2307
-
2308
- $cookie_variables = array(
2309
- 'mo2f_current_user_id',
2310
- 'mo2f_1stfactor_status',
2311
- 'mo_2factor_login_status',
2312
- 'mo2f-login-qrCode',
2313
- 'mo2f_transactionId',
2314
- 'mo2f_login_message',
2315
- 'mo2f_rba_status_status',
2316
- 'mo2f_rba_status_sessionUuid',
2317
- 'mo2f_rba_status_decision_flag',
2318
- 'kba_question1',
2319
- 'kba_question2',
2320
- 'mo2f_show_qr_code',
2321
- 'mo2f_google_auth',
2322
- 'mo2f_authy_keys'
2323
- );
2324
-
2325
- $temp_table_variables = array(
2326
- 'session_id',
2327
- 'mo2f_current_user_id',
2328
- 'mo2f_login_message',
2329
- 'mo2f_1stfactor_status',
2330
- 'mo2f_transactionId',
2331
- 'mo_2_factor_kba_questions',
2332
- 'mo2f_rba_status',
2333
- 'ts_created'
2334
- );
2335
-
2336
- MO2f_Utility::unset_session_variables( $session_variables );
2337
- MO2f_Utility::unset_cookie_variables( $cookie_variables );
2338
- $key = get_option( 'mo2f_encryption_key' );
2339
- $session_id = MO2f_Utility::decrypt_data( $session_id, $key );
2340
- $Mo2fdbQueries->save_user_login_details( $session_id, array(
2341
-
2342
- 'mo2f_current_user_id' => '',
2343
- 'mo2f_login_message' => '',
2344
- 'mo2f_1stfactor_status' => '',
2345
- 'mo2f_transactionId' => '',
2346
- 'mo_2_factor_kba_questions' => '',
2347
- 'mo2f_rba_status' => '',
2348
- 'ts_created' => ''
2349
- ) );
2350
-
2351
-
2352
- }
2353
- function mo2f_ultimate_member_custom_login(){
2354
- echo '<div id="mo2f_um_validate_otp" class="um-field um-field-password um-field-user_password um-field-password um-field-type_password" data-key="user_password"><div class="um-field-label"><label for="mo2f_um_validate_otp">Two factor code*</label><div class="um-clear"></div></div><div class="um-field-area"><input class="um-form-field valid " type="text" name="mo2f_validate_otp_token" id="mo2f_um_validate_otp" value="" placeholder="" data-validate="" data-key="user_password">
2355
-
2356
- </div></div>';
2357
- }
2358
-
2359
- public function miniorange_pass2login_start_session() {
2360
- if ( ! session_id() || session_id() == '' || ! isset( $_SESSION ) ) {
2361
- $session_path = ini_get('session.save_path');
2362
- if( is_writable($session_path) && is_readable($session_path) ) {
2363
- if(session_status() != PHP_SESSION_DISABLED )
2364
- session_start();
2365
- }
2366
- }
2367
- }
2368
-
2369
- function mo2f_pass2login_kba_verification( $user_id, $redirect_to, $session_id ) {
2370
- global $Mo2fdbQueries,$LoginuserID;
2371
- $LoginuserID = $user_id;
2372
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
2373
- if(is_null($session_id)) {
2374
- $session_id=$this->create_session();
2375
- }
2376
- if(MO2F_IS_ONPREM){
2377
- $question_answers = get_user_meta($user_id , 'mo2f_kba_challenge', true);
2378
- $challenge_questions = array_keys($question_answers);
2379
- $random_keys = array_rand($challenge_questions,2);
2380
- $challenge_ques1 = $challenge_questions[$random_keys[0]];
2381
- $challenge_ques2 = $challenge_questions[$random_keys[1]];
2382
- $questions[0] = array('question'=>addslashes($challenge_ques1));
2383
- $questions[1] = array('question'=>addslashes($challenge_ques2));
2384
- update_user_meta( $user_id, 'kba_questions_user', $questions );
2385
- $mo2fa_login_message = 'Please answer the following questions:';
2386
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2387
- $mo2f_kbaquestions = $questions;
2388
- MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2389
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2390
- }
2391
-
2392
- else{
2393
- $challengeKba = new Customer_Setup();
2394
- $content = $challengeKba->send_otp_token( $user_email, 'KBA', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2395
- $response = json_decode( $content, true );
2396
- if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2397
- if ( $response['status'] == 'SUCCESS' ) {
2398
- MO2f_Utility::set_user_values( $session_id,"mo2f_transactionId", $response['txId'] );
2399
- $this->mo2f_transactionid = $response['txId'];
2400
- $questions = array();
2401
- $questions[0] = $response['questions'][0];
2402
- $questions[1] = $response['questions'][1];
2403
- MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2404
- $this->mo2f_kbaquestions=$questions;
2405
- $mo2fa_login_message = 'Please answer the following questions:';
2406
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2407
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2408
- } else if ( $response['status'] == 'ERROR' ) {
2409
- $this->remove_current_activity($session_id);
2410
- $error = new WP_Error();
2411
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2412
-
2413
- return $error;
2414
- }
2415
- } else {
2416
- $this->remove_current_activity($session_id);
2417
- $error = new WP_Error();
2418
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2419
-
2420
- return $error;
2421
- }
2422
- }
2423
- }
2424
-
2425
- function miniorange_pass2login_form_fields( $mo2fa_login_status = null, $mo2fa_login_message = null, $redirect_to = null, $qrCode = null, $session_id_encrypt=null,$show_back_button =null ,$mo2fa_transaction_id =false ) {
2426
-
2427
- $login_status = $mo2fa_login_status;
2428
- $login_message = $mo2fa_login_message;
2429
- switch ($login_status) {
2430
- case 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION':
2431
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2432
- mo2f_get_qrcode_authentication_prompt( $login_status, $login_message, $redirect_to, $qrCode, $session_id_encrypt, $transactionid );
2433
- exit;
2434
- break;
2435
- case 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN':
2436
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2437
-
2438
-
2439
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2440
- exit;
2441
- break;
2442
- case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL':
2443
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2444
-
2445
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id,$show_back_button ,$mo2fa_transaction_id );
2446
- exit;
2447
- break;
2448
- case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM':
2449
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2450
-
2451
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2452
- exit;
2453
- break;
2454
- case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP':
2455
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2456
-
2457
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2458
- exit;
2459
- break;
2460
- case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS':
2461
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2462
-
2463
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2464
- exit;
2465
- break;
2466
- case 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION':
2467
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2468
-
2469
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2470
- exit;
2471
- break;
2472
- case 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION':
2473
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2474
-
2475
- mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2476
- exit;
2477
- break;
2478
- case 'MO_2_FACTOR_CHALLENGE_DUO_PUSH_NOTIFICATIONS':
2479
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2480
- mo2f_get_duo_push_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id
2481
- );
2482
- exit;
2483
- break;
2484
-
2485
- case 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL':
2486
- mo2f_get_forgotphone_form( $login_status, $login_message, $redirect_to, $session_id_encrypt );
2487
- exit;
2488
- break;
2489
-
2490
- case 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS':
2491
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_transactionId' );
2492
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2493
-
2494
- mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2495
- exit;
2496
- break;
2497
-
2498
- case 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL':
2499
- $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2500
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2501
-
2502
- mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2503
- exit;
2504
- break;
2505
-
2506
- case 'MO_2_FACTOR_RECONFIG_GOOGLE':
2507
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2508
-
2509
- $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_google' );
2510
- exit;
2511
- break;
2512
-
2513
- case 'MO_2_FACTOR_RECONFIG_KBA':
2514
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2515
-
2516
- $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_kba' );
2517
- exit;
2518
- break;
2519
-
2520
- case 'MO_2_FACTOR_SETUP_SUCCESS':
2521
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2522
-
2523
- $this->mo2f_inline_setup_success($user_id,$redirect_to,$session_id_encrypt);
2524
- break;
2525
-
2526
- case 'MO_2_FACTOR_GENERATE_BACKUP_CODES':
2527
- $current_user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2528
-
2529
- mo2f_backup_codes_generate($current_user_id, $redirect_to, $session_id_encrypt);
2530
- exit;
2531
-
2532
- case 'MO_2_FACTOR_CHALLENGE_BACKUP':
2533
- mo2f_backup_form($login_status, $login_message, $redirect_to, $session_id_encrypt);
2534
- exit;
2535
-
2536
- case 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION':
2537
-
2538
- if(MO2F_IS_ONPREM){
2539
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2540
-
2541
- $ques = get_user_meta( $user_id, 'kba_questions_user');
2542
- mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $ques[0] );
2543
- }
2544
- else{
2545
- $kbaquestions = $this->mo2f_kbaquestions ? $this->mo2f_kbaquestions : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo_2_factor_kba_questions');
2546
- mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $kbaquestions );
2547
- }
2548
- exit;
2549
- break;
2550
-
2551
- case 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE':
2552
- mo2f_get_device_form( $redirect_to, $session_id_encrypt );
2553
- exit;
2554
- break;
2555
-
2556
- case 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS':
2557
- $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2558
-
2559
- prompt_user_to_select_2factor_mthod_inline($user_id, $login_status, $login_message,$redirect_to,$session_id_encrypt,$qrCode);
2560
- exit;
2561
- break;
2562
-
2563
- default:
2564
- $this->mo_2_factor_pass2login_show_wp_login_form();
2565
-
2566
- break;
2567
- }
2568
- }
2569
-
2570
- function miniorange_pass2login_check_mobile_status( $login_status ) { //mobile authentication
2571
- if ( $login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION' ) {
2572
- return true;
2573
- }
2574
-
2575
- return false;
2576
- }
2577
-
2578
- function miniorange_pass2login_check_otp_status( $login_status, $sso = false ) {
2579
- if ( $login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' || $login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' || $login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' || $login_status == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION' || $login_status == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION' ) {
2580
- return true;
2581
- }
2582
-
2583
- return false;
2584
- }
2585
-
2586
- function miniorange_pass2login_check_forgotphone_status( $login_status ) { // after clicking on forgotphone link when both kba and email are configured
2587
- if ( $login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL' ) {
2588
- return true;
2589
- }
2590
-
2591
- return false;
2592
- }
2593
-
2594
- function miniorange_pass2login_check_push_oobemail_status( $login_status ) { // for push and out of and email
2595
- if ( $login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL' ) {
2596
- return true;
2597
- }
2598
-
2599
- return false;
2600
- }
2601
-
2602
- function miniorange_pass2login_reconfig_google( $login_status ) {
2603
- if ( $login_status == 'MO_2_FACTOR_RECONFIG_GOOGLE' ) {
2604
- return true;
2605
- }
2606
-
2607
- return false;
2608
- }
2609
-
2610
- function mo2f_redirect_shortcode_addon( $current_user_id, $login_status, $login_message, $identity ) {
2611
-
2612
- do_action( 'mo2f_shortcode_addon', $current_user_id, $login_status, $login_message, $identity );
2613
-
2614
-
2615
- }
2616
-
2617
- function miniorange_pass2login_reconfig_kba( $login_status ) {
2618
- if ( $login_status == 'MO_2_FACTOR_RECONFIG_KBA' ) {
2619
- return true;
2620
- }
2621
-
2622
- return false;
2623
- }
2624
-
2625
- function miniorange_pass2login_check_kba_status( $login_status ) {
2626
- if ( $login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION' ) {
2627
- return true;
2628
- }
2629
-
2630
- return false;
2631
- }
2632
-
2633
- function miniorange_pass2login_check_trusted_device_status( $login_status ) {
2634
-
2635
- if ( $login_status == 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE' ) {
2636
- return true;
2637
- }
2638
-
2639
- return false;
2640
- }
2641
-
2642
- function mo_2_factor_pass2login_woocommerce(){
2643
- ?>
2644
- <input type="hidden" name="mo_woocommerce_login_prompt" value="1">
2645
- <?php
2646
- }
2647
- function mo_2_factor_pass2login_show_wp_login_form() {
2648
-
2649
- $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
2650
- if(is_null($session_id_encrypt)) {
2651
- $session_id_encrypt=$this->create_session();
2652
- }
2653
- if(class_exists('Theme_My_Login'))
2654
- {
2655
- wp_enqueue_script( 'tmlajax_script', plugins_url( 'includes/js/tmlajax.js', dirname(dirname(__FILE__)) ) );
2656
- wp_localize_script( 'tmlajax_script', 'my_ajax_object',
2657
- array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
2658
- }
2659
- if(class_exists('LoginWithAjax')){
2660
- wp_enqueue_script( 'login_with_ajax_script', plugins_url( 'includes/js/login_with_ajax.js', dirname(dirname(__FILE__))));
2661
- wp_localize_script( 'login_with_ajax_script', 'my_ajax_object',
2662
- array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
2663
- }
2664
- ?>
2665
- <p><input type="hidden" name="miniorange_login_nonce"
2666
- value="<?php echo wp_create_nonce( 'miniorange-2-factor-login-nonce' ); ?>"/>
2667
-
2668
- <input type="hidden" id="sessid" name="session_id"
2669
- value="<?php echo $session_id_encrypt; ?>"/>
2670
-
2671
- </p>
2672
-
2673
- <?php
2674
- if ( get_option( 'mo2f_remember_device' ) ) {
2675
- ?>
2676
- <p><input type="hidden" id="miniorange_rba_attribures" name="miniorange_rba_attribures" value=""/></p>
2677
- <?php
2678
- wp_enqueue_script( 'jquery_script', plugins_url( 'includes/js/rba/js/jquery-1.9.1.js', dirname(dirname(__FILE__)) ) );
2679
- wp_enqueue_script( 'flash_script', plugins_url( 'includes/js/rba/js/jquery.flash.js', dirname(dirname(__FILE__)) ) );
2680
- wp_enqueue_script( 'uaparser_script', plugins_url( 'includes/js/rba/js/ua-parser.js', dirname(dirname(__FILE__)) ) );
2681
- wp_enqueue_script( 'client_script', plugins_url( 'includes/js/rba/js/client.js', dirname(dirname(__FILE__)) ) );
2682
- wp_enqueue_script( 'device_script', plugins_url( 'includes/js/rba/js/device_attributes.js', dirname(dirname(__FILE__)) ) );
2683
- wp_enqueue_script( 'swf_script', plugins_url( 'includes/js/rba/js/swfobject.js', dirname(dirname(__FILE__)) ) );
2684
- wp_enqueue_script( 'font_script', plugins_url( 'includes/js/rba/js/fontdetect.js', dirname(dirname(__FILE__)) ) );
2685
- wp_enqueue_script( 'murmur_script', plugins_url( 'includes/js/rba/js/murmurhash3.js', dirname(dirname(__FILE__)) ) );
2686
- wp_enqueue_script( 'miniorange_script', plugins_url( 'includes/js/rba/js/miniorange-fp.js', dirname(dirname(__FILE__)) ) );
2687
- }else{
2688
-
2689
-
2690
- if( MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'site_option'))
2691
- {
2692
- echo "\t<p>\n";
2693
- echo "\t\t<label class=\"mo2f_instuction1\" title=\"".__('If you don\'t have 2-factor authentication enabled for your WordPress account, leave this field empty.','google-authenticator')."\">".__('2 Factor Authentication code*','google-authenticator')."<span id=\"google-auth-info\"></span><br />\n";
2694
- echo "\t\t<input type=\"text\" placeholder=\"No soft Token ? Skip\" name=\"mo_softtoken\" id=\"mo2f_2fa_code\" class=\"mo2f_2fa_code\" value=\"\" size=\"20\" style=\"ime-mode: inactive;\" /></label>\n";
2695
- echo "\t<p class=\"mo2f_instuction2\" style='color:red; font-size:12px;padding:5px'>* Skip the authentication code if it doesn't apply.</p>\n";
2696
- echo "\t</p>\n";
2697
- echo " \r\n";
2698
- echo " \r\n";
2699
- echo "\n";
2700
- }
2701
- }
2702
-
2703
- }
2704
-
2705
- function mo2f_pass2login_mobile_verification( $user, $redirect_to, $session_id_encrypt=null ) {
2706
- global $Mo2fdbQueries,$moWpnsUtility;
2707
- if (is_null($session_id_encrypt)){
2708
- $session_id_encrypt=$this->create_session();
2709
- }
2710
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
2711
- $useragent = $_SERVER['HTTP_USER_AGENT'];
2712
- MO2f_Utility::mo2f_debug_file('Check user agent to check request from mobile device '.$useragent);
2713
- if ( MO2f_Utility::check_if_request_is_from_mobile_device( $useragent ) ) {
2714
- $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
2715
-
2716
- MO2f_Utility::unset_session_variables( $session_cookie_variables );
2717
- MO2f_Utility::unset_cookie_variables( $session_cookie_variables);
2718
- MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt);
2719
-
2720
- $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
2721
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
2722
- MO2f_Utility::mo2f_debug_file('Request from mobile device so promting soft token'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2723
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
2724
- } else {
2725
- $challengeMobile = new Customer_Setup();
2726
- $content = $challengeMobile->send_otp_token( $user_email, 'MOBILE AUTHENTICATION', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2727
- $response = json_decode( $content, true );
2728
- if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2729
- if ( $response['status'] == 'SUCCESS' ) {
2730
- $qrCode = $response['qrCode'];
2731
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionId', $response['txId']);
2732
-
2733
-
2734
- $this->mo2f_transactionid=$response['txId'];
2735
- $mo2fa_login_message = '';
2736
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
2737
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Sent miniOrange QR code Authentication successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2738
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, $qrCode,$session_id_encrypt );
2739
- } else if ( $response['status'] == 'ERROR' ) {
2740
- $this->remove_current_activity($session_id_encrypt);
2741
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' An error occured while processing your request'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2742
- $error = new WP_Error();
2743
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2744
-
2745
- return $error;
2746
- }
2747
- } else {
2748
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' An error occured while processing your request'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2749
- $this->remove_current_activity($session_id_encrypt);
2750
- $error = new WP_Error();
2751
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2752
-
2753
- return $error;
2754
- }
2755
- }
2756
-
2757
- }
2758
-
2759
- function mo2f_pass2login_duo_push_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt ){
2760
- global $Mo2fdbQueries;
2761
- include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'handler'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_duo_handler.php';
2762
- if (is_null($session_id_encrypt)){
2763
- $session_id_encrypt=$this->create_session();
2764
- }
2765
-
2766
- $mo2fa_login_message ='';
2767
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_DUO_PUSH_NOTIFICATIONS';
2768
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
2769
-
2770
- }
2771
-
2772
- function mo2f_pass2login_push_oobemail_verification( $current_user, $mo2f_second_factor, $redirect_to, $session_id=null ) {
2773
-
2774
- global $Mo2fdbQueries,$moWpnsUtility;
2775
- if(is_null($session_id)){
2776
- $session_id=$this->create_session();
2777
- }
2778
- $challengeMobile = new Customer_Setup();
2779
- $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $current_user->ID );
2780
- if(MO2F_IS_ONPREM && $mo2f_second_factor != "PUSH NOTIFICATIONS"){
2781
- MO2f_Utility::mo2f_debug_file('Push notification has sent successfully for '.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2782
- include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'api'.DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
2783
- $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
2784
- $content = $mo2fOnPremRedirect->mo2f_pass2login_push_email_onpremise($current_user, $redirect_to, $session_id );
2785
-
2786
- }else {
2787
- $content = $challengeMobile->send_otp_token( $user_email, $mo2f_second_factor, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2788
- }
2789
- $response = json_decode( $content, true );
2790
- if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2791
- if ( $response['status'] == 'SUCCESS' ) {
2792
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2793
- update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2794
-
2795
- MO2f_Utility::mo2f_debug_file('Push notification has sent successfully for '.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2796
- $this->mo2f_transactionid=$response['txId'];
2797
-
2798
- $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.';
2799
- $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2800
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
2801
- } else if ( $response['status'] == 'ERROR' || $response['status'] == 'FAILED' ) {
2802
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2803
- update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2804
-
2805
- MO2f_Utility::mo2f_debug_file('An error occured while sending push notification-'.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2806
- $this->mo2f_transactionid=$response['txId'];
2807
- $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.';
2808
- $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2809
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2810
- }
2811
- } else {
2812
- MO2f_Utility::mo2f_debug_file('An error occured while processing your request.'. 'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2813
- $this->remove_current_activity($session_id);
2814
- $error = new WP_Error();
2815
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2816
-
2817
- return $error;
2818
- }
2819
- }
2820
-
2821
- function mo2f_pass2login_otp_verification( $user, $mo2f_second_factor, $redirect_to,$session_id=null ) {
2822
- global $Mo2fdbQueries,$moWpnsUtility;
2823
-
2824
- if(is_null($session_id)){
2825
- $session_id=$this->create_session();
2826
- }
2827
- $mo2f_external_app_type = get_user_meta( $user->ID, 'mo2f_external_app_type', true );
2828
- if($mo2f_second_factor == 'EMAIL')
2829
- {
2830
- $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
2831
- $wdewdeqdqq = get_site_option(base64_encode("remainingOTP"));
2832
- if($wdewdeqdqq >get_site_option('EmailTransactionCurrent', 30) or get_site_option(base64_encode("limitReached")))
2833
- {
2834
- update_site_option(base64_encode("remainingOTP"),0);
2835
- }
2836
- }
2837
- else
2838
- $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
2839
- if ( $mo2f_second_factor == 'SOFT TOKEN' ) {
2840
- $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
2841
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
2842
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2843
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2844
- } else if ( $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' ) {
2845
- $mo2fa_login_message ='Please enter the one time passcode shown in the <b> Authenticator</b> app.';
2846
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION';
2847
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2848
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2849
- } elseif ($mo2f_second_factor == 'OTP Over Telegram') {
2850
- $chatID = get_user_meta($user->ID,'mo2f_chat_id',true);
2851
- $otpToken = '';
2852
- for($i=1;$i<7;$i++)
2853
- {
2854
- $otpToken .= rand(0,9);
2855
- }
2856
-
2857
- update_user_meta($user->ID,'mo2f_otp_token',$otpToken);
2858
- update_user_meta($user->ID,'mo2f_telegram_time',time());
2859
-
2860
- $url = 'https://sitestats.xecurify.com/teleTest/send_otp.php';
2861
- $postdata = array( 'mo2f_otp_token' => $otpToken,
2862
- 'mo2f_chatid' => $chatID
2863
- );
2864
-
2865
- $handle = curl_init();
2866
-
2867
- curl_setopt_array($handle,
2868
- array(
2869
- CURLOPT_URL => $url,
2870
- CURLOPT_POST => true,
2871
- CURLOPT_POSTFIELDS => $postdata,
2872
- CURLOPT_RETURNTRANSFER => true,
2873
- CURLOPT_SSL_VERIFYHOST => FALSE,
2874
- CURLOPT_SSL_VERIFYPEER => FALSE,
2875
-
2876
- )
2877
- );
2878
-
2879
- $data = curl_exec($handle);
2880
- curl_close($handle);
2881
- if($data == 'SUCCESS')
2882
- {
2883
- $mo2fa_login_message ='Please enter the one time passcode sent on your<b> Telegram</b> app.';
2884
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM';
2885
- MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2886
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2887
- }
2888
-
2889
- }
2890
- else {
2891
- $challengeMobile = new Customer_Setup();
2892
- $content = '';
2893
- $response = [];
2894
- $otpLIMiTE = 0;
2895
- if(MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option')>0 or $mo2f_second_factor != 'EMAIL')
2896
- {
2897
- if($mo2f_second_factor == 'OTP Over SMS')
2898
- $mo2f_second_factor = 'SMS';
2899
- $content = $challengeMobile->send_otp_token( $mo2f_user_phone, $mo2f_second_factor, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ,$user);
2900
- $response = json_decode( $content, true );
2901
-
2902
- }
2903
- else
2904
- {
2905
- MO2f_Utility::mo2f_debug_file('Error in sending OTP over Email or SMS.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2906
- $response['status'] = 'FAILED';
2907
- $response['message'] = '<p style = "color:red;">OTP limit has been exceeded</p>';
2908
- $otpLIMiTE = 1;
2909
- }
2910
- if ( json_last_error() == JSON_ERROR_NONE ) {
2911
- if ( $response['status'] == 'SUCCESS' ) {
2912
- if($mo2f_second_factor == 'EMAIL')
2913
- {
2914
- MO2f_Utility::mo2f_debug_file(' OTP has been sent successfully over email.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2915
- $cmVtYWluaW5nT1RQ = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
2916
- if($cmVtYWluaW5nT1RQ>0)
2917
- update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
2918
- }
2919
- elseif($mo2f_second_factor == 'SMS')
2920
- {
2921
- MO2f_Utility::mo2f_debug_file(' OTP has been sent successfully over phone.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2922
- $mo2f_sms = get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z');
2923
- if($mo2f_sms>0)
2924
- update_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z',$mo2f_sms-1);
2925
- }
2926
- if(!isset($response['phoneDelivery']['contact']))
2927
- $response['phoneDelivery']['contact'] = '';
2928
- $message = 'The OTP has been sent to ' . MO2f_Utility::get_hidden_phone( $response['phoneDelivery']['contact'] ) . '. Please enter the OTP you received to Validate.';
2929
- update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2930
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2931
-
2932
-
2933
- $this->mo2f_transactionid=$response['txId'];
2934
- $mo2fa_login_message = $message;
2935
- $currentMethod = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
2936
-
2937
- if($currentMethod == 'OTP Over Email')
2938
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
2939
- else
2940
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
2941
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2942
- } else {
2943
-
2944
-
2945
- if($response['message'] == 'TEST FAILED.')
2946
- $response['message'] = 'There is an error in sending the OTP.';
2947
-
2948
- $last_message = 'Or <a href = " https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/initializepayment&requestOrigin=otp_recharge_plan">puchase trascactions</a>';
2949
-
2950
- if($otpLIMiTE ==1)
2951
- $last_message = 'or contact miniOrange';
2952
-
2953
- else if(MO2F_IS_ONPREM and ($mo2f_second_factor == 'OTP Over Email' or $mo2f_second_factor =='EMAIL' or $mo2f_second_factor == 'Email Verification'))
2954
- $last_message = 'Or check your SMTP Server and remaining transacions.';
2955
- else
2956
- $last_message = 'Or check your remaining transacions';
2957
-
2958
- $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;
2959
- if(!isset($response['txId']))
2960
- $response['txId'] = '';
2961
- MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2962
-
2963
-
2964
- $this->mo2f_transactionid=$response['txId'];
2965
- $mo2fa_login_message = $message;
2966
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
2967
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2968
- }
2969
- } else {
2970
- $this->remove_current_activity($session_id);
2971
- $error = new WP_Error();
2972
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2973
- return $error;
2974
- }
2975
- }
2976
- }
2977
-
2978
- function mo2fa_pass2login( $redirect_to = null, $session_id_encrypted=null ) {
2979
- global $Mo2fdbQueries;
2980
- if(empty($this->mo2f_userID)&&empty($this->fstfactor)){
2981
- $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypted, 'mo2f_current_user_id');
2982
- $mo2f_1stfactor_status = MO2f_Utility::mo2f_get_transient( $session_id_encrypted, 'mo2f_1stfactor_status' );
2983
-
2984
-
2985
- } else {
2986
- $user_id=$this->mo2f_userID;
2987
- $mo2f_1stfactor_status=$this->fstfactor;
2988
- }
2989
-
2990
- if ( $user_id && $mo2f_1stfactor_status && ( $mo2f_1stfactor_status == 'VALIDATE_SUCCESS' ) ) {
2991
- $currentuser = get_user_by( 'id', $user_id );
2992
- wp_set_current_user( $user_id, $currentuser->user_login );
2993
- $mobile_login = new Miniorange_Mobile_Login();
2994
- $mobile_login->remove_current_activity($session_id_encrypted);
2995
-
2996
- delete_expired_transients( true );
2997
- delete_site_option($session_id_encrypted);
2998
-
2999
- wp_set_auth_cookie( $user_id, true );
3000
- do_action( 'wp_login', $currentuser->user_login, $currentuser );
3001
- redirect_user_to( $currentuser, $redirect_to );
3002
- exit;
3003
- } else {
3004
- $this->remove_current_activity($session_id_encrypted);
3005
- }
3006
- }
3007
-
3008
- function create_session(){
3009
- global $Mo2fdbQueries;
3010
- $session_id = MO2f_Utility::random_str(20);
3011
- $Mo2fdbQueries->insert_user_login_session($session_id);
3012
- $key = get_option( 'mo2f_encryption_key' );
3013
- $session_id_encrypt = MO2f_Utility::encrypt_data($session_id, $key);
3014
- return $session_id_encrypt;
3015
- }
3016
-
3017
- function miniorange_initiate_2nd_factor( $currentuser, $attributes = null, $redirect_to = null, $otp_token = "",$session_id_encrypt=null ) {
3018
- global $Mo2fdbQueries,$moWpnsUtility;
3019
- MO2f_Utility::mo2f_debug_file('MO initiate 2nd factor'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3020
- $this->miniorange_pass2login_start_session();
3021
- if(is_null($session_id_encrypt)) {
3022
- $session_id_encrypt=$this->create_session();
3023
- }
3024
-
3025
- if(class_exists('UM_Functions'))
3026
- {
3027
- MO2f_Utility::mo2f_debug_file('Using UM login form.');
3028
- if(!isset($_POST['wp-submit']) and isset($_POST['um_request']))
3029
- {
3030
- $meta = get_option('um_role_'.$currentuser->roles[0].'_meta');
3031
- if(isset($meta) and $meta != '')
3032
- {
3033
- if(isset($meta['_um_login_redirect_url']))
3034
- $redirect_to = $meta['_um_login_redirect_url'];
3035
- if($redirect_to == '')
3036
- {
3037
- $redirect_to = get_site_url();
3038
- }
3039
- }
3040
- $login_form_url = '';
3041
- if(isset($_POST['redirect_to']))
3042
- $login_form_url = esc_url_raw($_POST['redirect_to']);
3043
-
3044
- if($login_form_url != '' and !is_null($login_form_url))
3045
- {
3046
- $redirect_to = $login_form_url;
3047
- }
3048
-
3049
- }
3050
-
3051
- }
3052
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
3053
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
3054
-
3055
-
3056
- $this->mo2f_userID=$currentuser->ID;
3057
- $this->fstfactor='VALIDATE_SUCCESS';
3058
-
3059
- $is_customer_admin = true;
3060
-
3061
- $dG90YWxVc2Vyc0Nsb3Vk = get_site_option("dG90YWxVc2Vyc0Nsb3Vk"); //directly added without encoding
3062
- if($dG90YWxVc2Vyc0Nsb3Vk<3)
3063
- $is_customer_admin = true;
3064
-
3065
- $roles = ( array ) $currentuser->roles;
3066
- $twofactor_enabled = 0;
3067
- foreach ( $roles as $role ) {
3068
- if(get_option('mo2fa_'.$role)=='1')
3069
- $twofactor_enabled=1;
3070
- }
3071
- if ($twofactor_enabled!=1 && is_super_admin( $currentuser->ID )){
3072
- if(get_site_option('mo2fa_superadmin')==1){
3073
- $twofactor_enabled=1;
3074
- }
3075
- }
3076
-
3077
- if ( $is_customer_admin && $twofactor_enabled ) {
3078
- $mo_2factor_user_registration_status = $Mo2fdbQueries->get_user_detail( 'mo_2factor_user_registration_status', $currentuser->ID );
3079
- $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $currentuser->ID );
3080
-
3081
- if(MoWpnsUtility::get_mo2f_db_option('mo2f_enable_brute_force', 'get_option')){
3082
- $mo2f_allwed_login_attempts=get_option('mo2f_allwed_login_attempts');
3083
- }else{
3084
- $mo2f_allwed_login_attempts= 'disabled';
3085
- }
3086
- update_user_meta( $currentuser->ID, 'mo2f_user_login_attempts', $mo2f_allwed_login_attempts );
3087
-
3088
- $twofactor_transactions = new Mo2fDB;
3089
- $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($currentuser->ID);
3090
- $tfa_enabled = $Mo2fdbQueries->get_user_detail( 'mo2f_2factor_enable_2fa_byusers', $currentuser->ID );
3091
- if($tfa_enabled == 0 && ($mo_2factor_user_registration_status != 'MO_2_FACTOR_PLUGIN_SETTINGS') && $tfa_enabled != '')
3092
- $exceeded =1;
3093
-
3094
- if ( $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS' ) { //checking if user has configured any 2nd factor method
3095
- $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser->ID );
3096
- try {
3097
- $mo2f_rba_status = mo2f_collect_attributes( $email, stripslashes( $attributes ) ); // Rba flow
3098
- MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_rba_status', $mo2f_rba_status );
3099
- $this->mo2f_rbastatus=$mo2f_rba_status;
3100
- } catch ( Exception $e ) {
3101
- echo $e->getMessage();
3102
- }
3103
-
3104
- if ( $mo2f_rba_status['status'] == 'SUCCESS' && $mo2f_rba_status['decision_flag'] ) {
3105
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3106
- } else if ( ($mo2f_rba_status['status'] == 'DENY' ) && get_option( 'mo2f_rba_installed' ) ) {
3107
-
3108
- $this->mo2f_restrict_access( 'Access_denied' );
3109
- exit;
3110
- } else if ( ($mo2f_rba_status['status'] == 'ERROR') && get_option( 'mo2f_rba_installed' ) ) {
3111
- $this->mo2f_restrict_access( 'Access_denied' );
3112
- exit;
3113
- } else {
3114
-
3115
- $mo2f_second_factor = '';
3116
-
3117
- $mo2f_second_factor = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $currentuser->ID );
3118
-
3119
- if(!MO2F_IS_ONPREM and $mo2f_second_factor!= 'OTP Over Telegram')
3120
- $mo2f_second_factor = mo2f_get_user_2ndfactor( $currentuser );
3121
-
3122
- if($mo2f_second_factor == 'miniOrange Soft Token')
3123
- $mo2f_second_factor = "SOFT TOKEN";
3124
- else if($mo2f_second_factor == "miniOrange Push Notification")
3125
- $mo2f_second_factor = "PUSH NOTIFICATIONS";
3126
- else if($mo2f_second_factor == "miniOrange QR Code Authentication")
3127
- $mo2f_second_factor = "MOBILE AUTHENTICATION";
3128
- else if($mo2f_second_factor == 'Security Questions')
3129
- $mo2f_second_factor = 'KBA';
3130
- else if($mo2f_second_factor == 'Google Authenticator')
3131
- $mo2f_second_factor = 'GOOGLE AUTHENTICATOR';
3132
- else if($mo2f_second_factor == 'OTP Over SMS')
3133
- $mo2f_second_factor = 'SMS';
3134
- else if($mo2f_second_factor == 'Duo Authenticator' || $mo2f_second_factor == 'DUO AUTHENTICATOR')
3135
- $mo2f_second_factor = 'Duo Authenticator';
3136
- else if($mo2f_second_factor == 'OTP Over Email' || $mo2f_second_factor == 'OTP OVER EMAIL' || $mo2f_second_factor == "EMAIL") {
3137
- $mo2f_second_factor = "EMAIL";
3138
-
3139
- if(MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option')<=0)
3140
- {
3141
- update_site_option("bGltaXRSZWFjaGVk",1);
3142
-
3143
- }
3144
- }
3145
-
3146
-
3147
- if((($mo2f_second_factor == 'GOOGLE AUTHENTICATOR') || ($mo2f_second_factor =='SOFT TOKEN') || ($mo2f_second_factor =='AUTHY AUTHENTICATOR')) && MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'site_option')&& !get_option('mo2f_remember_device') && !isset($_POST['mo_woocommerce_login_prompt']) )
3148
- {
3149
- $error=$this->mo2f_validate_soft_token($currentuser, $mo2f_second_factor, $otp_token,$session_id_encrypt, $redirect_to);
3150
- if(is_wp_error( $error))
3151
- {
3152
- return $error;
3153
- }
3154
- }
3155
- else{
3156
-
3157
- if ( MO2f_Utility::check_if_request_is_from_mobile_device( $_SERVER['HTTP_USER_AGENT'] ) && $kba_configuration_status ) {
3158
- $this->mo2f_pass2login_kba_verification( $currentuser->ID, $redirect_to, $session_id_encrypt );
3159
- } else {
3160
-
3161
- if ( $mo2f_second_factor == 'MOBILE AUTHENTICATION' ) {
3162
- $this->mo2f_pass2login_mobile_verification( $currentuser, $redirect_to, $session_id_encrypt );
3163
- } else if ( $mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL' || $mo2f_second_factor == 'Email Verification') {
3164
- MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3165
- $this->mo2f_pass2login_push_oobemail_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3166
- } else if ( $mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' || $mo2f_second_factor == 'EMAIL' ||$mo2f_second_factor == 'OTP Over Telegram'|| $mo2f_second_factor == 'OTP Over Whatsapp') {
3167
- MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3168
- $this->mo2f_pass2login_otp_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3169
- } else if ( $mo2f_second_factor == 'KBA' or $mo2f_second_factor == 'Security Questions') {
3170
- MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3171
- $this->mo2f_pass2login_kba_verification( $currentuser->ID, $redirect_to , $session_id_encrypt );
3172
- }else if ( $mo2f_second_factor == 'Duo Authenticator') {
3173
- MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3174
- $this->mo2f_pass2login_duo_push_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3175
-
3176
- }else if ( $mo2f_second_factor == 'NONE' ) {
3177
- MO2f_Utility::mo2f_debug_file('mo2f_second_factor is NONE'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3178
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request'))
3179
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3180
- else
3181
- return $currentuser;
3182
- } else {
3183
- $this->remove_current_activity($session_id_encrypt);
3184
- $error = new WP_Error();
3185
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3186
- MO2f_Utility::mo2f_debug_file('Two factor method has not been configured '.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3187
- $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Two Factor method has not been configured.', );
3188
- wp_send_json_success($data);
3189
- }
3190
- else{
3191
- MO2f_Utility::mo2f_debug_file('Two factor method has not been configured '.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3192
- $error->add( 'empty_username', __( '<strong>ERROR</strong>: Two Factor method has not been configured.' ) );
3193
- return $error;
3194
- }
3195
- }
3196
- }
3197
- }
3198
-
3199
- }
3200
- }else if(!$exceeded && MoWpnsUtility::get_mo2f_db_option('mo2f_inline_registration', 'site_option')){
3201
- $this->mo2fa_inline( $currentuser, $redirect_to, $session_id_encrypt );
3202
-
3203
- } else {
3204
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request'))
3205
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3206
- else
3207
- return $currentuser;
3208
- }
3209
-
3210
- }else { //plugin is not activated for current role then logged him in without asking 2 factor
3211
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3212
- }
3213
-
3214
- }
3215
-
3216
- function mo2fa_inline($currentuser,$redirect_to,$session_id){
3217
-
3218
- global $Mo2fdbQueries;
3219
- $currentUserId = $currentuser->ID;
3220
- $email = $currentuser->user_email;
3221
- $Mo2fdbQueries->insert_user( $currentUserId, array( 'user_id' => $currentUserId ) );
3222
- $Mo2fdbQueries->update_user_details( $currentUserId, array(
3223
- 'user_registration_with_miniorange' =>'SUCCESS',
3224
- 'mo2f_user_email' =>$email,
3225
- 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
3226
- ) );
3227
-
3228
- $mo2fa_login_message = '';
3229
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3230
-
3231
- $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id);
3232
- }
3233
-
3234
- function mo2f_validate_soft_token($currentuser, $mo2f_second_factor, $softtoken,$session_id_encrypt,$redirect_to = null){
3235
- global $Mo2fdbQueries;
3236
- $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser->ID );
3237
- $customer = new Customer_Setup();
3238
- $content = json_decode( $customer->validate_otp_token( $mo2f_second_factor, $email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
3239
- if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
3240
- if ( get_option( 'mo2f_remember_device' ) ) {
3241
- $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
3242
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null, $session_id_encrypt );
3243
- } else {
3244
- $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3245
- }
3246
- } else {
3247
- if( MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3248
- $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Invalid One Time Passcode.', );
3249
- wp_send_json_success($data);
3250
- }
3251
- else
3252
- return new WP_Error( 'invalid_one_time_passcode', '<strong>ERROR</strong>: Invalid One Time Passcode.');
3253
- }
3254
- }
3255
-
3256
- function mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user)
3257
- {
3258
-
3259
- $challengeMobile = new Customer_Setup();
3260
- $content = '';
3261
- $response = [];
3262
- $otpLIMiTE = 0;
3263
- if(get_site_option("cmVtYWluaW5nT1RQ")>0)
3264
- {
3265
- $content = $challengeMobile->send_otp_token( $email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ,$current_user);
3266
- $response = json_decode( $content, true );
3267
- if(!MO2F_IS_ONPREM)
3268
- {
3269
- if(isset($response['txId'])){
3270
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionid', $response['txId']);
3271
- }
3272
- }
3273
-
3274
- }
3275
- else
3276
- {
3277
- $response['status'] = 'FAILED';
3278
- $response['message'] = '<p style = "color:red;">OTP limit has been exceeded</p>';
3279
- $otpLIMiTE = 1;
3280
- }
3281
- if ( json_last_error() == JSON_ERROR_NONE ) {
3282
- if ( $response['status'] == 'SUCCESS' ) {
3283
- $cmVtYWluaW5nT1RQ = get_site_option("cmVtYWluaW5nT1RQ");
3284
- if($cmVtYWluaW5nT1RQ>0)
3285
- update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
3286
- $mo2fa_login_message = 'An OTP has been sent to '.$email.' please verify to set the two-factor';
3287
- $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
3288
- $mo2fa_transaction_id = isset($response['txId'])?$response['txId']:null;
3289
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt, 1 ,$mo2fa_transaction_id);
3290
- }
3291
- else
3292
- {
3293
- if($response['status'] == 'FAILED' && $response['message'] == 'OTP limit has been exceeded'){
3294
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3295
- $mo2fa_login_message = 'There was an issue while sending the OTP to '.$email.'. Please check your remaining transactions and try again.';
3296
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
3297
- }else if($response['status'] == 'FAILED'){
3298
- $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3299
- $mo2fa_login_message = 'Your SMTP has not been set, please set your SMTP first to get OTP.';
3300
- $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
3301
- }
3302
- }
3303
- }
3304
- }
3305
- function mo2f_restrict_access( $identity ) {
3306
- apply_filters( 'mo2f_rba_addon', $identity );
3307
- exit;
3308
- }
3309
-
3310
- function mo2f_collect_device_attributes_for_authenticated_user( $currentuser, $redirect_to = null ) {
3311
- $session_id=$this->create_session();
3312
- if ( get_option( 'mo2f_remember_device' ) ) {
3313
- $this->miniorange_pass2login_start_session();
3314
- MO2f_Utility::set_user_values( $session_id, "mo2f_current_user_id", $currentuser->ID );
3315
- $this->mo2f_userID=$currentuser->ID;
3316
- mo2f_collect_device_attributes_handler($session_id,$redirect_to );
3317
- exit;
3318
- } else {
3319
- $this->miniorange_initiate_2nd_factor( $currentuser, null, $redirect_to ,null ,$session_id );
3320
- }
3321
- }
3322
-
3323
- function mo2f_check_username_password( $user, $username, $password, $redirect_to = null ) {
3324
- global $Mo2fdbQueries,$moWpnsUtility;
3325
- if ( is_a( $user, 'WP_Error' ) && ! empty( $user ) ) {
3326
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3327
- $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp;Invalid User Credentials', );
3328
- wp_send_json_success($data);
3329
- }
3330
- else
3331
- return $user;
3332
- }
3333
- if($GLOBALS['pagenow'] == 'wp-login.php' && isset($_POST['mo_woocommerce_login_prompt'])){
3334
- return new WP_Error( 'Unauthorized Access.' , '<strong>ERROR</strong>: Access Denied.');
3335
- }
3336
- // if an app password is enabled, this is an XMLRPC / APP login ?
3337
- if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
3338
-
3339
- $currentuser = wp_authenticate_username_password( $user, $username, $password );
3340
- if ( is_wp_error( $currentuser ) ) {
3341
- $this->error = new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
3342
-
3343
- return false;
3344
- } else {
3345
- return $currentuser;
3346
- }
3347
-
3348
- } else {
3349
- $currentuser = wp_authenticate_username_password( $user, $username, $password );
3350
- if ( is_wp_error( $currentuser ) ) {
3351
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3352
- $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Invalid User Credentials', );
3353
- wp_send_json_success($data);
3354
- }
3355
- else{
3356
- $currentuser->add( 'invalid_username_password', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Username or password.' ) );
3357
- MO2f_Utility::mo2f_debug_file('Invalid username and password.'.'User_IP-'.$moWpnsUtility->get_client_ip());
3358
- return $currentuser;
3359
- }
3360
- } else {
3361
-
3362
- $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
3363
- MO2f_Utility::mo2f_debug_file('Username and password validate successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3364
- if(isset($_REQUEST['woocommerce-login-nonce'])){
3365
- MO2f_Utility::mo2f_debug_file('It is a woocommerce login form. Get woocommerce redirectUrl');
3366
- if ( ! empty( $_REQUEST[ 'redirect_to' ] ) ) {
3367
- $redirect_to = wp_unslash( $_REQUEST[ 'redirect_to' ] );
3368
- } elseif ( isset($_REQUEST[ '_wp_http_referer' ]) ) {
3369
- $redirect_to = $_REQUEST[ '_wp_http_referer' ];
3370
- } else {
3371
- $redirect_to = wc_get_page_permalink( 'myaccount' );
3372
- }
3373
- }else{
3374
- $redirect_to = isset($_REQUEST[ 'redirect_to' ]) ? $_REQUEST[ 'redirect_to' ] : (isset($_REQUEST[ 'redirect' ]) ? $_REQUEST[ 'redirect' ] : null);
3375
- }
3376
- $redirect_to = esc_url_raw($redirect_to);
3377
- $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $currentuser->ID );
3378
- $cloud_methods = array("MOBILE AUTHENTICATION","PUSH NOTIFICATIONS","SOFT TOKEN");
3379
- if (MO2F_IS_ONPREM && $mo2f_configured_2FA_method=='Security Questions')
3380
- {
3381
- MO2f_Utility::mo2f_debug_file('Initiating 2nd factor for KBA'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3382
- $this->miniorange_initiate_2nd_factor($currentuser, null , $redirect_to , "" , $session_id );
3383
- }
3384
- else if(MO2F_IS_ONPREM && $mo2f_configured_2FA_method =='Email Verification')
3385
- {
3386
- MO2f_Utility::mo2f_debug_file('Initiating 2nd factor for email verification'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3387
- $this->miniorange_initiate_2nd_factor($currentuser, null , $redirect_to , null ,$session_id );
3388
- }
3389
- else
3390
- {
3391
- if ( empty( $_POST['mo_softtoken'] ) && MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'get_option') && $mo2f_configured_2FA_method && !get_option('mo2f_remember_device') && (($mo2f_configured_2FA_method == 'Google Authenticator') ||($mo2f_configured_2FA_method == 'miniOrange Soft Token') || ($mo2f_configured_2FA_method =='Authy Authenticator')) && get_option('mo2fa_administrator'))
3392
- {
3393
- if(class_exists('UM_Functions')){
3394
- $passcode = isset($_POST[ "mo2f_validate_otp_token" ]) ? $_POST[ "mo2f_validate_otp_token" ] : $_POST['mo_softtoken'];
3395
- if(!is_null($passcode) and !empty($passcode))
3396
- {
3397
- $passcode = sanitize_text_field($passcode);
3398
- $this->miniorange_pass2login_start_session();
3399
- $session_id_encrypt=$this->create_session();
3400
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
3401
- MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
3402
-
3403
- $customer = new Customer_Setup();
3404
- if($mo2f_configured_2FA_method == 'miniOrange Soft Token')
3405
- $method='SOFT TOKEN';
3406
- else if($mo2f_configured_2FA_method == 'Google Authenticator')
3407
- $method = 'GOOGLE AUTHENTICATOR';
3408
- $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$currentuser->ID);
3409
- $content = json_decode($customer->validate_otp_token( $method,$email , null, $passcode, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
3410
-
3411
- if(strcasecmp($content['status'], 'SUCCESS') == 0) {
3412
- $redirect_to = isset($_POST[ 'redirect_to' ]) ? esc_url_raw($_POST[ 'redirect_to' ]) : null;
3413
-
3414
- $this->mo2fa_pass2login($redirect_to, $session_id_encrypt);
3415
- }
3416
- else
3417
- {
3418
- $error = new WP_Error();
3419
- $error->add('WRONG PASSCODE:', __('<strong>Wrong Two-factor Authentication code.</strong>'));
3420
- return $error;
3421
- }
3422
-
3423
-
3424
- }
3425
- else
3426
- {
3427
- $error = new WP_Error();
3428
- $error->add('EMPTY PASSCODE:', __('<strong>Empty Two-factor Authentication code.</strong>'));
3429
- return $error;
3430
- }
3431
- }
3432
-
3433
-
3434
- if(isset($_POST['mo_woocommerce_login_prompt'])){
3435
-
3436
- $this->miniorange_initiate_2nd_factor( $currentuser, "", $redirect_to,"",$session_id);
3437
- }
3438
- if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3439
- $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Please enter the One Time Passcode', );
3440
- wp_send_json_success($data);
3441
- }
3442
- else
3443
- return new WP_Error( 'one_time_passcode_empty', '<strong>ERROR</strong>: Please enter the One Time Passcode.');
3444
- // Prevent PHP notices when using app password login
3445
-
3446
- }
3447
- else
3448
- {
3449
- $otp_token = isset($_POST[ 'mo_softtoken' ]) ? trim( $_POST[ 'mo_softtoken' ] ) : '';
3450
- }
3451
- $attributes = isset( $_POST['miniorange_rba_attribures'] ) ? $_POST['miniorange_rba_attribures'] : null;
3452
- $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
3453
- if(is_null($session_id)) {
3454
- $session_id=$this->create_session();
3455
- }
3456
-
3457
-
3458
- $error=$this->miniorange_initiate_2nd_factor( $currentuser, $attributes, $redirect_to, $otp_token, $session_id );
3459
-
3460
-
3461
- if(is_wp_error( $error)){
3462
- return $error;
3463
- }
3464
- return $error;
3465
- }
3466
- }
3467
- }
3468
-
3469
- }
3470
-
3471
- function display_email_verification($head,$body,$color)
3472
- {
3473
- echo "<div style='background-color: #d5e3d9; height:850px;' >
3474
- <div style='height:350px; background-color: #3CB371; border-radius: 2px; padding:2%; '>
3475
- <div class='mo2f_tamplate_layout' style='background-color: #ffffff;border-radius: 5px;box-shadow: 0 5px 15px rgba(0,0,0,.5); width:850px;height:350px; align-self: center; margin: 180px auto; ' >
3476
- <img alt='logo' style='margin-left:240px ;
3477
- margin-top:10px;width=40%;' src='https://auth.miniorange.com/moas/images/logo_large.png' />
3478
- <div><hr></div>
3479
-
3480
- <tbody>
3481
- <tr>
3482
- <td>
3483
-
3484
- <p style='margin-top:0;margin-bottom:10px'>
3485
- <p style='margin-top:0;margin-bottom:10px'> <h1 style='color:".$color.";text-align:center;font-size:50px'>".$head ."</h1></p>
3486
- <p style='margin-top:0;margin-bottom:10px'>
3487
- <p style='margin-top:0;margin-bottom:10px;text-align:center'><h2 style='text-align:center'>".$body."</h2></p>
3488
- <p style='margin-top:0;margin-bottom:0px;font-size:11px'>
3489
-
3490
- </td>
3491
- </tr>
3492
-
3493
- </div>
3494
- </div>
3495
- </div>";
3496
- }
3497
-
3498
- function mo_2_factor_enable_jquery_default_login() {
3499
- wp_enqueue_script( 'jquery' );
3500
- }
3501
-
3502
- function miniorange_pass2login_footer_form() {
3503
- ?>
3504
- <script>
3505
- jQuery(document).ready(function () {
3506
- if (document.getElementById('loginform') != null) {
3507
- jQuery('#loginform').on('submit', function (e) {
3508
- jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
3509
- });
3510
- } else {
3511
- if (document.getElementsByClassName('login') != null) {
3512
- jQuery('.login').on('submit', function (e) {
3513
- jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
3514
- });
3515
- }
3516
- }
3517
- });
3518
- </script>
3519
- <?php
3520
-
3521
- }
3522
-
3523
-
3524
- }
3525
-
3526
- ?>
1
+ <?php
2
+ /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
3
+ * Copyright (C) 2015 miniOrange
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
17
+ * @package miniOrange OAuth
18
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
19
+ */
20
+ /**
21
+ * This library is miniOrange Authentication Service.
22
+ * Contains Request Calls to Customer service.
23
+ **/
24
+
25
+ include 'two_fa_login.php';
26
+ class Miniorange_Password_2Factor_Login {
27
+
28
+ private $mo2f_kbaquestions;
29
+ private $mo2f_userID;
30
+ private $mo2f_rbastatus;
31
+ private $mo2f_transactionid;
32
+
33
+ function mo2f_inline_login(){
34
+ global $moWpnsUtility;
35
+ $email = sanitize_email( $_POST['email'] );
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');
43
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
44
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
45
+ return;
46
+ }
47
+ $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
48
+ }
49
+ function mo2f_inline_register(){
50
+ global $moWpnsUtility, $Mo2fdbQueries;
51
+ $email = sanitize_email($_POST['email']);
52
+ $company = $_SERVER["SERVER_NAME"];
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
+ {
62
+ $login_message=MoWpnsMessages::showMessage('PASS_LENGTH');
63
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
64
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
65
+ }
66
+ if( $password != $confirmPassword )
67
+ {
68
+ $login_message=MoWpnsMessages::showMessage('PASS_MISMATCH');
69
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
70
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
71
+ }
72
+ if( MoWpnsUtility::check_empty_or_null( $email ) || MoWpnsUtility::check_empty_or_null( $password )
73
+ || MoWpnsUtility::check_empty_or_null( $confirmPassword ) )
74
+ {
75
+ $login_message=MoWpnsMessages::showMessage('REQUIRED_FIELDS');
76
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
77
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
78
+ }
79
+
80
+ update_option( 'mo2f_email', $email );
81
+
82
+ update_option( 'mo_wpns_company' , $company );
83
+
84
+ update_option( 'mo_wpns_password' , $password );
85
+
86
+ $customer = new MocURL();
87
+ $content = json_decode($customer->check_customer($email), true);
88
+ $Mo2fdbQueries->insert_user( $user_id );
89
+ switch ($content['status'])
90
+ {
91
+ case 'CUSTOMER_NOT_FOUND':
92
+ $customerKey = json_decode($customer->create_customer($email, $company, $password, $phone = '', $first_name = '', $last_name = ''), true);
93
+
94
+ if(strcasecmp($customerKey['status'], 'SUCCESS') == 0)
95
+ {
96
+ $this->inline_save_success_customer_config($user_id,$email, $customerKey['id'], $customerKey['apiKey'], $customerKey['token'], $customerKey['appSecret']);
97
+ $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
98
+ }
99
+
100
+ break;
101
+ default:
102
+ $this->inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt);
103
+ break;
104
+ }
105
+
106
+ }
107
+
108
+ function mo2f_download_backup_codes_inline(){
109
+ $nonce = sanitize_text_field($_POST['mo2f_inline_backup_nonce']);
110
+ $backups= sanitize_text_field($_POST['mo2f_inline_backup_codes']);
111
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-backup-nonce' ) ) {
112
+ $error = new WP_Error();
113
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
114
+ return $error;
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);
124
+ }
125
+ }
126
+
127
+ function mo2f_goto_wp_dashboard(){
128
+ global $Mo2fdbQueries;
129
+ $nonce = sanitize_text_field($_POST['mo2f_inline_wp_dashboard_nonce']);
130
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-wp-dashboard-nonce' ) ) {
131
+ $error = new WP_Error();
132
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
133
+ return $error;
134
+ } else {
135
+ $pass2fa= new Miniorange_Password_2Factor_Login();
136
+ $pass2fa->mo2fa_pass2login(esc_url_raw($_POST['redirect_to']),sanitize_text_field($_POST['session_id']));
137
+ exit;
138
+ }
139
+ }
140
+
141
+ function mo2f_use_backup_codes($POSTED){
142
+ $nonce = sanitize_text_field($POSTED['miniorange_backup_nonce']);
143
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-backup-nonce' ) ) {
144
+ $error = new WP_Error();
145
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
146
+ return $error;
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';
153
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
154
+ }
155
+ }
156
+
157
+ function check_backup_codes_validation($POSTED){
158
+ global $Mo2fdbQueries;
159
+ $nonce = sanitize_text_field($POSTED['miniorange_validate_backup_nonce']);
160
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
161
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-validate-backup-nonce' ) ) {
162
+ $error = new WP_Error();
163
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
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';
173
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
174
+ }
175
+ $backup_codes=get_user_meta($currentuser_id,'mo2f_backup_codes',true);
176
+ $mo2f_backup_code= sanitize_text_field($POSTED[ 'mo2f_backup_code' ]);
177
+ $mo2f_backup_code=md5($mo2f_backup_code);
178
+ if(!empty($backup_codes)){
179
+ if(in_array($mo2f_backup_code,$backup_codes)){
180
+ foreach ($backup_codes as $key => $value) {
181
+ if($value==$mo2f_backup_code){
182
+ unset($backup_codes[$key]);
183
+ update_user_meta($currentuser_id,'mo2f_backup_codes', $backup_codes);
184
+ }
185
+ }
186
+
187
+ if(sizeof($backup_codes) <= 2){
188
+ $codes_remaining = sizeof($backup_codes);
189
+ $mo2f_user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser_id );
190
+ if(empty($mo2f_user_email)){
191
+ $currentuser = get_user_by( 'id', $currentuser_id );
192
+ $mo2f_user_email = $currentuser->user_email;
193
+ }
194
+ $subject = '2-Factor Authentication(Backup Codes)';
195
+ $headers = array('Content-Type: text/html; charset=UTF-8');
196
+ $message = MO2f_Utility::get_codes_warning_email_content($codes_remaining);
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';
204
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
205
+ }
206
+ }else{
207
+ $mo2fa_login_message = __('There are no codes left.','miniorange-2-factor-authentication');
208
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_BACKUP';
209
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
210
+ }
211
+ }else{
212
+ $this->remove_current_activity($session_id_encrypt);
213
+ return new WP_Error('invalid_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') . '</strong>: ' . __('Please try again..', 'miniorange-2-factor-authentication'));
214
+ }
215
+ }
216
+ }
217
+
218
+ function mo2f_create_backup_codes(){
219
+ $nonce = sanitize_text_field($_POST['miniorange_generate_backup_nonce']);
220
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-generate-backup-nonce' ) ) {
221
+ $error = new WP_Error();
222
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
223
+ return $error;
224
+ }else {
225
+ global $Mo2fdbQueries;
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);
233
+ $str1="";
234
+ for ($x = 0; $x < 5; $x++) {
235
+ $str = $codes[$x];
236
+ $str1.=$str;
237
+ if($x != 4){
238
+ $str1.=',';
239
+ }
240
+ }
241
+ update_user_meta($id,'mo2f_backup_codes', $codes_hash);
242
+ $key = get_option( 'mo2f_encryption_key' );
243
+ $codes_encrypt = MO2f_Utility::encrypt_data($str1, $key);
244
+ update_user_meta($id,'chqwetcsdvnvd', $codes_encrypt);
245
+
246
+ $mo2f_user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $id );
247
+ if(empty($mo2f_user_email)){
248
+ $currentuser = get_user_by( 'id', $id );
249
+ $mo2f_user_email = $currentuser->user_email;
250
+ }
251
+ $result = MO2f_Utility::mo2f_email_backup_codes($codes, $mo2f_user_email);
252
+ update_user_meta($id, 'mo_backup_code_generated', 1);
253
+
254
+ $mo2fa_login_message = "An email containing the backup codes has been sent. Please click on Use backup codes to login using the backup codes.";
255
+ $mo2fa_login_status = sanitize_text_field($_POST['login_status']);
256
+
257
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null ,$session_id);
258
+ }
259
+ }
260
+
261
+ function inline_get_current_customer($user_id,$email,$password,$redirect_to,$session_id_encrypt)
262
+ {
263
+ global $Mo2fdbQueries;
264
+ $customer = new MocURL();
265
+
266
+ $content = $customer->get_customer_key($email, $password);
267
+ $customerKey = json_decode($content, true);
268
+ if(json_last_error() == JSON_ERROR_NONE)
269
+ {
270
+ if(isset($customerKey['phone'])){
271
+ update_option( 'mo_wpns_admin_phone', $customerKey['phone'] );
272
+ $Mo2fdbQueries->update_user_details( $user_id, array( 'mo2f_user_phone' => $customerKey['phone'] ) );
273
+ }
274
+ update_option('mo2f_email',$email);
275
+ $this->inline_save_success_customer_config($user_id,$email, $customerKey['id'], $customerKey['apiKey'], $customerKey['token'], $customerKey['appSecret']);
276
+ $login_message=MoWpnsMessages::showMessage('REG_SUCCESS');
277
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
278
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
279
+ }
280
+ else
281
+ {
282
+ $Mo2fdbQueries->update_user_details( $user_id, array( 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_VERIFY_CUSTOMER' ) );
283
+ $login_message=MoWpnsMessages::showMessage('ACCOUNT_EXISTS');
284
+ $login_status="MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS";
285
+ $this->miniorange_pass2login_form_fields($login_status, $login_message,$redirect_to,null,$session_id_encrypt);
286
+ }
287
+ }
288
+
289
+ function inline_save_success_customer_config($user_id,$email, $id, $apiKey, $token, $appSecret)
290
+ {
291
+ global $Mo2fdbQueries;
292
+ update_option( 'mo2f_customerKey' , $id );
293
+ update_option( 'mo2f_api_key' , $apiKey );
294
+ update_option( 'mo2f_customer_token' , $token );
295
+ update_option( 'mo2f_app_secret' , $appSecret );
296
+ update_option( 'mo_wpns_enable_log_requests' , true );
297
+ update_option( 'mo2f_miniorange_admin', $id );
298
+ update_option( 'mo_2factor_admin_registration_status', 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' );
299
+ update_option( 'mo_2factor_user_registration_status', 'MO_2_FACTOR_PLUGIN_SETTINGS' );
300
+ $Mo2fdbQueries->update_user_details( $user_id, array(
301
+ 'mo2f_user_email' =>$email
302
+ ) );
303
+ }
304
+ function mo2f_inline_validate_otp(){
305
+ if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
306
+ $nonce = sanitize_text_field($_POST['miniorange_inline_validate_otp_nonce']);
307
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-otp-nonce' ) ) {
308
+ $error = new WP_Error();
309
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
310
+ return $error;
311
+ } else {
312
+ global $Mo2fdbQueries;
313
+ $this->miniorange_pass2login_start_session();
314
+ $otp_token = '';
315
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
316
+ $mo2fa_login_message = '';
317
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
318
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
319
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
320
+ $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
321
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
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
+
330
+ if($selected_2factor_method == 'OTP Over Telegram')
331
+ {
332
+
333
+ $userID = $current_user;
334
+ $otp = $otp_token;
335
+ $otpToken = get_user_meta($userID,'mo2f_otp_token',true);
336
+ $time = get_user_meta($userID,'mo2f_telegram_time',true);
337
+ $accepted_time = time()-300;
338
+ $time = (int)$time;
339
+
340
+
341
+ if($otp == $otpToken)
342
+ {
343
+ if($accepted_time<$time){
344
+ update_user_meta($userID,'mo2f_chat_id',get_user_meta($userID,'mo2f_temp_chatID',true));
345
+ delete_user_meta($userID,'mo2f_temp_chatID');
346
+ delete_user_meta($userID,'mo2f_otp_token');
347
+ delete_user_meta($userID,'mo2f_telegram_time');
348
+ $Mo2fdbQueries->update_user_details($userID, array(
349
+ "mo2f_configured_2FA_method" => 'OTP Over Telegram',
350
+ 'mo2f_OTPOverTelegram_config_status' => true,
351
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
352
+ ) );
353
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
354
+ }
355
+ else
356
+ {
357
+ delete_user_meta($userID,'mo2f_otp_token');
358
+ delete_user_meta($userID,'mo2f_telegram_time');
359
+ $mo2fa_login_message = __('OTP has been expired please initiate a new transaction by clicking on verify button.','miniorange-2-factor-authentication');
360
+ }
361
+ }
362
+ else
363
+ {
364
+ $mo2fa_login_message = __('Invalid OTP. Please try again.','miniorange-2-factor-authentication');
365
+ }
366
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
367
+ }
368
+
369
+ $user_phone = $Mo2fdbQueries->get_user_detail('mo2f_user_phone',$current_user);
370
+ $customer = new Customer_Setup();
371
+ $content = json_decode($customer->validate_otp_token( $selected_2factor_method, null, get_user_meta($current_user,'mo2f_transactionId',true), $otp_token, get_site_option('mo2f_customerKey'), get_site_option('mo2f_api_key') ),true);
372
+ if($content['status'] == 'ERROR'){
373
+ $mo2fa_login_message = Mo2fConstants::langTranslate($content['message']);
374
+ }else if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated
375
+ $phone = get_user_meta($current_user,'mo2f_user_phone',true) ;
376
+ if($user_phone && strlen($user_phone) >= 4){
377
+ if($phone != $user_phone ){
378
+
379
+ $Mo2fdbQueries->update_user_details( $current_user, array(
380
+ 'mobile_registration_status' =>false
381
+ ) );
382
+ }
383
+ }
384
+
385
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user);
386
+ if(!($Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user)=='OTP OVER EMAIL')){
387
+ $Mo2fdbQueries->update_user_details( $current_user, array(
388
+ 'mo2f_OTPOverSMS_config_status' =>true,
389
+ 'mo2f_user_phone' =>$phone
390
+ ) );
391
+ }else{
392
+ $Mo2fdbQueries->update_user_details( $current_user, array('mo2f_email_otp_registration_status'=>true) );
393
+
394
+ }
395
+ $Mo2fdbQueries->update_user_details($current_user, array(
396
+ "mo2f_configured_2FA_method" => 'OTP Over SMS',
397
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
398
+ ) );
399
+ $TwoF_setup = new Two_Factor_Setup();
400
+ $response = json_decode($TwoF_setup->mo2f_update_userinfo($email,'SMS',null,null,null),true);
401
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
402
+
403
+ }else{ // OTP Validation failed.
404
+ $mo2fa_login_message = __('Invalid OTP. Please try again.','miniorange-2-factor-authentication');
405
+ }
406
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
407
+ }
408
+ }
409
+
410
+ }
411
+ function mo2f_inline_send_otp(){
412
+ if(isset($_POST['miniorange_inline_verify_phone_nonce'])){
413
+ $nonce = sanitize_text_field($_POST['miniorange_inline_verify_phone_nonce']);
414
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-verify-phone-nonce' ) ) {
415
+ $error = new WP_Error();
416
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
417
+ return $error;
418
+ } else {
419
+ global $Mo2fdbQueries;
420
+ $this->miniorange_pass2login_start_session();
421
+ if(isset($_POST['verify_phone']))
422
+ $phone = sanitize_text_field( $_POST['verify_phone'] );
423
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
424
+
425
+ $current_user = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
426
+
427
+
428
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
429
+ $customer = new Customer_Setup();
430
+ $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$current_user);
431
+ $parameters = array();
432
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user);
433
+
434
+ $mo2fa_login_message = '';
435
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
436
+ if($selected_2factor_method=='SMS' || $selected_2factor_method=='PHONE VERIFICATION' ||$selected_2factor_method== 'SMS AND EMAIL'){
437
+ $phone = sanitize_text_field( $_POST['verify_phone'] );
438
+ if( MO2f_Utility::mo2f_check_empty_or_null( $phone ) ){
439
+ $mo2fa_login_message = __('Please enter your phone number.','miniorange-2-factor-authentication');
440
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
441
+ }
442
+ $phone = str_replace(' ', '', $phone);
443
+ update_user_meta($current_user,'mo2f_user_phone',$phone);
444
+ }
445
+ if($selected_2factor_method == 'OTP_OVER_SMS' || $selected_2factor_method == 'SMS' ){
446
+ $currentMethod = "SMS";
447
+ }else if($selected_2factor_method == 'SMS AND EMAIL'){
448
+ $currentMethod = "OTP_OVER_SMS_AND_EMAIL";
449
+ $parameters = array("phone" => $phone, "email" => $email);
450
+ }else if($selected_2factor_method == 'PHONE VERIFICATION'){
451
+ $currentMethod = "PHONE_VERIFICATION";
452
+ }else if($selected_2factor_method == 'OTP OVER EMAIL'){
453
+ $currentMethod = "OTP_OVER_EMAIL";
454
+ $parameters = $email;
455
+ }
456
+
457
+ else if($selected_2factor_method == 'OTP Over Telegram')
458
+ {
459
+ $currentMethod = "OTP Over Telegram";
460
+ $user_id = $current_user;
461
+ $chatID = sanitize_text_field($_POST['verify_chatID']);
462
+ $otpToken = '';
463
+ for($i=1;$i<7;$i++)
464
+ {
465
+ $otpToken .= rand(0,9);
466
+ }
467
+
468
+ update_user_meta($user_id,'mo2f_otp_token',$otpToken);
469
+ update_user_meta($user_id,'mo2f_telegram_time',time());
470
+ update_user_meta($user_id,'mo2f_temp_chatID',$chatID);
471
+ $url = 'https://sitestats.xecurify.com/teleTest/send_otp.php';
472
+ $postdata = array( 'mo2f_otp_token' => $otpToken,
473
+ 'mo2f_chatid' => $chatID
474
+ );
475
+
476
+ $handle = curl_init();
477
+
478
+ curl_setopt_array($handle,
479
+ array(
480
+ CURLOPT_URL => $url,
481
+ CURLOPT_POST => true,
482
+ CURLOPT_POSTFIELDS => $postdata,
483
+ CURLOPT_RETURNTRANSFER => true,
484
+ CURLOPT_SSL_VERIFYHOST => FALSE,
485
+ CURLOPT_SSL_VERIFYPEER => FALSE,
486
+
487
+ )
488
+ );
489
+
490
+ $data = curl_exec($handle);
491
+ curl_close($handle);
492
+ if($data == 'SUCCESS')
493
+ $mo2fa_login_message = 'An OTP has been sent to your given chat ID. Please enter it below for verification.';
494
+ else
495
+ $mo2fa_login_message = 'There were an erroe while sending the OTP. Please confirm your chatID and try again.';
496
+
497
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
498
+
499
+ }
500
+ if($selected_2factor_method == 'SMS AND EMAIL'){
501
+ $content = json_decode($customer->send_otp_token($parameters,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
502
+ }
503
+ else if($selected_2factor_method == 'OTP OVER EMAIL'){
504
+ $content = json_decode($customer->send_otp_token($email,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
505
+ }
506
+ else{
507
+ $content = json_decode($customer->send_otp_token($phone,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
508
+
509
+ }
510
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate otp token */
511
+ if($content['status'] == 'ERROR'){
512
+ $mo2fa_login_message = Mo2fConstants::langTranslate($content['message']);
513
+ }else if($content['status'] == 'SUCCESS'){
514
+ update_user_meta($current_user,'mo2f_transactionId',$content['txId']);
515
+ if($selected_2factor_method == 'SMS'){
516
+ if(get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')>0)
517
+ update_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z',get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')-1);
518
+ $mo2fa_login_message = __('The One Time Passcode has been sent to','miniorange-2-factor-authentication'). $phone . '.' . __('Please enter the one time passcode below to verify your number.','miniorange-2-factor-authentication');
519
+ }else if($selected_2factor_method == 'SMS AND EMAIL'){
520
+ $mo2fa_login_message = 'The One Time Passcode has been sent to ' . $parameters["phone"] . ' and '. $parameters["email"] . '. Please enter the one time passcode sent to your email and phone to verify.';
521
+ }else if($selected_2factor_method == 'OTP OVER EMAIL'){
522
+ $mo2fa_login_message = __('The One Time Passcode has been sent to ','miniorange-2-factor-authentication') . $parameters . '.' . __('Please enter the one time passcode sent to your email to verify.','miniorange-2-factor-authentication');
523
+ }else if($selected_2factor_method== 'PHONE VERIFICATION'){
524
+ $mo2fa_login_message = __('You will receive a phone call on this number ','miniorange-2-factor-authentication') . $phone . '.' . __('Please enter the one time passcode below to verify your number.','miniorange-2-factor-authentication');
525
+ }
526
+ }else if($content['status'] == 'FAILED'){
527
+ $mo2fa_login_message = __($content['message'],'miniorange-2-factor-authentication');
528
+ }else{
529
+ $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
530
+ }
531
+ }else{
532
+ $mo2fa_login_message = __('Invalid request. Please try again','miniorange-2-factor-authentication');
533
+ }
534
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
535
+ }
536
+ }
537
+
538
+ }
539
+ function mo2f_inline_validate_kba(){
540
+ if(isset($_POST['mo2f_inline_save_kba_nonce'])){
541
+ $nonce = sanitize_text_field($_POST['mo2f_inline_save_kba_nonce']);
542
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-kba-nonce' ) ) {
543
+ $error = new WP_Error();
544
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
545
+ return $error;
546
+ } else {
547
+ global $Mo2fdbQueries;
548
+ $this->miniorange_pass2login_start_session();
549
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
550
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
551
+ $mo2fa_login_message = '';
552
+ $mo2fa_login_status = isset($_POST['mo2f_inline_kba_status']) ? 'MO_2_FACTOR_SETUP_SUCCESS' : 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
553
+ $temp_array = array(sanitize_text_field($_POST['mo2f_kbaquestion_1']),sanitize_text_field($_POST['mo2f_kbaquestion_2']),sanitize_text_field($_POST['mo2f_kbaquestion_3']));
554
+ $kba_questions = array();
555
+ foreach($temp_array as $question){
556
+ if(MO2f_Utility::mo2f_check_empty_or_null( $question)){
557
+ $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
558
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
559
+ }else{
560
+ $ques = sanitize_text_field($question);
561
+ $ques = addcslashes(stripslashes($ques), '"\\');
562
+ array_push($kba_questions, $ques);
563
+ }
564
+ }
565
+ if(!(array_unique($kba_questions) == $kba_questions)){
566
+ $mo2fa_login_message = __('The questions you select must be unique.','miniorange-2-factor-authentication');
567
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
568
+ }
569
+ $temp_array_ans = array($_POST['mo2f_kba_ans1'],$_POST['mo2f_kba_ans2'],$_POST['mo2f_kba_ans3']);
570
+ $kba_answers = array();
571
+ foreach($temp_array_ans as $answer){
572
+ if(MO2f_Utility::mo2f_check_empty_or_null( $answer)){
573
+ $mo2fa_login_message = __('All the fields are required. Please enter valid entries.','miniorange-2-factor-authentication');
574
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
575
+ }else{
576
+ $ques = sanitize_text_field($answer);
577
+ $answer = strtolower($answer);
578
+ array_push($kba_answers, $answer);
579
+ }
580
+ }
581
+ $size = sizeof($kba_questions);
582
+ $kba_q_a_list = array();
583
+ for($c = 0; $c < $size; $c++){
584
+ array_push($kba_q_a_list, $kba_questions[$c]);
585
+ array_push($kba_q_a_list, $kba_answers[$c]);
586
+ }
587
+
588
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
589
+
590
+
591
+ $current_user = get_user_by('id',$user_id);
592
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
593
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
594
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
595
+ 'mo2f_SecurityQuestions_config_status' =>true,
596
+ 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS'
597
+ ) );
598
+ if(!MO2F_IS_ONPREM)
599
+ {
600
+ $kba_q1 = sanitize_text_field($_POST['mo2f_kbaquestion_1']);
601
+ $kba_a1 = sanitize_text_field( $_POST['mo2f_kba_ans1'] );
602
+ $kba_q2 = sanitize_text_field($_POST['mo2f_kbaquestion_2']);
603
+ $kba_a2 = sanitize_text_field( $_POST['mo2f_kba_ans2'] );
604
+ $kba_q3 = sanitize_text_field( $_POST['mo2f_kbaquestion_3'] );
605
+ $kba_a3 = sanitize_text_field( $_POST['mo2f_kba_ans3'] );
606
+
607
+ $kba_q1 = addcslashes( stripslashes( $kba_q1 ), '"\\' );
608
+ $kba_q2 = addcslashes( stripslashes( $kba_q2 ), '"\\' );
609
+ $kba_q3 = addcslashes( stripslashes( $kba_q3 ), '"\\' );
610
+
611
+ $kba_a1 = addcslashes( stripslashes( $kba_a1 ), '"\\' );
612
+ $kba_a2 = addcslashes( stripslashes( $kba_a2 ), '"\\' );
613
+ $kba_a3 = addcslashes( stripslashes( $kba_a3 ), '"\\' );
614
+
615
+ $kba_registration = new Two_Factor_Setup();
616
+ $kba_reg_reponse = json_decode( $kba_registration->register_kba_details( $email, $kba_q1, $kba_a1, $kba_q2, $kba_a2, $kba_q3, $kba_a3, $user_id ), true );
617
+
618
+ if ( json_last_error() == JSON_ERROR_NONE ) {
619
+
620
+ if ( $kba_reg_reponse['status'] == 'SUCCESS' ) {
621
+ $response = json_decode( $kba_registration->mo2f_update_userinfo( $email, 'KBA', null, null, null ), true );
622
+ }
623
+
624
+ }
625
+ }
626
+
627
+ $kba_q1 = $kba_q_a_list[0];
628
+ $kba_a1 = md5($kba_q_a_list[1]);
629
+ $kba_q2 = $kba_q_a_list[2];
630
+ $kba_a2 = md5($kba_q_a_list[3]);
631
+ $kba_q3 = $kba_q_a_list[4];
632
+ $kba_a3 = md5($kba_q_a_list[5]);
633
+ $question_answer = array($kba_q1 => $kba_a1 ,$kba_q2 => $kba_a2 , $kba_q3 => $kba_a3 );
634
+ update_user_meta( $current_user->ID , 'mo2f_kba_challenge', $question_answer );
635
+ if(!isset($_POST['mo2f_inline_kba_status'])){
636
+ update_user_meta($current_user->ID,'mo2f_2FA_method_to_configure','Security Questions');
637
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array( 'mo2f_configured_2FA_method' => 'Security Questions' ) );
638
+ }
639
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
640
+ }
641
+ }
642
+ }
643
+
644
+ function mo2f_inline_validate_mobile_authentication(){
645
+ if(isset($_POST['mo_auth_inline_mobile_registration_complete_nonce'])){
646
+ $nonce = sanitize_text_field($_POST['mo_auth_inline_mobile_registration_complete_nonce']);
647
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-mobile-registration-complete-nonce' ) ) {
648
+ $error = new WP_Error();
649
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
650
+ return $error;
651
+ } else {
652
+ global $Mo2fdbQueries;
653
+ $this->miniorange_pass2login_start_session();
654
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
655
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
656
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
657
+
658
+
659
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
660
+ $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
661
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
662
+ $mo2fa_login_message = '';
663
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
664
+ $enduser = new Two_Factor_Setup();
665
+ if($selected_2factor_method == 'SOFT TOKEN')
666
+ $selected_2factor_method_onprem = 'miniOrange Soft Token';
667
+ else if($selected_2factor_method == 'PUSH NOTIFICATIONS')
668
+ $selected_2factor_method_onprem = 'miniOrange Push Notification';
669
+ else if($selected_2factor_method == 'MOBILE AUTHENTICATION')
670
+ $selected_2factor_method_onprem = 'miniOrange QR Code Authentication';
671
+
672
+ $response = json_decode($enduser->mo2f_update_userinfo($email,$selected_2factor_method,null,null,null),true);
673
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
674
+ if($response['status'] == 'ERROR'){
675
+ $mo2fa_login_message = Mo2fConstants::langTranslate($response['message']);
676
+ }else if($response['status'] == 'SUCCESS'){
677
+ $Mo2fdbQueries->update_user_details( $user_id, array(
678
+ 'mobile_registration_status' =>true,
679
+ 'mo2f_miniOrangeQRCodeAuthentication_config_status' => true,
680
+ 'mo2f_miniOrangeSoftToken_config_status' => true,
681
+ 'mo2f_miniOrangePushNotification_config_status' => true,
682
+ 'mo2f_configured_2FA_method' =>$selected_2factor_method_onprem ,
683
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
684
+ ) );
685
+ //
686
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
687
+ }else{
688
+ $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
689
+ }
690
+ }else{
691
+ $mo2fa_login_message = __('Invalid request. Please try again','miniorange-2-factor-authentication');
692
+ }
693
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
694
+ }
695
+ }
696
+
697
+ }
698
+
699
+ function mo2f_duo_mobile_send_push_notification_for_inline_form(){
700
+ if(isset($_POST['duo_mobile_send_push_notification_inline_form_nonce'])){
701
+ $nonce = sanitize_text_field($_POST['duo_mobile_send_push_notification_inline_form_nonce']);
702
+ if ( ! wp_verify_nonce( $nonce, 'mo2f-send-duo-push-notification-inline-nonce' ) ) {
703
+ $error = new WP_Error();
704
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
705
+ return $error;
706
+ } else {
707
+
708
+ global $Mo2fdbQueries;
709
+ $this->miniorange_pass2login_start_session();
710
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
711
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
712
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
713
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
714
+
715
+ $Mo2fdbQueries->update_user_details( $user_id, array(
716
+ 'mobile_registration_status' =>true,
717
+ ) );
718
+ $mo2fa_login_message = '';
719
+
720
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
721
+
722
+
723
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
724
+
725
+ }
726
+ }
727
+ }
728
+
729
+ function mo2f_inline_validate_duo_authentication(){
730
+ if(isset($_POST['mo_auth_inline_duo_auth_mobile_registration_complete_nonce'])){
731
+ $nonce = sanitize_text_field($_POST['mo_auth_inline_duo_auth_mobile_registration_complete_nonce']);
732
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-duo_auth-registration-complete-nonce' ) ) {
733
+ $error = new WP_Error();
734
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
735
+ return $error;
736
+ } else {
737
+
738
+ global $Mo2fdbQueries;
739
+ $this->miniorange_pass2login_start_session();
740
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
741
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
742
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
743
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
744
+ $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
745
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
746
+ $Mo2fdbQueries->update_user_details( $user_id, array(
747
+ 'mobile_registration_status' =>true,
748
+ ) );
749
+ $mo2fa_login_message = '';
750
+
751
+ include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'handler'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_duo_handler.php';
752
+ $ikey = get_site_option('mo2f_d_integration_key');
753
+ $skey = get_site_option('mo2f_d_secret_key');
754
+ $host = get_site_option('mo2f_d_api_hostname');
755
+
756
+
757
+
758
+ $duo_preauth = preauth( $email ,true, $skey, $ikey, $host);
759
+
760
+
761
+ if(isset($duo_preauth['response']['stat']) && $duo_preauth['response']['stat'] == 'OK'){
762
+
763
+ if(isset($duo_preauth['response']['response']['status_msg']) && $duo_preauth['response']['response']['status_msg'] == 'Account is active'){
764
+ $mo2fa_login_message = $email.' user is already exists, please go for step B duo will send push notification on your configured mobile.';
765
+
766
+ }else if(isset($duo_preauth['response']['response']['enroll_portal_url'])){
767
+ $duo_enroll_url = $duo_preauth['response']['response']['enroll_portal_url'];
768
+ update_user_meta( $user_id , 'user_not_enroll_on_duo_before', $duo_enroll_url );
769
+ update_user_meta( $user_id , 'user_not_enroll', true );
770
+
771
+ }else{
772
+ $mo2fa_login_message = 'Your account is inactive from duo side, please contact to your administrator.';
773
+ }
774
+
775
+ }else{
776
+ $mo2fa_login_message = 'Error through during preauth.';
777
+
778
+ }
779
+
780
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
781
+
782
+
783
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
784
+
785
+ }
786
+ }
787
+ }
788
+
789
+ function mo2f_inline_setup_success($current_user_id,$redirect_to,$session_id){
790
+ global $Mo2fdbQueries;
791
+ $Mo2fdbQueries->update_user_details( $current_user_id, array('mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS') );
792
+
793
+ $code_generate = get_user_meta($current_user_id, 'mo_backup_code_generated', true);
794
+ if(empty($code_generate)){
795
+ $mo2fa_login_message = '';
796
+ $mo2fa_login_status = 'MO_2_FACTOR_GENERATE_BACKUP_CODES';
797
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
798
+ }else{
799
+ $pass2fa= new Miniorange_Password_2Factor_Login();
800
+ $pass2fa->mo2fa_pass2login($redirect_to,$session_id);
801
+ exit;
802
+ }
803
+ }
804
+
805
+ function mo2f_inline_get_qr_code_for_mobile($email,$id){
806
+ $registerMobile = new Two_Factor_Setup();
807
+ $content = $registerMobile->register_mobile($email);
808
+ $response = json_decode($content, true);
809
+ $message = '';
810
+ $miniorageqr=array();
811
+ if(json_last_error() == JSON_ERROR_NONE) {
812
+ if($response['status'] == 'ERROR'){
813
+ $miniorageqr['message']=Mo2fConstants::langTranslate($response['message']);;
814
+ delete_user_meta( $id, 'miniorageqr' );
815
+ }else{
816
+ if($response['status'] == 'IN_PROGRESS'){
817
+
818
+ $miniorageqr['message']='';
819
+ $miniorageqr['mo2f-login-qrCode']=$response['qrCode'];
820
+ $miniorageqr['mo2f-login-transactionId']=$response['txId'];
821
+ $miniorageqr['mo2f_show_qr_code']='MO_2_FACTOR_SHOW_QR_CODE';
822
+ update_user_meta($id,'miniorageqr',$miniorageqr);
823
+ }else{
824
+ $miniorageqr['message']=__('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
825
+ delete_user_meta( $id, 'miniorageqr' );
826
+ }
827
+ }
828
+ }
829
+ return $miniorageqr;
830
+ }
831
+
832
+ function inline_mobile_configure(){
833
+ if(isset($_POST['miniorange_inline_show_qrcode_nonce'])){
834
+ $nonce = sanitize_text_field($_POST['miniorange_inline_show_qrcode_nonce']);
835
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-show-qrcode-nonce' ) ) {
836
+ $error = new WP_Error();
837
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
838
+ return $error;
839
+ } else {
840
+ global $Mo2fdbQueries;
841
+ $this->miniorange_pass2login_start_session();
842
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
843
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
844
+
845
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
846
+ $current_user = get_user_by('id',$user_id);
847
+ $mo2fa_login_message = '';
848
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
849
+ $user_registration_status = $Mo2fdbQueries->get_user_detail('mo_2factor_user_registration_status',$current_user->ID);
850
+ if($user_registration_status == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') {
851
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
852
+ $miniorageqr = $this->mo2f_inline_get_qr_code_for_mobile($email,$current_user->ID);
853
+ $mo2fa_login_message=$miniorageqr['message'];
854
+ MO2f_Utility::mo2f_set_transient( $session_id_encrypt,'mo2f_transactionId', $miniorageqr['mo2f-login-transactionId'] );
855
+
856
+ $this->mo2f_transactionid=$miniorageqr['mo2f-login-transactionId'];
857
+ }else{
858
+ $mo2fa_login_message = __('Invalid request. Please register with miniOrange before configuring your mobile.','miniorange-2-factor-authentication');
859
+ }
860
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,$miniorageqr,$session_id_encrypt);
861
+ }
862
+ }
863
+ }
864
+
865
+ function inline_validate_and_set_ga(){
866
+ if(isset($_POST['mo2f_inline_validate_ga_nonce'])){
867
+ $nonce = sanitize_text_field($_POST['mo2f_inline_validate_ga_nonce']);
868
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-google-auth-nonce' ) ) {
869
+ $error = new WP_Error();
870
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
871
+ return $error;
872
+ } else {
873
+ global $Mo2fdbQueries;
874
+ $this->miniorange_pass2login_start_session();
875
+ $otpToken = sanitize_text_field($_POST['google_auth_code']);
876
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
877
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
878
+
879
+
880
+ $current_user = get_user_by('id',$user_id);
881
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
882
+ $ga_secret = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'secret_ga');
883
+
884
+ $mo2fa_login_message = '';
885
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
886
+ if(MO2f_Utility::mo2f_check_number_length($otpToken)){
887
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
888
+ $google_auth = new Miniorange_Rba_Attributes();
889
+ $google_response = json_decode($google_auth->mo2f_validate_google_auth($email,$otpToken,$ga_secret),true);
890
+ if(json_last_error() == JSON_ERROR_NONE) {
891
+ if($google_response['status'] == 'SUCCESS'){
892
+ $response = $google_response;
893
+ if(json_last_error() == JSON_ERROR_NONE || MO2F_IS_ONPREM) {
894
+ if($response['status'] == 'SUCCESS'){
895
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
896
+ 'mo2f_GoogleAuthenticator_config_status' => true,
897
+ 'mo2f_configured_2FA_method' => 'Google Authenticator',
898
+ 'mo2f_AuthyAuthenticator_config_status' => false,
899
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS'
900
+ ) );
901
+
902
+ if(MO2F_IS_ONPREM){
903
+ update_user_meta($current_user->ID,'mo2f_2FA_method_to_configure','GOOGLE AUTHENTICATOR');
904
+ $gauth_obj= new Google_auth_onpremise();
905
+ $gauth_obj->mo_GAuth_set_secret($current_user->ID, $ga_secret);
906
+ }
907
+ update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
908
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
909
+
910
+ //When user sets method of another admin from USers section.
911
+ if(!empty(get_user_meta($current_user->ID,'mo2fa_set_Authy_inline'))){
912
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
913
+ 'mo2f_GoogleAuthenticator_config_status' => false,
914
+ 'mo2f_AuthyAuthenticator_config_status' => true,
915
+ 'mo2f_configured_2FA_method' => "Authy Authenticator",
916
+ 'user_registration_with_miniorange' => 'SUCCESS',
917
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS'
918
+ ) );
919
+ update_user_meta( $current_user->ID, 'mo2f_external_app_type', "Authy Authenticator" );
920
+ delete_user_meta($current_user->ID ,'mo2fa_set_Authy_inline');
921
+ }
922
+ }else{
923
+ $mo2fa_login_message = __('An error occured while setting up Google/Authy Authenticator. Please Try again.','miniorange-2-factor-authentication');
924
+ }
925
+ }else{
926
+ $mo2fa_login_message = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
927
+ }
928
+ }else{
929
+ $mo2fa_login_message = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
930
+ }
931
+ }else{
932
+ $mo2fa_login_message = __('An error occured while validating the user. Please Try again.','miniorange-2-factor-authentication');
933
+ }
934
+ }else{
935
+ $mo2fa_login_message = __('Only digits are allowed. Please enter again.','miniorange-2-factor-authentication');
936
+ }
937
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id_encrypt);
938
+ }
939
+ }
940
+ }
941
+
942
+ function back_to_select_2fa(){
943
+ if( isset($_POST['miniorange_inline_two_factor_setup'])){ /* return back to choose second factor screen */
944
+ $nonce = sanitize_text_field($_POST['miniorange_inline_two_factor_setup']);
945
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-setup-nonce' ) ) {
946
+ $error = new WP_Error();
947
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
948
+ return $error;
949
+ } else {
950
+ global $Mo2fdbQueries;
951
+ $this->miniorange_pass2login_start_session();
952
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
953
+
954
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
955
+
956
+
957
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
958
+ $current_user = get_user_by('id',$user_id);
959
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array( "mo2f_configured_2FA_method" => '' ) );
960
+ $mo2fa_login_message = '';
961
+ $mo2fa_login_status ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
962
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
963
+ }
964
+ }
965
+ }
966
+
967
+ function create_user_in_miniOrange($current_user_id,$email,$currentMethod)
968
+ {
969
+ $tempEmail = get_user_meta($current_user_id,'mo2f_email_miniOrange',true);
970
+ if(isset($tempEmail) and $tempEmail != '')
971
+ $email = $tempEmail;
972
+ global $Mo2fdbQueries;
973
+
974
+ $enduser = new Two_Factor_Setup();
975
+ if($current_user_id == get_option('mo2f_miniorange_admin'))
976
+ $email = get_option('mo2f_email');
977
+
978
+ $check_user = json_decode( $enduser->mo_check_user_already_exist( $email ), true );
979
+
980
+ if(json_last_error() == JSON_ERROR_NONE){
981
+
982
+
983
+
984
+ if($check_user['status'] == 'ERROR'){
985
+ return $check_user;
986
+
987
+ }
988
+ else if(strcasecmp($check_user['status' ], 'USER_FOUND') == 0){
989
+
990
+ $Mo2fdbQueries->update_user_details( $current_user_id, array(
991
+ 'user_registration_with_miniorange' =>'SUCCESS',
992
+ 'mo2f_user_email' =>$email,
993
+ 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
994
+ ) );
995
+ update_site_option(base64_encode("totalUsersCloud"),get_site_option(base64_encode("totalUsersCloud"))+1);
996
+
997
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
998
+ return $check_user;
999
+ }
1000
+ else if(strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
1001
+ $current_user = get_user_by('id',$current_user_id);
1002
+ $content = json_decode($enduser->mo_create_user($current_user,$email), true);
1003
+
1004
+ if(json_last_error() == JSON_ERROR_NONE) {
1005
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1006
+ update_site_option(base64_encode("totalUsersCloud"),get_site_option(base64_encode("totalUsersCloud"))+1);
1007
+ $Mo2fdbQueries->update_user_details( $current_user_id, array(
1008
+ 'user_registration_with_miniorange' =>'SUCCESS',
1009
+ 'mo2f_user_email' =>$email,
1010
+ 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
1011
+ ) );
1012
+
1013
+ $mo2fa_login_message = '';
1014
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1015
+ return $check_user;
1016
+ }else{
1017
+ $check_user['status']='ERROR';
1018
+ $check_user['message']='There is an issue in user creation in miniOrange. Please skip and contact miniorange';
1019
+ return $check_user;
1020
+ }
1021
+ }
1022
+
1023
+
1024
+ }
1025
+ else if(strcasecmp($check_user['status'], 'USER_FOUND_UNDER_DIFFERENT_CUSTOMER') == 0){
1026
+ $mo2fa_login_message = __('The email associated with your account is already registered. Please contact your admin to change the email.','miniorange-2-factor-authentication');
1027
+ $check_user['status']='ERROR';
1028
+ $check_user['message']=$mo2fa_login_message;
1029
+ return $check_user;
1030
+ }
1031
+
1032
+ }
1033
+
1034
+ }
1035
+ function mo2f_skip_2fa_setup()
1036
+ {
1037
+ if(isset($_POST['miniorange_skip_2fa_nonce'])){
1038
+ $nonce = sanitize_text_field($_POST['miniorange_skip_2fa_nonce']);
1039
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-skip-nonce' ) ) {
1040
+ $error = new WP_Error();
1041
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1042
+ return $error;
1043
+ }
1044
+ else{
1045
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1046
+ global $Mo2fdbQueries;
1047
+ $redirect_to = esc_url_raw($_POST['redirect_to']);
1048
+ $session_id_encrypt = sanitize_text_field($session_id_encrypt);
1049
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1050
+
1051
+
1052
+ $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_2factor_enable_2fa_byusers' => 0) );
1053
+
1054
+ $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
1055
+ }
1056
+ }
1057
+ }
1058
+
1059
+ function save_inline_2fa_method(){
1060
+ if(isset($_POST['miniorange_inline_save_2factor_method_nonce'])){
1061
+ $nonce = sanitize_text_field($_POST['miniorange_inline_save_2factor_method_nonce']);
1062
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-2factor-method-nonce' ) ) {
1063
+ $error = new WP_Error();
1064
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1065
+ return $error;
1066
+ } else {
1067
+
1068
+
1069
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1070
+ global $Mo2fdbQueries;
1071
+ $this->miniorange_pass2login_start_session();
1072
+ $mo2fa_login_message = '';
1073
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1074
+
1075
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1076
+
1077
+
1078
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1079
+ $current_user = get_user_by('id',$user_id);
1080
+ $currentUserId = $current_user->ID;
1081
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
1082
+ $user_registration_with_miniorange = $Mo2fdbQueries->get_user_detail('user_registration_with_miniorange',$current_user->ID);
1083
+ if($user_registration_with_miniorange == 'SUCCESS'){
1084
+ $selected_method = isset($_POST['mo2f_selected_2factor_method']) ? sanitize_text_field($_POST['mo2f_selected_2factor_method']) : 'NONE';
1085
+
1086
+ if($selected_method == 'OUT OF BAND EMAIL'){
1087
+ if(!MO2F_IS_ONPREM)
1088
+ {
1089
+ $current_user = get_userdata($currentUserId);
1090
+ $email = $current_user->user_email;
1091
+ $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1092
+
1093
+ if($response['status']=='ERROR') {
1094
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1095
+ $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1096
+ }
1097
+ else
1098
+ {
1099
+ $enduser = new Two_Factor_Setup();
1100
+
1101
+ $Mo2fdbQueries->update_user_details( $currentUserId, array(
1102
+ 'mo2f_email_verification_status' =>true,
1103
+ 'mo2f_configured_2FA_method' =>'Email Verification',
1104
+ 'mo2f_user_email' => $email
1105
+ ) );
1106
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1107
+ }
1108
+ }
1109
+ else
1110
+ {
1111
+ $enduser = new Two_Factor_Setup();
1112
+
1113
+ $Mo2fdbQueries->update_user_details( $currentUserId, array(
1114
+ 'mo2f_email_verification_status' =>true,
1115
+ 'mo2f_configured_2FA_method' =>'Email Verification',
1116
+ 'mo2f_user_email' => $email
1117
+ ) );
1118
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1119
+ }
1120
+ }
1121
+ else if($selected_method == 'OTP OVER EMAIL'){
1122
+ $email = $current_user->user_email;
1123
+ if(!MO2F_IS_ONPREM)
1124
+ {
1125
+ $current_user = get_userdata($currentUserId);
1126
+ $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1127
+ if($response['status']=='ERROR') {
1128
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1129
+ $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1130
+ }
1131
+ else
1132
+ {
1133
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $current_user->ID );
1134
+ if($user_email != '' and !is_null($user_email))
1135
+ $email = $user_email;
1136
+ $this->mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user);
1137
+
1138
+ }
1139
+ }
1140
+ else
1141
+ {
1142
+ $this->mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user);
1143
+ }
1144
+ }else if($selected_method == "GOOGLE AUTHENTICATOR"){
1145
+ $this->miniorange_pass2login_start_session();
1146
+ $mo2fa_login_message = '';
1147
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1148
+ $google_auth = new Miniorange_Rba_Attributes();
1149
+
1150
+ $gauth_name= get_site_option('mo2f_google_appname');
1151
+ $google_account_name= $gauth_name ? $gauth_name : 'miniOrangeAu';
1152
+
1153
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$current_user->ID);
1154
+
1155
+ if ( MO2F_IS_ONPREM ) { //this should not be here
1156
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1157
+ 'mo2f_configured_2FA_method' =>$selected_method,
1158
+ ) );
1159
+ include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'gaonprem.php';
1160
+ $gauth_obj = new Google_auth_onpremise();
1161
+
1162
+ $onpremise_secret = $gauth_obj->createSecret();
1163
+ $issuer = get_site_option( 'mo2f_GA_account_name', 'miniOrangeAu' );
1164
+ $url = $gauth_obj->geturl( $onpremise_secret, $issuer, $email );
1165
+ $mo2f_google_auth = array();
1166
+ $mo2f_google_auth['ga_qrCode'] = $url;
1167
+ $mo2f_google_auth['ga_secret'] = $onpremise_secret;
1168
+
1169
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $onpremise_secret);
1170
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $url);
1171
+
1172
+ }else{
1173
+ $current_user = get_userdata($currentUserId);
1174
+ $email = $current_user->user_email;
1175
+ $tempemail = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentUserId );
1176
+
1177
+ if(!isset($tempemail) and !is_null($tempemail) and $tempemail != '')
1178
+ {
1179
+ $email = $tempemail;
1180
+ }
1181
+
1182
+ $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1183
+ if($response['status']=='ERROR') {
1184
+ $mo2fa_login_message=$response['message'];
1185
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1186
+
1187
+ }else{
1188
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1189
+ 'mo2f_configured_2FA_method' =>$selected_method,
1190
+ ) );
1191
+ $google_response = json_decode( $google_auth->mo2f_google_auth_service( $email, $google_account_name ), true );
1192
+ if ( json_last_error() == JSON_ERROR_NONE ) {
1193
+ if ( $google_response['status'] == 'SUCCESS' ) {
1194
+
1195
+ $mo2f_google_auth = array();
1196
+ $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
1197
+ $mo2f_google_auth['ga_secret'] = $google_response['secret'];
1198
+
1199
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'secret_ga', $mo2f_google_auth['ga_secret']);
1200
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'ga_qrCode', $mo2f_google_auth['ga_qrCode']);
1201
+
1202
+ } else {
1203
+ $mo2fa_login_message = __( 'Invalid request. Please register with miniOrange to configure 2 Factor plugin.', 'miniorange-2-factor-authentication' );
1204
+ }
1205
+ }
1206
+ }
1207
+ }
1208
+
1209
+
1210
+ }else if($selected_method == "DUO PUSH NOTIFICATIONS"){
1211
+ $this->miniorange_pass2login_start_session();
1212
+ $mo2fa_login_message = '';
1213
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1214
+
1215
+ $selected_method = "Duo Authenticator";
1216
+
1217
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1218
+ 'mo2f_configured_2FA_method' =>$selected_method
1219
+ ) );
1220
+
1221
+
1222
+
1223
+
1224
+ }
1225
+ else{
1226
+ //inline for others
1227
+ if(!MO2F_IS_ONPREM or $selected_method == 'MOBILE AUTHENTICATION' or $selected_method == 'PUSH NOTIFICATIONS' or $selected_method == 'SOFT TOKEN' )
1228
+ {
1229
+ $current_user = get_userdata($currentUserId);
1230
+ $email = $current_user->user_email;
1231
+ $response = $this->create_user_in_miniOrange($currentUserId,$email,$selected_method);
1232
+ if(!is_null($response) && $response['status']=='ERROR') {
1233
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1234
+ $mo2fa_login_message=$response['message'].'Skip the two-factor for login';
1235
+ }
1236
+ else {
1237
+ if($selected_method == 'OTP OVER TELEGRAM')
1238
+ {
1239
+ $selected_method = 'OTP Over Telegram';
1240
+ }
1241
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array('mo2f_configured_2FA_method' =>$selected_method) );
1242
+ }
1243
+ }else{
1244
+ if($selected_method == 'OTP OVER TELEGRAM')
1245
+ {
1246
+ $selected_method = 'OTP Over Telegram';
1247
+ }
1248
+ $Mo2fdbQueries->update_user_details( $current_user->ID, array(
1249
+ 'mo2f_configured_2FA_method' =>$selected_method,
1250
+ ) );
1251
+ }
1252
+ }
1253
+ }else{
1254
+ $mo2fa_login_message = __('Invalid request. Please register with miniOrange to configure 2 Factor plugin.','miniorange-2-factor-authentication');
1255
+ }
1256
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to, null, $session_id_encrypt);
1257
+ }
1258
+ }
1259
+ }
1260
+
1261
+ function check_kba_validation($POSTED){
1262
+ global $moWpnsUtility;
1263
+ if ( isset( $POSTED['miniorange_kba_nonce'] ) ) { /*check kba validation*/
1264
+ $nonce = $POSTED['miniorange_kba_nonce'];
1265
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' ) ) {
1266
+ $error = new WP_Error();
1267
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1268
+ return $error;
1269
+ }else{
1270
+ $this->miniorange_pass2login_start_session();
1271
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1272
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1273
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1274
+ if ( isset( $user_id ) ) {
1275
+ if ( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_2'] ) ) {
1276
+ MO2f_Utility::mo2f_debug_file('Please provide both the answers of KBA'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1277
+ $mo2fa_login_message = 'Please provide both the answers.';
1278
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
1279
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1280
+ }
1281
+ $otpToken = array();
1282
+ $kba_questions = MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo_2_factor_kba_questions' );
1283
+ $otpToken[0] = $kba_questions[0]['question'];
1284
+ $otpToken[1] = sanitize_text_field( $_POST['mo2f_answer_1'] );
1285
+ $otpToken[2] = $kba_questions[1]['question'];
1286
+ $otpToken[3] = sanitize_text_field( $_POST['mo2f_answer_2'] );
1287
+ $check_trust_device = isset( $_POST['mo2f_trust_device'] ) ? sanitize_text_field($_POST['mo2f_trust_device']) : 'false';
1288
+ //if the php session folder has insufficient permissions, cookies to be used
1289
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_transactionId', $session_id_encrypt );
1290
+ MO2f_Utility::mo2f_debug_file('Transaction Id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1291
+ $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
1292
+ $kba_validate = new Customer_Setup();
1293
+ $kba_validate_response = json_decode( $kba_validate->validate_otp_token( 'KBA', null, $mo2f_login_transaction_id, $otpToken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1294
+ global $Mo2fdbQueries;
1295
+ $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1296
+ if ( strcasecmp( $kba_validate_response['status'], 'SUCCESS' ) == 0 ) {
1297
+ if ( get_option( 'mo2f_remember_device' ) && $check_trust_device == 'on' ) {
1298
+ try {
1299
+ mo2f_register_profile( $email, 'true', $mo2f_rba_status );
1300
+ } catch ( Exception $e ) {
1301
+ echo $e->getMessage();
1302
+ }
1303
+ MO2f_Utility::mo2f_debug_file('Remeber device logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1304
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1305
+ } else {
1306
+ MO2f_Utility::mo2f_debug_file('Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1307
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1308
+ }
1309
+ } else {
1310
+ MO2f_Utility::mo2f_debug_file('The answers you have provided for KBA are incorrect'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1311
+ $mo2fa_login_message = 'The answers you have provided are incorrect.';
1312
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
1313
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
1314
+ }
1315
+ } else {
1316
+ MO2f_Utility::mo2f_debug_file('User id not found'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1317
+ $this->remove_current_activity($session_id_encrypt);
1318
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again..' ) );
1319
+ }
1320
+ }
1321
+ }
1322
+ }
1323
+ function check_rba_cancalation($POSTED){
1324
+ $nonce = sanitize_text_field($POSTED['mo2f_trust_device_cancel_nonce']);
1325
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-cancel-nonce' ) ) {
1326
+ $error = new WP_Error();
1327
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1328
+ return $error;
1329
+ } else {
1330
+ $this->miniorange_pass2login_start_session();
1331
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1332
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1333
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1334
+ }
1335
+ }
1336
+ function check_rba_validation($POSTED){
1337
+ $nonce = $POSTED['mo2f_trust_device_confirm_nonce'];
1338
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-confirm-nonce' ) ) {
1339
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id'] ): null;
1340
+ $this->remove_current_activity($session_id_encrypt);
1341
+ $error = new WP_Error();
1342
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR ' ) . '</strong>:' . mo2f_lt( 'Invalid Request.' ) );
1343
+ return $error;
1344
+ } else {
1345
+ $this->miniorange_pass2login_start_session();
1346
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1347
+ try {
1348
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1349
+ Global $Mo2fdbQueries;
1350
+ $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1351
+ $mo2f_rba_status = MO2f_Utility::mo2f_retrieve_user_temp_values( 'mo2f_rba_status',$session_id_encrypt );
1352
+ mo2f_register_profile( $email, 'true', $mo2f_rba_status );
1353
+ } catch ( Exception $e ) {
1354
+ echo $e->getMessage();
1355
+ }
1356
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1357
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1358
+ }
1359
+ }
1360
+
1361
+ function miniorange2f_back_to_inline_registration($POSTED)
1362
+ {
1363
+ $nonce = sanitize_text_field($_POST['miniorange_back_inline_reg_nonce']);
1364
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-back-inline-reg-nonce' ) ) {
1365
+ $error = new WP_Error();
1366
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1367
+ return $error;
1368
+ } else {
1369
+
1370
+ $session_id_encrypt = sanitize_text_field($POSTED['session_id']);
1371
+ $redirect_to = esc_url_raw($POSTED['redirect_to']);
1372
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1373
+ $mo2fa_login_message = '';
1374
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
1375
+ }
1376
+
1377
+ }
1378
+
1379
+ function check_miniorange_challenge_forgotphone($POSTED){/*check kba validation*/
1380
+ $nonce = sanitize_text_field($_POST['miniorange_forgotphone']);
1381
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
1382
+ $error = new WP_Error();
1383
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1384
+ return $error;
1385
+ } else {
1386
+ $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1387
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1388
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1389
+ $mo2fa_login_message = '';
1390
+ $this->miniorange_pass2login_start_session();
1391
+ $customer = new Customer_Setup();
1392
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1393
+ Global $Mo2fdbQueries;
1394
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1395
+ $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1396
+ if ( $kba_configuration_status ) {
1397
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
1398
+ $pass2fa_login = new Miniorange_Password_2Factor_Login();
1399
+ $pass2fa_login->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1400
+ } else {
1401
+ $hidden_user_email = MO2f_Utility::mo2f_get_hidden_email( $user_email );
1402
+ $content = json_decode( $customer->send_otp_token( $user_email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1403
+ if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1404
+ $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1405
+ MO2f_Utility::unset_session_variables( $session_cookie_variables );
1406
+ MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1407
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1408
+ //if the php session folder has insufficient permissions, cookies to be used
1409
+ MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_login_message', 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.' );
1410
+ MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_transactionId', $content['txId'] );
1411
+ $this->mo2f_transactionid=$content['txId'];
1412
+ $mo2fa_login_message = 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.';
1413
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
1414
+ } else {
1415
+ $mo2fa_login_message = 'Error occurred while sending OTP over email. Please try again.';
1416
+ }
1417
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id_encrypt );
1418
+ }
1419
+ $pass2fa_login = new Miniorange_Password_2Factor_Login();
1420
+ $pass2fa_login->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1421
+ }
1422
+ }
1423
+ function check_miniorange_alternate_login_kba($POSTED){
1424
+ $nonce = $POSTED['miniorange_alternate_login_kba_nonce'];
1425
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' ) ) {
1426
+ $error = new WP_Error();
1427
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1428
+ return $error;
1429
+ } else {
1430
+ $this->miniorange_pass2login_start_session();
1431
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1432
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1433
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1434
+ $this->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1435
+ }
1436
+ }
1437
+
1438
+ function check_miniorange_duo_push_validation($POSTED){
1439
+ global $moWpnsUtility;
1440
+ $nonce = $POSTED['miniorange_duo_push_validation_nonce'];
1441
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-duo-validation-nonce' ) ) {
1442
+ $error = new WP_Error();
1443
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1444
+ return $error;
1445
+ } else {
1446
+ $this->miniorange_pass2login_start_session();
1447
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1448
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1449
+
1450
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1451
+ if ( get_option( 'mo2f_remember_device' ) ) {
1452
+
1453
+ MO2f_Utility::mo2f_debug_file('Remember device- Duo push notification logged in successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1454
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1455
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null,$session_id_encrypt );
1456
+ } else {
1457
+ MO2f_Utility::mo2f_debug_file('Duo push notification - Logged in successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1458
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1459
+ }
1460
+
1461
+ }
1462
+ }
1463
+
1464
+ function check_miniorange_duo_push_validation_failed($POSTED){
1465
+ global $moWpnsUtility;
1466
+ $nonce = $POSTED['miniorange_duo_push_validation_failed_nonce'];
1467
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-duo-push-validation-failed-nonce' ) ) {
1468
+ $error = new WP_Error();
1469
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1470
+ return $error;
1471
+ } else {
1472
+ MO2f_Utility::mo2f_debug_file('Denied duo push notification'.' User_IP-'.$moWpnsUtility->get_client_ip());
1473
+ $this->miniorange_pass2login_start_session();
1474
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1475
+ $this->remove_current_activity($session_id_encrypt);
1476
+
1477
+ }
1478
+
1479
+ }
1480
+
1481
+ function check_miniorange_mobile_validation($POSTED){
1482
+ /*check mobile validation */
1483
+ global $moWpnsUtility;
1484
+ $nonce = $POSTED['miniorange_mobile_validation_nonce'];
1485
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-nonce' ) ) {
1486
+ $error = new WP_Error();
1487
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1488
+ return $error;
1489
+ } else {
1490
+ if(MO2F_IS_ONPREM && (isset($POSTED['tx_type']) && $POSTED['tx_type'] !='PN'))
1491
+ {
1492
+ $txid = $POSTED['TxidEmail'];
1493
+ $status = get_option($txid);
1494
+ if($status != '')
1495
+ {
1496
+ if($status != 1)
1497
+ {
1498
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1499
+ }
1500
+ }
1501
+ }
1502
+ $this->miniorange_pass2login_start_session();
1503
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1504
+ //if the php session folder has insufficient permissions, cookies to be used
1505
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1506
+ MO2f_Utility::mo2f_debug_file('Transaction_id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip());
1507
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1508
+ $checkMobileStatus = new Two_Factor_Setup();
1509
+ $content = $checkMobileStatus->check_mobile_status( $mo2f_login_transaction_id );
1510
+ $response = json_decode( $content, true );
1511
+ if(MO2F_IS_ONPREM)
1512
+ {
1513
+ MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip());
1514
+ $this->mo2fa_pass2login($redirect_to,$session_id_encrypt);
1515
+ }
1516
+ if ( json_last_error() == JSON_ERROR_NONE ) {
1517
+ if ( $response['status'] == 'SUCCESS' ) {
1518
+ if ( get_option( 'mo2f_remember_device' ) ) {
1519
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1520
+ MO2f_Utility::mo2f_debug_file('Remember device flow prompted'.' User_IP-'.$moWpnsUtility->get_client_ip());
1521
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null,$session_id_encrypt );
1522
+ } else {
1523
+ MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip());
1524
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1525
+ }
1526
+ } else {
1527
+ MO2f_Utility::mo2f_debug_file('Invalid_username'.' User_IP-'.$moWpnsUtility->get_client_ip());
1528
+ $this->remove_current_activity($session_id_encrypt);
1529
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1530
+ }
1531
+ } else {
1532
+ MO2f_Utility::mo2f_debug_file('Invalid_username'.' User_IP-'.$moWpnsUtility->get_client_ip());
1533
+ $this->remove_current_activity($session_id_encrypt);
1534
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again.' ) );
1535
+ }
1536
+ }
1537
+ }
1538
+ function check_miniorange_mobile_validation_failed($POSTED){
1539
+ /*Back to miniOrange Login Page if mobile validation failed and from back button of mobile challenge, soft token and default login*/
1540
+ $nonce = $POSTED['miniorange_mobile_validation_failed_nonce'];
1541
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-failed-nonce' ) ) {
1542
+ $error = new WP_Error();
1543
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1544
+ return $error;
1545
+ } else {
1546
+ MO2f_Utility::mo2f_debug_file('MO QR-code/push notification auth denied.');
1547
+ $this->miniorange_pass2login_start_session();
1548
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1549
+ $this->remove_current_activity($session_id_encrypt);
1550
+
1551
+ }
1552
+ }
1553
+
1554
+ function check_mo2f_duo_authenticator_success_form($POSTED){
1555
+ if(isset($POSTED['mo2f_duo_authenticator_success_nonce'])){
1556
+ $nonce = sanitize_text_field($POSTED['mo2f_duo_authenticator_success_nonce']);
1557
+ if ( ! wp_verify_nonce( $nonce, 'mo2f-duo-authenticator-success-nonce' ) ) {
1558
+ $error = new WP_Error();
1559
+ $error->add('empty_username', '<strong>'. __('ERROR','miniorange-2-factor-authentication') .'</strong>: '. __('Invalid Request.', 'miniorange-2-factor-authentication'));
1560
+ return $error;
1561
+ } else {
1562
+
1563
+ global $Mo2fdbQueries;
1564
+ $this->miniorange_pass2login_start_session();
1565
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1566
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1567
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1568
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1569
+ $selected_2factor_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user_id);
1570
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$user_id);
1571
+ $mo2fa_login_message = '';
1572
+
1573
+
1574
+ delete_user_meta($user_id,'user_not_enroll');
1575
+ delete_site_option('current_user_email');
1576
+ $Mo2fdbQueries->update_user_details( $user_id, array(
1577
+ 'mobile_registration_status' =>true,
1578
+ 'mo2f_DuoAuthenticator_config_status' => true,
1579
+ 'mo2f_configured_2FA_method' =>$selected_2factor_method ,
1580
+ 'mo_2factor_user_registration_status' => 'MO_2_FACTOR_PLUGIN_SETTINGS',
1581
+ ) );
1582
+ $mo2fa_login_status = 'MO_2_FACTOR_SETUP_SUCCESS';
1583
+
1584
+
1585
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
1586
+
1587
+ }
1588
+ }
1589
+ }
1590
+ function check_inline_mo2f_duo_authenticator_error($POSTED){
1591
+ $nonce = $POSTED['mo2f_inline_duo_authentcator_error_nonce'];
1592
+
1593
+ if ( ! wp_verify_nonce( $nonce, 'mo2f-inline-duo-authenticator-error-nonce' ) ) {
1594
+ $error = new WP_Error();
1595
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1596
+
1597
+ return $error;
1598
+ } else {
1599
+ global $Mo2fdbQueries;
1600
+ $this->miniorange_pass2login_start_session();
1601
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1602
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1603
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1604
+
1605
+
1606
+
1607
+ $Mo2fdbQueries->update_user_details( $user_id, array(
1608
+ 'mobile_registration_status' =>false,
1609
+ ) );
1610
+
1611
+ }
1612
+ }
1613
+ function check_miniorange_forgotphone($POSTED){
1614
+ $nonce = $POSTED['miniorange_forgotphone'];
1615
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
1616
+ $error = new WP_Error();
1617
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1618
+ return $error;
1619
+ } else {
1620
+ global $Mo2fdbQueries;
1621
+ $mo2fa_login_status = isset( $POSTED['request_origin_method'] ) ? $POSTED['request_origin_method'] : null;
1622
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1623
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1624
+ $mo2fa_login_message = '';
1625
+ $this->miniorange_pass2login_start_session();
1626
+ $customer = new Customer_Setup();
1627
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1628
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1629
+ $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user_id );
1630
+ if ( $kba_configuration_status ) {
1631
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
1632
+ $pass2fa_login = new Miniorange_Password_2Factor_Login();
1633
+ $pass2fa_login->mo2f_pass2login_kba_verification( $user_id, $redirect_to,$session_id_encrypt );
1634
+ } else {
1635
+ $hidden_user_email = MO2f_Utility::mo2f_get_hidden_email( $user_email );
1636
+ $content = json_decode( $customer->send_otp_token( $user_email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1637
+ if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1638
+ $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1639
+ MO2f_Utility::unset_session_variables( $session_cookie_variables );
1640
+ MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1641
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt );
1642
+ //if the php session folder has insufficient permissions, cookies to be used
1643
+ MO2f_Utility::set_user_values( $session_id_encrypt,'mo2f_login_message', 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.' );
1644
+ MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_transactionId', $content['txId'] );
1645
+ $this->mo2f_transactionid=$content['txId'];
1646
+ $mo2fa_login_message = 'A one time passcode has been sent to <b>' . $hidden_user_email . '</b>. Please enter the OTP to verify your identity.';
1647
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
1648
+ } else {
1649
+ $mo2fa_login_message = 'Error occurred while sending OTP over email. Please try again.';
1650
+ }
1651
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id_encrypt );
1652
+ }
1653
+ $pass2fa_login = new Miniorange_Password_2Factor_Login();
1654
+ $pass2fa_login->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1655
+ }
1656
+ }
1657
+ function check_miniorange_softtoken($POSTED){
1658
+ /*Click on the link of phone is offline */
1659
+ $nonce = $POSTED['miniorange_softtoken'];
1660
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-softtoken' ) ) {
1661
+ $error = new WP_Error();
1662
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1663
+ return $error;
1664
+ } else {
1665
+ $this->miniorange_pass2login_start_session();
1666
+ $session_id_encrypt = isset( $POSTED['session_id'] ) ? $POSTED['session_id'] : null;
1667
+ $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
1668
+ MO2f_Utility::unset_session_variables( $session_cookie_variables );
1669
+ MO2f_Utility::unset_cookie_variables( $session_cookie_variables );
1670
+ MO2f_Utility::unset_temp_user_details_in_table('mo2f_transactionId',$session_id_encrypt );
1671
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1672
+ $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
1673
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
1674
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1675
+ }
1676
+ }
1677
+ function check_miniorange_soft_token($POSTED){
1678
+ /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
1679
+ global $moWpnsUtility;
1680
+ $nonce = sanitize_text_field($_POST['miniorange_soft_token_nonce']);
1681
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-soft-token-nonce' ) ) {
1682
+ $error = new WP_Error();
1683
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1684
+ return $error;
1685
+ }else {
1686
+ $this->miniorange_pass2login_start_session();
1687
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1688
+ $mo2fa_login_status = isset( $_POST['request_origin_method'] ) ? sanitize_text_field($_POST['request_origin_method']) : null;
1689
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
1690
+ $softtoken = '';
1691
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1692
+ $attempts = get_option('mo2f_attempts_before_redirect', 3);
1693
+ if ( MO2f_utility::mo2f_check_empty_or_null( $_POST['mo2fa_softtoken'] ) ) {
1694
+ if($attempts>1 || $attempts=='disabled')
1695
+ {
1696
+ update_option('mo2f_attempts_before_redirect', $attempts-1 );
1697
+ $mo2fa_login_message = 'Please enter OTP to proceed.';
1698
+ MO2f_Utility::mo2f_debug_file('Please enter OTP to proceed'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1699
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1700
+ }else{
1701
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1702
+ $this->remove_current_activity($session_id_encrypt);
1703
+ MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1704
+ return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1705
+ }
1706
+ } else {
1707
+ $softtoken = sanitize_text_field( $_POST['mo2fa_softtoken'] );
1708
+ if ( ! MO2f_utility::mo2f_check_number_length( $softtoken ) ) {
1709
+ if($attempts>1|| $attempts=='disabled')
1710
+ {
1711
+ update_option('mo2f_attempts_before_redirect', $attempts-1 );
1712
+ $mo2fa_login_message = 'Invalid OTP. Only digits within range 4-8 are allowed. Please try again.';
1713
+ MO2f_Utility::mo2f_debug_file('Invalid OTP. Only digits within range 4-8 are allowed'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1714
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
1715
+ }else{
1716
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1717
+ $this->remove_current_activity($session_id_encrypt);
1718
+ update_option('mo2f_attempts_before_redirect', 3);
1719
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
1720
+ $data = array('reload' => "reload", );
1721
+ wp_send_json_success($data);
1722
+ }
1723
+ else{
1724
+ MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id);
1725
+ return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1726
+ }
1727
+ }
1728
+ }
1729
+ }
1730
+
1731
+ global $Mo2fdbQueries;
1732
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
1733
+ if ( isset( $user_id ) ) {
1734
+ $customer = new Customer_Setup();
1735
+ $content = '';
1736
+ $current_user = get_userdata($user_id);
1737
+ //if the php session folder has insufficient permissions, cookies to be used
1738
+ $mo2f_login_transaction_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1739
+ $mo2f_login_transaction_id = isset($_POST['mo2fa_transaction_id'])?sanitize_text_field($_POST['mo2fa_transaction_id']):MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId');
1740
+ MO2f_Utility::mo2f_debug_file('Transaction_id-'.$mo2f_login_transaction_id.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1741
+ if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ) {
1742
+ $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 );
1743
+ }elseif (isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP' ) {
1744
+
1745
+ $otpToken = get_user_meta($current_user->ID,'mo2f_otp_token_wa',true);
1746
+ $time = get_user_meta($current_user->ID,'mo2f_whatsapp_time',true);
1747
+ $accepted_time = time()-600;
1748
+ $time = (int)$time;
1749
+ global $Mo2fdbQueries;
1750
+
1751
+ if($softtoken == $otpToken)
1752
+ {
1753
+ if($accepted_time<$time){
1754
+ update_option('mo2f_attempts_before_redirect', 3);
1755
+ if ( get_option( 'mo2f_remember_device' ) ) {
1756
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1757
+ MO2f_Utility::mo2f_debug_file('Remeber device setup'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1758
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1759
+ }
1760
+ else{
1761
+
1762
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1763
+ }
1764
+ }
1765
+ else
1766
+ {
1767
+ $this->remove_current_activity($session_id_encrypt);
1768
+
1769
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: OTP has been Expired please reinitiate another transaction.' ) );
1770
+
1771
+ }
1772
+ }
1773
+ else
1774
+ {
1775
+
1776
+ update_option('mo2f_attempts_before_redirect', $attempts-1);
1777
+ $message = 'Invalid OTP please enter again.';
1778
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1779
+
1780
+ }
1781
+ }
1782
+ elseif (isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM' ) {
1783
+
1784
+ $otpToken = get_user_meta($current_user->ID,'mo2f_otp_token',true);
1785
+ $time = get_user_meta($current_user->ID,'mo2f_telegram_time',true);
1786
+ $accepted_time = time()-300;
1787
+ $time = (int)$time;
1788
+ global $Mo2fdbQueries;
1789
+
1790
+ if($softtoken == $otpToken)
1791
+ {
1792
+ if($accepted_time<$time){
1793
+ update_option('mo2f_attempts_before_redirect', 3);
1794
+ if ( get_option( 'mo2f_remember_device' ) ) {
1795
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1796
+ MO2f_Utility::mo2f_debug_file('Remember device flow'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1797
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1798
+ }
1799
+ else{
1800
+ MO2f_Utility::mo2f_debug_file('OTP over Telegram - Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1801
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1802
+ }
1803
+ }
1804
+ else
1805
+ {
1806
+ $this->remove_current_activity($session_id_encrypt);
1807
+ MO2f_Utility::mo2f_debug_file('OTP has been Expired please reinitiate another transaction'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1808
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: OTP has been Expired please reinitiate another transaction.' ) );
1809
+
1810
+ }
1811
+ }
1812
+ else
1813
+ {
1814
+ MO2f_Utility::mo2f_debug_file('OTP over Telegram - Invalid OTP'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1815
+ update_option('mo2f_attempts_before_redirect', $attempts-1);
1816
+ $message = 'Invalid OTP please enter again.';
1817
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1818
+
1819
+ }
1820
+ }
1821
+ else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' ) {
1822
+ $content = json_decode( $customer->validate_otp_token( 'SMS', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1823
+ } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION' ) {
1824
+ $content = json_decode( $customer->validate_otp_token( 'PHONE VERIFICATION', null, $mo2f_login_transaction_id, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1825
+ } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ) {
1826
+ $content = json_decode( $customer->validate_otp_token( 'SOFT TOKEN', $user_email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1827
+ } else if ( isset( $mo2fa_login_status ) && $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION' ) {
1828
+ $content = json_decode( $customer->validate_otp_token( 'GOOGLE AUTHENTICATOR', $user_email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
1829
+ } else {
1830
+ $this->remove_current_activity($session_id_encrypt);
1831
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Invalid Request. Please try again.' ) );
1832
+ }
1833
+ if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
1834
+ update_option('mo2f_attempts_before_redirect', 3);
1835
+ if ( get_option( 'mo2f_remember_device' ) ) {
1836
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
1837
+ MO2f_Utility::mo2f_debug_file('Remember device flow'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1838
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to,null,$session_id_encrypt );
1839
+ } else {
1840
+ if($mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL')
1841
+ {
1842
+ $Mo2fdbQueries->update_user_details( $user_id, array('mo2f_configured_2FA_method' =>'OTP Over Email','mo_2factor_user_registration_status' =>'MO_2_FACTOR_PLUGIN_SETTINGS', 'mo2f_OTPOverEmail_config_status' => 1) );
1843
+ $enduser = new Two_Factor_Setup();
1844
+
1845
+ $enduser->mo2f_update_userinfo( $user_email, 'OTP Over Email', null, null, null );
1846
+
1847
+ }
1848
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Logged in successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1849
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
1850
+ }
1851
+ } else {
1852
+ if($attempts>1 || $attempts=='disabled')
1853
+ {
1854
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Enter wrong OTP'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1855
+ update_option('mo2f_attempts_before_redirect', $attempts-1);
1856
+ $message = $mo2fa_login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ? 'You have entered an invalid OTP.<br>Please click on <b>Sync Time</b> in the miniOrange Authenticator app to sync your phone time with the miniOrange servers and try again.' : 'Invalid OTP. Please try again.';
1857
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $message, $redirect_to,null,$session_id_encrypt );
1858
+ }else{
1859
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1860
+ $this->remove_current_activity($session_id_encrypt);
1861
+ update_option('mo2f_attempts_before_redirect', 3);
1862
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
1863
+ $data = array('reload' => "reload", );
1864
+ wp_send_json_success($data);
1865
+ }
1866
+ else{
1867
+ MO2f_Utility::mo2f_debug_file('Number of attempts exceeded'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1868
+ return new WP_Error( 'limit_exceeded', '<strong>ERROR</strong>: Number of attempts exceeded.');
1869
+ }
1870
+
1871
+ }
1872
+ }
1873
+ } else {
1874
+ $this->remove_current_activity($session_id_encrypt);
1875
+ MO2f_Utility::mo2f_debug_file('User id not found'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user_id.' Email-'.$user_email);
1876
+ return new WP_Error( 'invalid_username', __( '<strong>ERROR</strong>: Please try again..' ) );
1877
+ }
1878
+ }
1879
+ }
1880
+ function check_miniorange_attribute_collection($POSTED){
1881
+ $nonce = $POSTED['miniorange_attribute_collection_nonce'];
1882
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-attribute-collection-nonce' ) ) {
1883
+ $error = new WP_Error();
1884
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1885
+ return $error;
1886
+ } else {
1887
+ $this->miniorange_pass2login_start_session();
1888
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
1889
+ $currentuser = get_user_by( 'id', $user_id );
1890
+ $attributes = isset( $POSTED['miniorange_rba_attribures'] ) ? $POSTED['miniorange_rba_attribures'] : null;
1891
+ $redirect_to = isset( $POSTED['redirect_to'] ) ? esc_url_raw($POSTED['redirect_to']) : null;
1892
+ $session_id = isset( $POSTED['session_id'] ) ? sanitize_text_field($POSTED['session_id']) : null;
1893
+ $this->miniorange_initiate_2nd_factor( $currentuser, $attributes, $redirect_to,$session_id );
1894
+ }
1895
+ }
1896
+ function check_miniorange_inline_skip_registration($POSTED){
1897
+ $error = new WP_Error();
1898
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
1899
+ }
1900
+ function miniorange_pass2login_redirect() {
1901
+ do_action('mo2f_network_init');
1902
+ global $Mo2fdbQueries;
1903
+
1904
+ if ( ! MoWpnsUtility::get_mo2f_db_option('mo2f_login_option', 'get_option') ) {
1905
+ if ( isset( $_POST['miniorange_login_nonce'] ) ) {
1906
+ $nonce = sanitize_text_field($_POST['miniorange_login_nonce']);
1907
+ $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
1908
+
1909
+ if(is_null($session_id)) {
1910
+ $session_id=$this->create_session();
1911
+ }
1912
+
1913
+
1914
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' ) ) {
1915
+ $this->remove_current_activity($session_id);
1916
+ $error = new WP_Error();
1917
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
1918
+ return $error;
1919
+ } else {
1920
+ $this->miniorange_pass2login_start_session();
1921
+ $mobile_login = new Miniorange_Mobile_Login();
1922
+ //validation and sanitization
1923
+ $username = isset( $_POST['mo2fa_username'] ) ? sanitize_text_field($_POST['mo2fa_username']) : '';
1924
+ if ( MO2f_Utility::mo2f_check_empty_or_null( $username ) ) {
1925
+ MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please enter username to proceed' );
1926
+ $mobile_login->mo_auth_show_error_message();
1927
+ return;
1928
+ } else {
1929
+ $username = sanitize_text_field( $_POST['mo2fa_username'] );
1930
+ }
1931
+ if ( username_exists( $username ) ) { /*if username exists in wp site */
1932
+ $user = new WP_User( $username );
1933
+ $redirect_to = isset( $_REQUEST['redirect_to'] ) ? esc_url_raw($_REQUEST['redirect_to']) : null;
1934
+
1935
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_current_user_id', $user->ID, 600);
1936
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
1937
+
1938
+
1939
+ $this->mo2f_userId=$user->ID;
1940
+ $this->fstfactor='VALIDATE_SUCCESS';
1941
+ $current_roles = miniorange_get_user_role( $user );
1942
+ $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1943
+ $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
1944
+ $mo_2factor_user_registration_status = $Mo2fdbQueries->get_user_detail( 'mo_2factor_user_registration_status', $user->ID );
1945
+ $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $user->ID );
1946
+
1947
+ if(MO2F_IS_ONPREM )
1948
+ {
1949
+ $mo_2factor_user_registration_status = 'MO_2_FACTOR_PLUGIN_SETTINGS';
1950
+
1951
+ }
1952
+ if ( $mo2f_configured_2FA_method ) {
1953
+ if ( $email && $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS' or (MO2F_IS_ONPREM and $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS')) {
1954
+ if ( MO2f_Utility::check_if_request_is_from_mobile_device( $_SERVER['HTTP_USER_AGENT'] ) && $kba_configuration_status ) {
1955
+ $this->mo2f_pass2login_kba_verification( $user->ID, $redirect_to, $session_id );
1956
+ } else {
1957
+ $mo2f_second_factor = '';
1958
+
1959
+ if(MO2F_IS_ONPREM)
1960
+ {
1961
+ global $Mo2fdbQueries;
1962
+ $mo2f_second_factor = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
1963
+ if($mo2f_second_factor == 'Security Questions')
1964
+ {
1965
+ $mo2f_second_factor = 'KBA';
1966
+ }
1967
+ else if($mo2f_second_factor == 'Google Authenticator')
1968
+ {
1969
+ $mo2f_second_factor = 'GOOGLE AUTHENTICATOR';
1970
+ }
1971
+ else if($mo2f_second_factor == 'Email Verification'){
1972
+ $mo2f_second_factor = 'Email Verification';
1973
+ }
1974
+ else if($mo2f_second_factor == 'OTP Over SMS'){
1975
+ $mo2f_second_factor = 'SMS';
1976
+ }
1977
+ else if($mo2f_second_factor == 'OTP Over Email'){
1978
+ $mo2f_second_factor = 'EMAIL';
1979
+ }
1980
+ elseif($mo2f_second_factor == 'miniOrange Soft Token'){
1981
+ $mo2f_second_factor = "SOFT TOKEN";
1982
+ }
1983
+ else if($mo2f_second_factor == "miniOrange Push Notification"){
1984
+ $mo2f_second_factor = "PUSH NOTIFICATIONS";
1985
+ }
1986
+ else if($mo2f_second_factor == "miniOrange QR Code Authentication"){
1987
+ $mo2f_second_factor = "MOBILE AUTHENTICATION";
1988
+ }
1989
+ }else{
1990
+ $mo2f_second_factor = mo2f_get_user_2ndfactor( $user );
1991
+ }
1992
+ if ( $mo2f_second_factor == 'MOBILE AUTHENTICATION' ) {
1993
+ $this->mo2f_pass2login_mobile_verification( $user, $redirect_to, $session_id );
1994
+ } else if ( $mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL' ) {
1995
+ $this->mo2f_pass2login_push_oobemail_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
1996
+ }
1997
+ else if($mo2f_second_factor == 'Email Verification'){
1998
+ $this->mo2f_pass2login_push_oobemail_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
1999
+ }
2000
+ else if ( $mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' || $mo2f_second_factor == 'OTP Over Telegram'|| $mo2f_second_factor == 'EMAIL' || $mo2f_second_factor == "OTP Over Email") {
2001
+ $this->mo2f_pass2login_otp_verification( $user, $mo2f_second_factor, $redirect_to, $session_id );
2002
+ } else if ( $mo2f_second_factor == 'KBA' ) {
2003
+ $this->mo2f_pass2login_kba_verification( $user->ID, $redirect_to, $session_id );
2004
+ } else {
2005
+ $this->remove_current_activity($session_id);
2006
+ MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please try again or contact your admin.' );
2007
+ $mobile_login->mo_auth_show_success_message();
2008
+ }
2009
+ }
2010
+ } else {
2011
+ MO2f_Utility::set_user_values($session_id, 'mo2f_login_message', 'Please login into your account using password.' );
2012
+ $mobile_login->mo_auth_show_success_message('Please login into your account using password.');
2013
+ update_user_meta($user->ID,'userMessage','Please login into your account using password.');
2014
+ $mobile_login->mo2f_redirectto_wp_login();
2015
+ }
2016
+ } else {
2017
+ MO2f_Utility::set_user_values( $session_id, "mo2f_login_message", 'Please login into your account using password.' );
2018
+ $mobile_login->mo_auth_show_success_message('Please login into your account using password.');
2019
+ update_user_meta($user->ID,'userMessage','Please login into your account using password.');
2020
+ $mobile_login->mo2f_redirectto_wp_login();
2021
+ }
2022
+ } else {
2023
+ $mobile_login->remove_current_activity($session_id);
2024
+ MO2f_Utility::set_user_values( $session_id, "mo2f_login_message", 'Invalid Username.' );
2025
+ $mobile_login->mo_auth_show_error_message('Invalid Username.');
2026
+ }
2027
+ }
2028
+ }
2029
+
2030
+ }
2031
+ if(isset($_GET['reconfigureMethod'])){
2032
+ $userIDGet = isset($_GET['user_id'])?sanitize_text_field($_GET['user_id']):'';
2033
+ $txidGet = isset($_GET['transactionId'])?sanitize_text_field($_GET['transactionId']):'';
2034
+ $methodGet = isset($_GET['reconfigureMethod'])?sanitize_text_field($_GET['reconfigureMethod']):'';
2035
+ if(get_site_option($txidGet) && get_site_option($userIDGet)){
2036
+ $user_id = get_site_option($userIDGet);
2037
+ $method = get_site_option($methodGet);
2038
+ $Mo2fdbQueries->update_user_details( $user_id, array(
2039
+ 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS',
2040
+ 'mo2f_configured_2FA_method' => $method
2041
+ ) );
2042
+ $is_Authy_configured = $Mo2fdbQueries->get_user_detail('mo2f_AuthyAuthenticator_config_status',$user_id);
2043
+ if($method == 'Google Authenticator' || $is_Authy_configured){
2044
+ update_user_meta($user_id,'mo2fa_set_Authy_inline',true);
2045
+ }
2046
+ }else{
2047
+ $head = "You are not authorized to perform this action";
2048
+ $body = "Please contact to your admin";
2049
+ $this->display_email_verification($head,$body,'red');
2050
+ exit();
2051
+ }
2052
+ delete_site_option($userIDGet);
2053
+ delete_site_option($txidGet);
2054
+ }
2055
+ if(isset($_GET['Txid'])&&isset($_GET['accessToken']))
2056
+ {
2057
+ $userIDGet = sanitize_text_field($_GET['userID']);
2058
+ $txIdGet = sanitize_text_field($_GET['Txid']);
2059
+ $otpToken = get_site_option($userIDGet);
2060
+ $txidstatus = get_site_option($txIdGet);
2061
+ $userIDd = $userIDGet.'D';
2062
+ $otpTokenD = get_site_option($userIDd);
2063
+ $mo2f_dirName = dirname(__FILE__);
2064
+ $mo2f_dirName = explode('wp-content', $mo2f_dirName);
2065
+ $mo2f_dirName = explode('handler', $mo2f_dirName[1]);
2066
+
2067
+ $head = "You are not authorized to perform this action";
2068
+ $body = "Please contact to your admin";
2069
+ $color = "red";
2070
+ if(3 == $txidstatus)
2071
+ {
2072
+ $time = "time".$txIdGet;
2073
+ $currentTimeInMillis = round(microtime(true) * 1000);
2074
+ $generatedTimeINMillis = get_site_option($time);
2075
+ $difference = ($currentTimeInMillis-$generatedTimeINMillis)/1000 ;
2076
+ if($difference <= 300)
2077
+ {
2078
+ $accessTokenGet = sanitize_text_field($_GET['accessToken']);
2079
+ if( $accessTokenGet == $otpToken)
2080
+ {
2081
+ update_site_option($txIdGet,1);
2082
+ $body = "Transaction has been successfully validated.<br><br>Please continue with the transaction.";
2083
+ $head = "TRANSACTION SUCCESSFUL";
2084
+ $color = "green";
2085
+ }
2086
+ else if($accessTokenGet==$otpTokenD)
2087
+ {
2088
+ update_site_option($txIdGet,0);
2089
+ $body = "Transaction has been Canceled.<br><br>Please Try Again.";
2090
+ $head = "TRANSACTION DENIED";
2091
+ }
2092
+ }
2093
+ delete_site_option($userIDGet);
2094
+ delete_site_option($userIDd);
2095
+ delete_site_option($time);
2096
+
2097
+ }
2098
+
2099
+ $this->display_email_verification($head,$body,$color);
2100
+ exit;
2101
+
2102
+ }
2103
+ elseif (isset($_POST['emailInlineCloud'])) {
2104
+ $nonce = sanitize_text_field($_POST['miniorange_emailChange_nonce']);
2105
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-email-change-nonce' ) ) {
2106
+ $error = new WP_Error();
2107
+ $error->add( 'empty_username', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Request.' ) );
2108
+ return $error;
2109
+ } else {
2110
+ $email = sanitize_text_field($_POST['emailInlineCloud']);
2111
+ $current_user_id = sanitize_text_field($_POST['current_user_id']);
2112
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
2113
+ $redirect_to = isset( $_POST['redirect_to'] ) ? esc_url_raw($_POST['redirect_to']) : null;
2114
+ if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
2115
+ global $Mo2fdbQueries;
2116
+ $Mo2fdbQueries->update_user_details( $current_user_id, array( "mo2f_user_email" => $email, "mo2f_configured_2FA_method" => '' ) );
2117
+ prompt_user_to_select_2factor_mthod_inline($current_user_id,'MO_2_FACTOR_INITIALIZE_TWO_FACTOR','',$redirect_to,$session_id_encrypt,null);
2118
+ }
2119
+ }
2120
+ }
2121
+ else if(isset($_POST['txid']))
2122
+ {
2123
+ $txidpost = sanitize_text_field($_POST['txid']);
2124
+ $status = get_site_option($txidpost);
2125
+ update_option('optionVal1',$status); //??
2126
+ if($status ==1 || $status ==0)
2127
+ delete_site_option($txidpost);
2128
+ echo $status;
2129
+ exit();
2130
+ }
2131
+
2132
+
2133
+
2134
+ else{
2135
+
2136
+ $value=isset($_POST['option'])?sanitize_text_field($_POST['option']):false;
2137
+
2138
+ switch ($value) {
2139
+ case 'miniorange_rba_validate':
2140
+ $this->check_rba_validation($_POST);
2141
+ break;
2142
+
2143
+ case 'miniorange_rba_cancle':
2144
+
2145
+ $this->check_rba_cancalation($_POST);
2146
+ break;
2147
+
2148
+ case 'miniorange_forgotphone':
2149
+ $this->check_miniorange_challenge_forgotphone($_POST);
2150
+ break;
2151
+
2152
+ case 'miniorange2f_back_to_inline_registration':
2153
+ $this->miniorange2f_back_to_inline_registration($_POST);
2154
+ exit;
2155
+
2156
+ case 'miniorange_alternate_login_kba':
2157
+
2158
+ $this->check_miniorange_alternate_login_kba($_POST);
2159
+ break;
2160
+
2161
+ case 'miniorange_kba_validate':
2162
+ $this->check_kba_validation($_POST);
2163
+
2164
+ break;
2165
+
2166
+ case 'miniorange_mobile_validation':
2167
+ $this->check_miniorange_mobile_validation($_POST);
2168
+ break;
2169
+
2170
+ case 'miniorange_duo_push_validation':
2171
+ $this->check_miniorange_duo_push_validation($_POST);
2172
+ break;
2173
+
2174
+ case 'mo2f_inline_duo_authenticator_success_form':
2175
+ $this->check_mo2f_duo_authenticator_success_form($_POST);
2176
+ break;
2177
+
2178
+ case 'mo2f_inline_duo_authenticator_error':
2179
+ $this->check_inline_mo2f_duo_authenticator_error($_POST);
2180
+ break;
2181
+
2182
+ case 'miniorange_mobile_validation_failed':
2183
+ $this->check_miniorange_mobile_validation_failed($_POST);
2184
+ break;
2185
+
2186
+ case 'miniorange_duo_push_validation_failed':
2187
+ $this->check_miniorange_duo_push_validation_failed($_POST);
2188
+ break;
2189
+
2190
+ case 'miniorange_softtoken':
2191
+ $this->check_miniorange_softtoken($_POST);
2192
+
2193
+ break;
2194
+
2195
+
2196
+ case 'miniorange_soft_token':
2197
+
2198
+ $this->check_miniorange_soft_token($_POST);
2199
+ break;
2200
+
2201
+ case 'miniorange_inline_skip_registration':
2202
+ $this->check_miniorange_inline_skip_registration($_POST);
2203
+ break;
2204
+
2205
+ case 'miniorange_attribute_collection':
2206
+ $this->check_miniorange_attribute_collection($_POST);
2207
+ break;
2208
+
2209
+ case 'miniorange_inline_save_2factor_method':
2210
+ $this->save_inline_2fa_method();
2211
+ break;
2212
+
2213
+ case 'mo2f_skip_2fa_setup':
2214
+ $this->mo2f_skip_2fa_setup();
2215
+ break;
2216
+
2217
+ case 'miniorange_back_inline':
2218
+ $this->back_to_select_2fa();
2219
+ break;
2220
+
2221
+ case 'miniorange_inline_ga_validate':
2222
+ $this->inline_validate_and_set_ga();
2223
+ break;
2224
+
2225
+ case 'miniorange_inline_show_mobile_config':
2226
+ $this->inline_mobile_configure();
2227
+ break;
2228
+
2229
+ case 'miniorange_inline_complete_mobile':
2230
+ $this->mo2f_inline_validate_mobile_authentication();
2231
+ break;
2232
+ case 'miniorange_inline_duo_auth_mobile_complete':
2233
+ $this->mo2f_inline_validate_duo_authentication();
2234
+ break;
2235
+ case 'duo_mobile_send_push_notification_for_inline_form':
2236
+ $this->mo2f_duo_mobile_send_push_notification_for_inline_form();
2237
+ break;
2238
+ case 'mo2f_inline_kba_option':
2239
+ $this->mo2f_inline_validate_kba();
2240
+ break;
2241
+
2242
+ case 'miniorange_inline_complete_otp_over_sms':
2243
+ $this->mo2f_inline_send_otp();
2244
+ break;
2245
+
2246
+ case 'miniorange_inline_complete_otp':
2247
+ $this->mo2f_inline_validate_otp();
2248
+ break;
2249
+
2250
+ case 'miniorange_inline_login':
2251
+ $this->mo2f_inline_login();
2252
+ break;
2253
+ case 'miniorange_inline_register':
2254
+ $this->mo2f_inline_register();
2255
+ break;
2256
+ case 'mo2f_users_backup1':
2257
+ $this->mo2f_download_backup_codes_inline();
2258
+ break;
2259
+ case 'mo2f_goto_wp_dashboard':
2260
+ $this->mo2f_goto_wp_dashboard();
2261
+ break;
2262
+ case 'miniorange_backup_nonce':
2263
+ $this->mo2f_use_backup_codes($_POST);
2264
+ break;
2265
+ case 'miniorange_validate_backup_nonce':
2266
+ $this->check_backup_codes_validation($_POST);
2267
+ break;
2268
+ case 'miniorange_create_backup_codes':
2269
+ $this->mo2f_create_backup_codes();
2270
+ break;
2271
+ default:
2272
+ $error = new WP_Error();
2273
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Invalid Request.' ) );
2274
+
2275
+ return $error;
2276
+ break;
2277
+
2278
+
2279
+ }
2280
+ }
2281
+ }
2282
+
2283
+ function deniedMessage($message)
2284
+ {
2285
+ if(empty($message) && get_option("deniedMessage") )
2286
+ {
2287
+ delete_option('deniedMessage');
2288
+ }
2289
+ else
2290
+ return $message;
2291
+ }
2292
+ function remove_current_activity($session_id) {
2293
+ global $Mo2fdbQueries;
2294
+ $session_variables = array(
2295
+ 'mo2f_current_user_id',
2296
+ 'mo2f_1stfactor_status',
2297
+ 'mo_2factor_login_status',
2298
+ 'mo2f-login-qrCode',
2299
+ 'mo2f_transactionId',
2300
+ 'mo2f_login_message',
2301
+ 'mo2f_rba_status',
2302
+ 'mo_2_factor_kba_questions',
2303
+ 'mo2f_show_qr_code',
2304
+ 'mo2f_google_auth',
2305
+ 'mo2f_authy_keys'
2306
+ );
2307
+
2308
+ $cookie_variables = array(
2309
+ 'mo2f_current_user_id',
2310
+ 'mo2f_1stfactor_status',
2311
+ 'mo_2factor_login_status',
2312
+ 'mo2f-login-qrCode',
2313
+ 'mo2f_transactionId',
2314
+ 'mo2f_login_message',
2315
+ 'mo2f_rba_status_status',
2316
+ 'mo2f_rba_status_sessionUuid',
2317
+ 'mo2f_rba_status_decision_flag',
2318
+ 'kba_question1',
2319
+ 'kba_question2',
2320
+ 'mo2f_show_qr_code',
2321
+ 'mo2f_google_auth',
2322
+ 'mo2f_authy_keys'
2323
+ );
2324
+
2325
+ $temp_table_variables = array(
2326
+ 'session_id',
2327
+ 'mo2f_current_user_id',
2328
+ 'mo2f_login_message',
2329
+ 'mo2f_1stfactor_status',
2330
+ 'mo2f_transactionId',
2331
+ 'mo_2_factor_kba_questions',
2332
+ 'mo2f_rba_status',
2333
+ 'ts_created'
2334
+ );
2335
+
2336
+ MO2f_Utility::unset_session_variables( $session_variables );
2337
+ MO2f_Utility::unset_cookie_variables( $cookie_variables );
2338
+ $key = get_option( 'mo2f_encryption_key' );
2339
+ $session_id = MO2f_Utility::decrypt_data( $session_id, $key );
2340
+ $Mo2fdbQueries->save_user_login_details( $session_id, array(
2341
+
2342
+ 'mo2f_current_user_id' => '',
2343
+ 'mo2f_login_message' => '',
2344
+ 'mo2f_1stfactor_status' => '',
2345
+ 'mo2f_transactionId' => '',
2346
+ 'mo_2_factor_kba_questions' => '',
2347
+ 'mo2f_rba_status' => '',
2348
+ 'ts_created' => ''
2349
+ ) );
2350
+
2351
+
2352
+ }
2353
+ function mo2f_ultimate_member_custom_login(){
2354
+ echo '<div id="mo2f_um_validate_otp" class="um-field um-field-password um-field-user_password um-field-password um-field-type_password" data-key="user_password"><div class="um-field-label"><label for="mo2f_um_validate_otp">Two factor code*</label><div class="um-clear"></div></div><div class="um-field-area"><input class="um-form-field valid " type="text" name="mo2f_validate_otp_token" id="mo2f_um_validate_otp" value="" placeholder="" data-validate="" data-key="user_password">
2355
+
2356
+ </div></div>';
2357
+ }
2358
+
2359
+ public function miniorange_pass2login_start_session() {
2360
+ if ( ! session_id() || session_id() == '' || ! isset( $_SESSION ) ) {
2361
+ $session_path = ini_get('session.save_path');
2362
+ if( is_writable($session_path) && is_readable($session_path) ) {
2363
+ if(session_status() != PHP_SESSION_DISABLED )
2364
+ session_start();
2365
+ }
2366
+ }
2367
+ }
2368
+
2369
+ function mo2f_pass2login_kba_verification( $user_id, $redirect_to, $session_id ) {
2370
+ global $Mo2fdbQueries,$LoginuserID;
2371
+ $LoginuserID = $user_id;
2372
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user_id );
2373
+ if(is_null($session_id)) {
2374
+ $session_id=$this->create_session();
2375
+ }
2376
+ if(MO2F_IS_ONPREM){
2377
+ $question_answers = get_user_meta($user_id , 'mo2f_kba_challenge', true);
2378
+ $challenge_questions = array_keys($question_answers);
2379
+ $random_keys = array_rand($challenge_questions,2);
2380
+ $challenge_ques1 = $challenge_questions[$random_keys[0]];
2381
+ $challenge_ques2 = $challenge_questions[$random_keys[1]];
2382
+ $questions[0] = array('question'=>addslashes($challenge_ques1));
2383
+ $questions[1] = array('question'=>addslashes($challenge_ques2));
2384
+ update_user_meta( $user_id, 'kba_questions_user', $questions );
2385
+ $mo2fa_login_message = 'Please answer the following questions:';
2386
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2387
+ $mo2f_kbaquestions = $questions;
2388
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2389
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2390
+ }
2391
+
2392
+ else{
2393
+ $challengeKba = new Customer_Setup();
2394
+ $content = $challengeKba->send_otp_token( $user_email, 'KBA', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2395
+ $response = json_decode( $content, true );
2396
+ if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2397
+ if ( $response['status'] == 'SUCCESS' ) {
2398
+ MO2f_Utility::set_user_values( $session_id,"mo2f_transactionId", $response['txId'] );
2399
+ $this->mo2f_transactionid = $response['txId'];
2400
+ $questions = array();
2401
+ $questions[0] = $response['questions'][0];
2402
+ $questions[1] = $response['questions'][1];
2403
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo_2_factor_kba_questions', $questions);
2404
+ $this->mo2f_kbaquestions=$questions;
2405
+ $mo2fa_login_message = 'Please answer the following questions:';
2406
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
2407
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id ,$this->mo2f_kbaquestions );
2408
+ } else if ( $response['status'] == 'ERROR' ) {
2409
+ $this->remove_current_activity($session_id);
2410
+ $error = new WP_Error();
2411
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2412
+
2413
+ return $error;
2414
+ }
2415
+ } else {
2416
+ $this->remove_current_activity($session_id);
2417
+ $error = new WP_Error();
2418
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2419
+
2420
+ return $error;
2421
+ }
2422
+ }
2423
+ }
2424
+
2425
+ function miniorange_pass2login_form_fields( $mo2fa_login_status = null, $mo2fa_login_message = null, $redirect_to = null, $qrCode = null, $session_id_encrypt=null,$show_back_button =null ,$mo2fa_transaction_id =false ) {
2426
+
2427
+ $login_status = $mo2fa_login_status;
2428
+ $login_message = $mo2fa_login_message;
2429
+ switch ($login_status) {
2430
+ case 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION':
2431
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2432
+ mo2f_get_qrcode_authentication_prompt( $login_status, $login_message, $redirect_to, $qrCode, $session_id_encrypt, $transactionid );
2433
+ exit;
2434
+ break;
2435
+ case 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN':
2436
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2437
+
2438
+
2439
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2440
+ exit;
2441
+ break;
2442
+ case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL':
2443
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2444
+
2445
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id,$show_back_button ,$mo2fa_transaction_id );
2446
+ exit;
2447
+ break;
2448
+ case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM':
2449
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2450
+
2451
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2452
+ exit;
2453
+ break;
2454
+ case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_WHATSAPP':
2455
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2456
+
2457
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2458
+ exit;
2459
+ break;
2460
+ case 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS':
2461
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2462
+
2463
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2464
+ exit;
2465
+ break;
2466
+ case 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION':
2467
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2468
+
2469
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2470
+ exit;
2471
+ break;
2472
+ case 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION':
2473
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2474
+
2475
+ mo2f_get_otp_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id );
2476
+ exit;
2477
+ break;
2478
+ case 'MO_2_FACTOR_CHALLENGE_DUO_PUSH_NOTIFICATIONS':
2479
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2480
+ mo2f_get_duo_push_authentication_prompt( $login_status, $login_message, $redirect_to, $session_id_encrypt,$user_id
2481
+ );
2482
+ exit;
2483
+ break;
2484
+
2485
+ case 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL':
2486
+ mo2f_get_forgotphone_form( $login_status, $login_message, $redirect_to, $session_id_encrypt );
2487
+ exit;
2488
+ break;
2489
+
2490
+ case 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS':
2491
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_transactionId' );
2492
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2493
+
2494
+ mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2495
+ exit;
2496
+ break;
2497
+
2498
+ case 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL':
2499
+ $transactionid = $this->mo2f_transactionid ? $this->mo2f_transactionid : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_transactionId' );
2500
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2501
+
2502
+ mo2f_get_push_notification_oobemail_prompt( $user_id, $login_status, $login_message, $redirect_to, $session_id_encrypt, $transactionid );
2503
+ exit;
2504
+ break;
2505
+
2506
+ case 'MO_2_FACTOR_RECONFIG_GOOGLE':
2507
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2508
+
2509
+ $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_google' );
2510
+ exit;
2511
+ break;
2512
+
2513
+ case 'MO_2_FACTOR_RECONFIG_KBA':
2514
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2515
+
2516
+ $this->mo2f_redirect_shortcode_addon( $user_id, $login_status, $login_message, 'reconfigure_kba' );
2517
+ exit;
2518
+ break;
2519
+
2520
+ case 'MO_2_FACTOR_SETUP_SUCCESS':
2521
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo2f_current_user_id');
2522
+
2523
+ $this->mo2f_inline_setup_success($user_id,$redirect_to,$session_id_encrypt);
2524
+ break;
2525
+
2526
+ case 'MO_2_FACTOR_GENERATE_BACKUP_CODES':
2527
+ $current_user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2528
+
2529
+ mo2f_backup_codes_generate($current_user_id, $redirect_to, $session_id_encrypt);
2530
+ exit;
2531
+
2532
+ case 'MO_2_FACTOR_CHALLENGE_BACKUP':
2533
+ mo2f_backup_form($login_status, $login_message, $redirect_to, $session_id_encrypt);
2534
+ exit;
2535
+
2536
+ case 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION':
2537
+
2538
+ if(MO2F_IS_ONPREM){
2539
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2540
+
2541
+ $ques = get_user_meta( $user_id, 'kba_questions_user');
2542
+ mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $ques[0] );
2543
+ }
2544
+ else{
2545
+ $kbaquestions = $this->mo2f_kbaquestions ? $this->mo2f_kbaquestions : MO2f_Utility::mo2f_get_transient($session_id_encrypt, 'mo_2_factor_kba_questions');
2546
+ mo2f_get_kba_authentication_prompt($login_status, $login_message, $redirect_to, $session_id_encrypt, $kbaquestions );
2547
+ }
2548
+ exit;
2549
+ break;
2550
+
2551
+ case 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE':
2552
+ mo2f_get_device_form( $redirect_to, $session_id_encrypt );
2553
+ exit;
2554
+ break;
2555
+
2556
+ case 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS':
2557
+ $user_id = $this->mo2f_userID ? $this->mo2f_userID : MO2f_Utility::mo2f_get_transient( $session_id_encrypt, 'mo2f_current_user_id' );
2558
+
2559
+ prompt_user_to_select_2factor_mthod_inline($user_id, $login_status, $login_message,$redirect_to,$session_id_encrypt,$qrCode);
2560
+ exit;
2561
+ break;
2562
+
2563
+ default:
2564
+ $this->mo_2_factor_pass2login_show_wp_login_form();
2565
+
2566
+ break;
2567
+ }
2568
+ }
2569
+
2570
+ function miniorange_pass2login_check_mobile_status( $login_status ) { //mobile authentication
2571
+ if ( $login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION' ) {
2572
+ return true;
2573
+ }
2574
+
2575
+ return false;
2576
+ }
2577
+
2578
+ function miniorange_pass2login_check_otp_status( $login_status, $sso = false ) {
2579
+ if ( $login_status == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' || $login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' || $login_status == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' || $login_status == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION' || $login_status == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION' ) {
2580
+ return true;
2581
+ }
2582
+
2583
+ return false;
2584
+ }
2585
+
2586
+ function miniorange_pass2login_check_forgotphone_status( $login_status ) { // after clicking on forgotphone link when both kba and email are configured
2587
+ if ( $login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL' ) {
2588
+ return true;
2589
+ }
2590
+
2591
+ return false;
2592
+ }
2593
+
2594
+ function miniorange_pass2login_check_push_oobemail_status( $login_status ) { // for push and out of and email
2595
+ if ( $login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL' ) {
2596
+ return true;
2597
+ }
2598
+
2599
+ return false;
2600
+ }
2601
+
2602
+ function miniorange_pass2login_reconfig_google( $login_status ) {
2603
+ if ( $login_status == 'MO_2_FACTOR_RECONFIG_GOOGLE' ) {
2604
+ return true;
2605
+ }
2606
+
2607
+ return false;
2608
+ }
2609
+
2610
+ function mo2f_redirect_shortcode_addon( $current_user_id, $login_status, $login_message, $identity ) {
2611
+
2612
+ do_action( 'mo2f_shortcode_addon', $current_user_id, $login_status, $login_message, $identity );
2613
+
2614
+
2615
+ }
2616
+
2617
+ function miniorange_pass2login_reconfig_kba( $login_status ) {
2618
+ if ( $login_status == 'MO_2_FACTOR_RECONFIG_KBA' ) {
2619
+ return true;
2620
+ }
2621
+
2622
+ return false;
2623
+ }
2624
+
2625
+ function miniorange_pass2login_check_kba_status( $login_status ) {
2626
+ if ( $login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION' ) {
2627
+ return true;
2628
+ }
2629
+
2630
+ return false;
2631
+ }
2632
+
2633
+ function miniorange_pass2login_check_trusted_device_status( $login_status ) {
2634
+
2635
+ if ( $login_status == 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE' ) {
2636
+ return true;
2637
+ }
2638
+
2639
+ return false;
2640
+ }
2641
+
2642
+ function mo_2_factor_pass2login_woocommerce(){
2643
+ ?>
2644
+ <input type="hidden" name="mo_woocommerce_login_prompt" value="1">
2645
+ <?php
2646
+ }
2647
+ function mo_2_factor_pass2login_show_wp_login_form() {
2648
+
2649
+ $session_id_encrypt = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
2650
+ if(is_null($session_id_encrypt)) {
2651
+ $session_id_encrypt=$this->create_session();
2652
+ }
2653
+ if(class_exists('Theme_My_Login'))
2654
+ {
2655
+ wp_enqueue_script( 'tmlajax_script', plugins_url( 'includes/js/tmlajax.js', dirname(dirname(__FILE__)) ) );
2656
+ wp_localize_script( 'tmlajax_script', 'my_ajax_object',
2657
+ array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
2658
+ }
2659
+ if(class_exists('LoginWithAjax')){
2660
+ wp_enqueue_script( 'login_with_ajax_script', plugins_url( 'includes/js/login_with_ajax.js', dirname(dirname(__FILE__))));
2661
+ wp_localize_script( 'login_with_ajax_script', 'my_ajax_object',
2662
+ array( 'ajax_url' => admin_url( 'admin-ajax.php' ) ) );
2663
+ }
2664
+ ?>
2665
+ <p><input type="hidden" name="miniorange_login_nonce"
2666
+ value="<?php echo wp_create_nonce( 'miniorange-2-factor-login-nonce' ); ?>"/>
2667
+
2668
+ <input type="hidden" id="sessid" name="session_id"
2669
+ value="<?php echo $session_id_encrypt; ?>"/>
2670
+
2671
+ </p>
2672
+
2673
+ <?php
2674
+ if ( get_option( 'mo2f_remember_device' ) ) {
2675
+ ?>
2676
+ <p><input type="hidden" id="miniorange_rba_attribures" name="miniorange_rba_attribures" value=""/></p>
2677
+ <?php
2678
+ wp_enqueue_script( 'jquery_script', plugins_url( 'includes/js/rba/js/jquery-1.9.1.js', dirname(dirname(__FILE__)) ) );
2679
+ wp_enqueue_script( 'flash_script', plugins_url( 'includes/js/rba/js/jquery.flash.js', dirname(dirname(__FILE__)) ) );
2680
+ wp_enqueue_script( 'uaparser_script', plugins_url( 'includes/js/rba/js/ua-parser.js', dirname(dirname(__FILE__)) ) );
2681
+ wp_enqueue_script( 'client_script', plugins_url( 'includes/js/rba/js/client.js', dirname(dirname(__FILE__)) ) );
2682
+ wp_enqueue_script( 'device_script', plugins_url( 'includes/js/rba/js/device_attributes.js', dirname(dirname(__FILE__)) ) );
2683
+ wp_enqueue_script( 'swf_script', plugins_url( 'includes/js/rba/js/swfobject.js', dirname(dirname(__FILE__)) ) );
2684
+ wp_enqueue_script( 'font_script', plugins_url( 'includes/js/rba/js/fontdetect.js', dirname(dirname(__FILE__)) ) );
2685
+ wp_enqueue_script( 'murmur_script', plugins_url( 'includes/js/rba/js/murmurhash3.js', dirname(dirname(__FILE__)) ) );
2686
+ wp_enqueue_script( 'miniorange_script', plugins_url( 'includes/js/rba/js/miniorange-fp.js', dirname(dirname(__FILE__)) ) );
2687
+ }else{
2688
+
2689
+
2690
+ if( MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'site_option'))
2691
+ {
2692
+ echo "\t<p>\n";
2693
+ echo "\t\t<label class=\"mo2f_instuction1\" title=\"".__('If you don\'t have 2-factor authentication enabled for your WordPress account, leave this field empty.','google-authenticator')."\">".__('2 Factor Authentication code*','google-authenticator')."<span id=\"google-auth-info\"></span><br />\n";
2694
+ echo "\t\t<input type=\"text\" placeholder=\"No soft Token ? Skip\" name=\"mo_softtoken\" id=\"mo2f_2fa_code\" class=\"mo2f_2fa_code\" value=\"\" size=\"20\" style=\"ime-mode: inactive;\" /></label>\n";
2695
+ echo "\t<p class=\"mo2f_instuction2\" style='color:red; font-size:12px;padding:5px'>* Skip the authentication code if it doesn't apply.</p>\n";
2696
+ echo "\t</p>\n";
2697
+ echo " \r\n";
2698
+ echo " \r\n";
2699
+ echo "\n";
2700
+ }
2701
+ }
2702
+
2703
+ }
2704
+
2705
+ function mo2f_pass2login_mobile_verification( $user, $redirect_to, $session_id_encrypt=null ) {
2706
+ global $Mo2fdbQueries,$moWpnsUtility;
2707
+ if (is_null($session_id_encrypt)){
2708
+ $session_id_encrypt=$this->create_session();
2709
+ }
2710
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
2711
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
2712
+ MO2f_Utility::mo2f_debug_file('Check user agent to check request from mobile device '.$useragent);
2713
+ if ( MO2f_Utility::check_if_request_is_from_mobile_device( $useragent ) ) {
2714
+ $session_cookie_variables = array( 'mo2f-login-qrCode', 'mo2f_transactionId' );
2715
+
2716
+ MO2f_Utility::unset_session_variables( $session_cookie_variables );
2717
+ MO2f_Utility::unset_cookie_variables( $session_cookie_variables);
2718
+ MO2f_Utility::unset_temp_user_details_in_table( 'mo2f_transactionId',$session_id_encrypt);
2719
+
2720
+ $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
2721
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
2722
+ MO2f_Utility::mo2f_debug_file('Request from mobile device so promting soft token'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2723
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt );
2724
+ } else {
2725
+ $challengeMobile = new Customer_Setup();
2726
+ $content = $challengeMobile->send_otp_token( $user_email, 'MOBILE AUTHENTICATION', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2727
+ $response = json_decode( $content, true );
2728
+ if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2729
+ if ( $response['status'] == 'SUCCESS' ) {
2730
+ $qrCode = $response['qrCode'];
2731
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionId', $response['txId']);
2732
+
2733
+
2734
+ $this->mo2f_transactionid=$response['txId'];
2735
+ $mo2fa_login_message = '';
2736
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
2737
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' Sent miniOrange QR code Authentication successfully'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2738
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, $qrCode,$session_id_encrypt );
2739
+ } else if ( $response['status'] == 'ERROR' ) {
2740
+ $this->remove_current_activity($session_id_encrypt);
2741
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' An error occured while processing your request'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2742
+ $error = new WP_Error();
2743
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2744
+
2745
+ return $error;
2746
+ }
2747
+ } else {
2748
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' An error occured while processing your request'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2749
+ $this->remove_current_activity($session_id_encrypt);
2750
+ $error = new WP_Error();
2751
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2752
+
2753
+ return $error;
2754
+ }
2755
+ }
2756
+
2757
+ }
2758
+
2759
+ function mo2f_pass2login_duo_push_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt ){
2760
+ global $Mo2fdbQueries;
2761
+ include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'handler'.DIRECTORY_SEPARATOR.'twofa'.DIRECTORY_SEPARATOR.'two_fa_duo_handler.php';
2762
+ if (is_null($session_id_encrypt)){
2763
+ $session_id_encrypt=$this->create_session();
2764
+ }
2765
+
2766
+ $mo2fa_login_message ='';
2767
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_DUO_PUSH_NOTIFICATIONS';
2768
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id_encrypt);
2769
+
2770
+ }
2771
+
2772
+ function mo2f_pass2login_push_oobemail_verification( $current_user, $mo2f_second_factor, $redirect_to, $session_id=null ) {
2773
+
2774
+ global $Mo2fdbQueries,$moWpnsUtility;
2775
+ if(is_null($session_id)){
2776
+ $session_id=$this->create_session();
2777
+ }
2778
+ $challengeMobile = new Customer_Setup();
2779
+ $user_email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $current_user->ID );
2780
+ if(MO2F_IS_ONPREM && $mo2f_second_factor != "PUSH NOTIFICATIONS"){
2781
+ MO2f_Utility::mo2f_debug_file('Push notification has sent successfully for '.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2782
+ include_once dirname(dirname(dirname(__FILE__))).DIRECTORY_SEPARATOR.'api'.DIRECTORY_SEPARATOR.'Mo2f_OnPremRedirect.php';
2783
+ $mo2fOnPremRedirect = new Mo2f_OnPremRedirect();
2784
+ $content = $mo2fOnPremRedirect->mo2f_pass2login_push_email_onpremise($current_user, $redirect_to, $session_id );
2785
+
2786
+ }else {
2787
+ $content = $challengeMobile->send_otp_token( $user_email, $mo2f_second_factor, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) );
2788
+ }
2789
+ $response = json_decode( $content, true );
2790
+ if ( json_last_error() == JSON_ERROR_NONE ) { /* Generate Qr code */
2791
+ if ( $response['status'] == 'SUCCESS' ) {
2792
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2793
+ update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2794
+
2795
+ MO2f_Utility::mo2f_debug_file('Push notification has sent successfully for '.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2796
+ $this->mo2f_transactionid=$response['txId'];
2797
+
2798
+ $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.';
2799
+ $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2800
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null,$session_id);
2801
+ } else if ( $response['status'] == 'ERROR' || $response['status'] == 'FAILED' ) {
2802
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2803
+ update_user_meta($current_user->ID,'mo2f_EV_txid',$response['txId']);
2804
+
2805
+ MO2f_Utility::mo2f_debug_file('An error occured while sending push notification-'.$mo2f_second_factor.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2806
+ $this->mo2f_transactionid=$response['txId'];
2807
+ $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.';
2808
+ $mo2fa_login_status = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
2809
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2810
+ }
2811
+ } else {
2812
+ MO2f_Utility::mo2f_debug_file('An error occured while processing your request.'. 'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$current_user->ID.' Email-'.$current_user->user_email);
2813
+ $this->remove_current_activity($session_id);
2814
+ $error = new WP_Error();
2815
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2816
+
2817
+ return $error;
2818
+ }
2819
+ }
2820
+
2821
+ function mo2f_pass2login_otp_verification( $user, $mo2f_second_factor, $redirect_to,$session_id=null ) {
2822
+ global $Mo2fdbQueries,$moWpnsUtility;
2823
+
2824
+ if(is_null($session_id)){
2825
+ $session_id=$this->create_session();
2826
+ }
2827
+ $mo2f_external_app_type = get_user_meta( $user->ID, 'mo2f_external_app_type', true );
2828
+ if($mo2f_second_factor == 'EMAIL')
2829
+ {
2830
+ $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
2831
+ $wdewdeqdqq = get_site_option(base64_encode("remainingOTP"));
2832
+ if($wdewdeqdqq >get_site_option('EmailTransactionCurrent', 30) or get_site_option(base64_encode("limitReached")))
2833
+ {
2834
+ update_site_option(base64_encode("remainingOTP"),0);
2835
+ }
2836
+ }
2837
+ else
2838
+ $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
2839
+ if ( $mo2f_second_factor == 'SOFT TOKEN' ) {
2840
+ $mo2fa_login_message = 'Please enter the one time passcode shown in the miniOrange<b> Authenticator</b> app.';
2841
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
2842
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2843
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2844
+ } else if ( $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' ) {
2845
+ $mo2fa_login_message ='Please enter the one time passcode shown in the <b> Authenticator</b> app.';
2846
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION';
2847
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2848
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to, null,$session_id );
2849
+ } elseif ($mo2f_second_factor == 'OTP Over Telegram') {
2850
+ $chatID = get_user_meta($user->ID,'mo2f_chat_id',true);
2851
+ $otpToken = '';
2852
+ for($i=1;$i<7;$i++)
2853
+ {
2854
+ $otpToken .= rand(0,9);
2855
+ }
2856
+
2857
+ update_user_meta($user->ID,'mo2f_otp_token',$otpToken);
2858
+ update_user_meta($user->ID,'mo2f_telegram_time',time());
2859
+
2860
+ $url = 'https://sitestats.xecurify.com/teleTest/send_otp.php';
2861
+ $postdata = array( 'mo2f_otp_token' => $otpToken,
2862
+ 'mo2f_chatid' => $chatID
2863
+ );
2864
+
2865
+ $handle = curl_init();
2866
+
2867
+ curl_setopt_array($handle,
2868
+ array(
2869
+ CURLOPT_URL => $url,
2870
+ CURLOPT_POST => true,
2871
+ CURLOPT_POSTFIELDS => $postdata,
2872
+ CURLOPT_RETURNTRANSFER => true,
2873
+ CURLOPT_SSL_VERIFYHOST => FALSE,
2874
+ CURLOPT_SSL_VERIFYPEER => FALSE,
2875
+
2876
+ )
2877
+ );
2878
+
2879
+ $data = curl_exec($handle);
2880
+ curl_close($handle);
2881
+ if($data == 'SUCCESS')
2882
+ {
2883
+ $mo2fa_login_message ='Please enter the one time passcode sent on your<b> Telegram</b> app.';
2884
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_TELEGRAM';
2885
+ MO2f_Utility::mo2f_debug_file($mo2fa_login_status.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2886
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2887
+ }
2888
+
2889
+ }
2890
+ else {
2891
+ $challengeMobile = new Customer_Setup();
2892
+ $content = '';
2893
+ $response = [];
2894
+ $otpLIMiTE = 0;
2895
+ if(MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option')>0 or $mo2f_second_factor != 'EMAIL')
2896
+ {
2897
+ if($mo2f_second_factor == 'OTP Over SMS')
2898
+ $mo2f_second_factor = 'SMS';
2899
+ $content = $challengeMobile->send_otp_token( $mo2f_user_phone, $mo2f_second_factor, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ,$user);
2900
+ $response = json_decode( $content, true );
2901
+
2902
+ }
2903
+ else
2904
+ {
2905
+ MO2f_Utility::mo2f_debug_file('Error in sending OTP over Email or SMS.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2906
+ $response['status'] = 'FAILED';
2907
+ $response['message'] = '<p style = "color:red;">OTP limit has been exceeded</p>';
2908
+ $otpLIMiTE = 1;
2909
+ }
2910
+ if ( json_last_error() == JSON_ERROR_NONE ) {
2911
+ if ( $response['status'] == 'SUCCESS' ) {
2912
+ if($mo2f_second_factor == 'EMAIL')
2913
+ {
2914
+ MO2f_Utility::mo2f_debug_file(' OTP has been sent successfully over email.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2915
+ $cmVtYWluaW5nT1RQ = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
2916
+ if($cmVtYWluaW5nT1RQ>0)
2917
+ update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
2918
+ }
2919
+ elseif($mo2f_second_factor == 'SMS')
2920
+ {
2921
+ MO2f_Utility::mo2f_debug_file(' OTP has been sent successfully over phone.'.' User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$user->ID.' Email-'.$user->user_email);
2922
+ $mo2f_sms = get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z');
2923
+ if($mo2f_sms>0)
2924
+ update_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z',$mo2f_sms-1);
2925
+ }
2926
+ if(!isset($response['phoneDelivery']['contact']))
2927
+ $response['phoneDelivery']['contact'] = '';
2928
+ $message = 'The OTP has been sent to ' . MO2f_Utility::get_hidden_phone( $response['phoneDelivery']['contact'] ) . '. Please enter the OTP you received to Validate.';
2929
+ update_option( 'mo2f_number_of_transactions', MoWpnsUtility::get_mo2f_db_option('mo2f_number_of_transactions', 'get_option') - 1 );
2930
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2931
+
2932
+
2933
+ $this->mo2f_transactionid=$response['txId'];
2934
+ $mo2fa_login_message = $message;
2935
+ $currentMethod = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user->ID );
2936
+
2937
+ if($currentMethod == 'OTP Over Email')
2938
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
2939
+ else
2940
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
2941
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2942
+ } else {
2943
+
2944
+
2945
+ if($response['message'] == 'TEST FAILED.')
2946
+ $response['message'] = 'There is an error in sending the OTP.';
2947
+
2948
+ $last_message = 'Or <a href = " https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/login?redirectUrl=https://login.xecurify.com/moas/initializepayment&requestOrigin=otp_recharge_plan">puchase trascactions</a>';
2949
+
2950
+ if($otpLIMiTE ==1)
2951
+ $last_message = 'or contact miniOrange';
2952
+
2953
+ else if(MO2F_IS_ONPREM and ($mo2f_second_factor == 'OTP Over Email' or $mo2f_second_factor =='EMAIL' or $mo2f_second_factor == 'Email Verification'))
2954
+ $last_message = 'Or check your SMTP Server and remaining transacions.';
2955
+ else
2956
+ $last_message = 'Or check your remaining transacions';
2957
+
2958
+ $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;
2959
+ if(!isset($response['txId']))
2960
+ $response['txId'] = '';
2961
+ MO2f_Utility::mo2f_set_transient($session_id, 'mo2f_transactionId', $response['txId']);
2962
+
2963
+
2964
+ $this->mo2f_transactionid=$response['txId'];
2965
+ $mo2fa_login_message = $message;
2966
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS';
2967
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id );
2968
+ }
2969
+ } else {
2970
+ $this->remove_current_activity($session_id);
2971
+ $error = new WP_Error();
2972
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: An error occured while processing your request. Please Try again.' ) );
2973
+ return $error;
2974
+ }
2975
+ }
2976
+ }
2977
+
2978
+ function mo2fa_pass2login( $redirect_to = null, $session_id_encrypted=null ) {
2979
+ global $Mo2fdbQueries;
2980
+ if(empty($this->mo2f_userID)&&empty($this->fstfactor)){
2981
+ $user_id = MO2f_Utility::mo2f_get_transient($session_id_encrypted, 'mo2f_current_user_id');
2982
+ $mo2f_1stfactor_status = MO2f_Utility::mo2f_get_transient( $session_id_encrypted, 'mo2f_1stfactor_status' );
2983
+
2984
+
2985
+ } else {
2986
+ $user_id=$this->mo2f_userID;
2987
+ $mo2f_1stfactor_status=$this->fstfactor;
2988
+ }
2989
+
2990
+ if ( $user_id && $mo2f_1stfactor_status && ( $mo2f_1stfactor_status == 'VALIDATE_SUCCESS' ) ) {
2991
+ $currentuser = get_user_by( 'id', $user_id );
2992
+ wp_set_current_user( $user_id, $currentuser->user_login );
2993
+ $mobile_login = new Miniorange_Mobile_Login();
2994
+ $mobile_login->remove_current_activity($session_id_encrypted);
2995
+
2996
+ delete_expired_transients( true );
2997
+ delete_site_option($session_id_encrypted);
2998
+
2999
+ wp_set_auth_cookie( $user_id, true );
3000
+ do_action( 'wp_login', $currentuser->user_login, $currentuser );
3001
+ redirect_user_to( $currentuser, $redirect_to );
3002
+ exit;
3003
+ } else {
3004
+ $this->remove_current_activity($session_id_encrypted);
3005
+ }
3006
+ }
3007
+
3008
+ function create_session(){
3009
+ global $Mo2fdbQueries;
3010
+ $session_id = MO2f_Utility::random_str(20);
3011
+ $Mo2fdbQueries->insert_user_login_session($session_id);
3012
+ $key = get_option( 'mo2f_encryption_key' );
3013
+ $session_id_encrypt = MO2f_Utility::encrypt_data($session_id, $key);
3014
+ return $session_id_encrypt;
3015
+ }
3016
+
3017
+ function miniorange_initiate_2nd_factor( $currentuser, $attributes = null, $redirect_to = null, $otp_token = "",$session_id_encrypt=null ) {
3018
+ global $Mo2fdbQueries,$moWpnsUtility;
3019
+ MO2f_Utility::mo2f_debug_file('MO initiate 2nd factor'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3020
+ $this->miniorange_pass2login_start_session();
3021
+ if(is_null($session_id_encrypt)) {
3022
+ $session_id_encrypt=$this->create_session();
3023
+ }
3024
+
3025
+ if(class_exists('UM_Functions'))
3026
+ {
3027
+ MO2f_Utility::mo2f_debug_file('Using UM login form.');
3028
+ if(!isset($_POST['wp-submit']) and isset($_POST['um_request']))
3029
+ {
3030
+ $meta = get_option('um_role_'.$currentuser->roles[0].'_meta');
3031
+ if(isset($meta) and $meta != '')
3032
+ {
3033
+ if(isset($meta['_um_login_redirect_url']))
3034
+ $redirect_to = $meta['_um_login_redirect_url'];
3035
+ if($redirect_to == '')
3036
+ {
3037
+ $redirect_to = get_site_url();
3038
+ }
3039
+ }
3040
+ $login_form_url = '';
3041
+ if(isset($_POST['redirect_to']))
3042
+ $login_form_url = esc_url_raw($_POST['redirect_to']);
3043
+
3044
+ if($login_form_url != '' and !is_null($login_form_url))
3045
+ {
3046
+ $redirect_to = $login_form_url;
3047
+ }
3048
+
3049
+ }
3050
+
3051
+ }
3052
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
3053
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
3054
+
3055
+
3056
+ $this->mo2f_userID=$currentuser->ID;
3057
+ $this->fstfactor='VALIDATE_SUCCESS';
3058
+
3059
+ $is_customer_admin = true;
3060
+
3061
+ $dG90YWxVc2Vyc0Nsb3Vk = get_site_option("dG90YWxVc2Vyc0Nsb3Vk"); //directly added without encoding
3062
+ if($dG90YWxVc2Vyc0Nsb3Vk<3)
3063
+ $is_customer_admin = true;
3064
+
3065
+ $roles = ( array ) $currentuser->roles;
3066
+ $twofactor_enabled = 0;
3067
+ foreach ( $roles as $role ) {
3068
+ if(get_option('mo2fa_'.$role)=='1')
3069
+ $twofactor_enabled=1;
3070
+ }
3071
+ if ($twofactor_enabled!=1 && is_super_admin( $currentuser->ID )){
3072
+ if(get_site_option('mo2fa_superadmin')==1){
3073
+ $twofactor_enabled=1;
3074
+ }
3075
+ }
3076
+
3077
+ if ( $is_customer_admin && $twofactor_enabled ) {
3078
+ $mo_2factor_user_registration_status = $Mo2fdbQueries->get_user_detail( 'mo_2factor_user_registration_status', $currentuser->ID );
3079
+ $kba_configuration_status = $Mo2fdbQueries->get_user_detail( 'mo2f_SecurityQuestions_config_status', $currentuser->ID );
3080
+
3081
+ if(MoWpnsUtility::get_mo2f_db_option('mo2f_enable_brute_force', 'get_option')){
3082
+ $mo2f_allwed_login_attempts=get_option('mo2f_allwed_login_attempts');
3083
+ }else{
3084
+ $mo2f_allwed_login_attempts= 'disabled';
3085
+ }
3086
+ update_user_meta( $currentuser->ID, 'mo2f_user_login_attempts', $mo2f_allwed_login_attempts );
3087
+
3088
+ $twofactor_transactions = new Mo2fDB;
3089
+ $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($currentuser->ID);
3090
+ $tfa_enabled = $Mo2fdbQueries->get_user_detail( 'mo2f_2factor_enable_2fa_byusers', $currentuser->ID );
3091
+ if($tfa_enabled == 0 && ($mo_2factor_user_registration_status != 'MO_2_FACTOR_PLUGIN_SETTINGS') && $tfa_enabled != '')
3092
+ $exceeded =1;
3093
+
3094
+ if ( $mo_2factor_user_registration_status == 'MO_2_FACTOR_PLUGIN_SETTINGS' ) { //checking if user has configured any 2nd factor method
3095
+ $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser->ID );
3096
+ try {
3097
+ $mo2f_rba_status = mo2f_collect_attributes( $email, stripslashes( $attributes ) ); // Rba flow
3098
+ MO2f_Utility::set_user_values( $session_id_encrypt, 'mo2f_rba_status', $mo2f_rba_status );
3099
+ $this->mo2f_rbastatus=$mo2f_rba_status;
3100
+ } catch ( Exception $e ) {
3101
+ echo $e->getMessage();
3102
+ }
3103
+
3104
+ if ( $mo2f_rba_status['status'] == 'SUCCESS' && $mo2f_rba_status['decision_flag'] ) {
3105
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3106
+ } else if ( ($mo2f_rba_status['status'] == 'DENY' ) && get_option( 'mo2f_rba_installed' ) ) {
3107
+
3108
+ $this->mo2f_restrict_access( 'Access_denied' );
3109
+ exit;
3110
+ } else if ( ($mo2f_rba_status['status'] == 'ERROR') && get_option( 'mo2f_rba_installed' ) ) {
3111
+ $this->mo2f_restrict_access( 'Access_denied' );
3112
+ exit;
3113
+ } else {
3114
+
3115
+ $mo2f_second_factor = '';
3116
+
3117
+ $mo2f_second_factor = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $currentuser->ID );
3118
+
3119
+ if(!MO2F_IS_ONPREM and $mo2f_second_factor!= 'OTP Over Telegram')
3120
+ $mo2f_second_factor = mo2f_get_user_2ndfactor( $currentuser );
3121
+
3122
+ if($mo2f_second_factor == 'miniOrange Soft Token')
3123
+ $mo2f_second_factor = "SOFT TOKEN";
3124
+ else if($mo2f_second_factor == "miniOrange Push Notification")
3125
+ $mo2f_second_factor = "PUSH NOTIFICATIONS";
3126
+ else if($mo2f_second_factor == "miniOrange QR Code Authentication")
3127
+ $mo2f_second_factor = "MOBILE AUTHENTICATION";
3128
+ else if($mo2f_second_factor == 'Security Questions')
3129
+ $mo2f_second_factor = 'KBA';
3130
+ else if($mo2f_second_factor == 'Google Authenticator')
3131
+ $mo2f_second_factor = 'GOOGLE AUTHENTICATOR';
3132
+ else if($mo2f_second_factor == 'OTP Over SMS')
3133
+ $mo2f_second_factor = 'SMS';
3134
+ else if($mo2f_second_factor == 'Duo Authenticator' || $mo2f_second_factor == 'DUO AUTHENTICATOR')
3135
+ $mo2f_second_factor = 'Duo Authenticator';
3136
+ else if($mo2f_second_factor == 'OTP Over Email' || $mo2f_second_factor == 'OTP OVER EMAIL' || $mo2f_second_factor == "EMAIL") {
3137
+ $mo2f_second_factor = "EMAIL";
3138
+
3139
+ if(MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option')<=0)
3140
+ {
3141
+ update_site_option("bGltaXRSZWFjaGVk",1);
3142
+
3143
+ }
3144
+ }
3145
+
3146
+
3147
+ if((($mo2f_second_factor == 'GOOGLE AUTHENTICATOR') || ($mo2f_second_factor =='SOFT TOKEN') || ($mo2f_second_factor =='AUTHY AUTHENTICATOR')) && MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'site_option')&& !get_option('mo2f_remember_device') && !isset($_POST['mo_woocommerce_login_prompt']) )
3148
+ {
3149
+ $error=$this->mo2f_validate_soft_token($currentuser, $mo2f_second_factor, $otp_token,$session_id_encrypt, $redirect_to);
3150
+ if(is_wp_error( $error))
3151
+ {
3152
+ return $error;
3153
+ }
3154
+ }
3155
+ else{
3156
+
3157
+ if ( MO2f_Utility::check_if_request_is_from_mobile_device( $_SERVER['HTTP_USER_AGENT'] ) && $kba_configuration_status ) {
3158
+ $this->mo2f_pass2login_kba_verification( $currentuser->ID, $redirect_to, $session_id_encrypt );
3159
+ } else {
3160
+
3161
+ if ( $mo2f_second_factor == 'MOBILE AUTHENTICATION' ) {
3162
+ $this->mo2f_pass2login_mobile_verification( $currentuser, $redirect_to, $session_id_encrypt );
3163
+ } else if ( $mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL' || $mo2f_second_factor == 'Email Verification') {
3164
+ MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3165
+ $this->mo2f_pass2login_push_oobemail_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3166
+ } else if ( $mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' || $mo2f_second_factor == 'EMAIL' ||$mo2f_second_factor == 'OTP Over Telegram'|| $mo2f_second_factor == 'OTP Over Whatsapp') {
3167
+ MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3168
+ $this->mo2f_pass2login_otp_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3169
+ } else if ( $mo2f_second_factor == 'KBA' or $mo2f_second_factor == 'Security Questions') {
3170
+ MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3171
+ $this->mo2f_pass2login_kba_verification( $currentuser->ID, $redirect_to , $session_id_encrypt );
3172
+ }else if ( $mo2f_second_factor == 'Duo Authenticator') {
3173
+ MO2f_Utility::mo2f_debug_file('Initiating 2fa validation template for '.$mo2f_second_factor.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3174
+ $this->mo2f_pass2login_duo_push_verification( $currentuser, $mo2f_second_factor, $redirect_to, $session_id_encrypt );
3175
+
3176
+ }else if ( $mo2f_second_factor == 'NONE' ) {
3177
+ MO2f_Utility::mo2f_debug_file('mo2f_second_factor is NONE'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3178
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request'))
3179
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3180
+ else
3181
+ return $currentuser;
3182
+ } else {
3183
+ $this->remove_current_activity($session_id_encrypt);
3184
+ $error = new WP_Error();
3185
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3186
+ MO2f_Utility::mo2f_debug_file('Two factor method has not been configured '.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3187
+ $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Two Factor method has not been configured.', );
3188
+ wp_send_json_success($data);
3189
+ }
3190
+ else{
3191
+ MO2f_Utility::mo2f_debug_file('Two factor method has not been configured '.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3192
+ $error->add( 'empty_username', __( '<strong>ERROR</strong>: Two Factor method has not been configured.' ) );
3193
+ return $error;
3194
+ }
3195
+ }
3196
+ }
3197
+ }
3198
+
3199
+ }
3200
+ }else if(!$exceeded && MoWpnsUtility::get_mo2f_db_option('mo2f_inline_registration', 'site_option')){
3201
+ $this->mo2fa_inline( $currentuser, $redirect_to, $session_id_encrypt );
3202
+
3203
+ } else {
3204
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request'))
3205
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3206
+ else
3207
+ return $currentuser;
3208
+ }
3209
+
3210
+ }else { //plugin is not activated for current role then logged him in without asking 2 factor
3211
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3212
+ }
3213
+
3214
+ }
3215
+
3216
+ function mo2fa_inline($currentuser,$redirect_to,$session_id){
3217
+
3218
+ global $Mo2fdbQueries;
3219
+ $currentUserId = $currentuser->ID;
3220
+ $email = $currentuser->user_email;
3221
+ $Mo2fdbQueries->insert_user( $currentUserId, array( 'user_id' => $currentUserId ) );
3222
+ $Mo2fdbQueries->update_user_details( $currentUserId, array(
3223
+ 'user_registration_with_miniorange' =>'SUCCESS',
3224
+ 'mo2f_user_email' =>$email,
3225
+ 'mo_2factor_user_registration_status' =>'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
3226
+ ) );
3227
+
3228
+ $mo2fa_login_message = '';
3229
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3230
+
3231
+ $this->miniorange_pass2login_form_fields($mo2fa_login_status, $mo2fa_login_message,$redirect_to,null,$session_id);
3232
+ }
3233
+
3234
+ function mo2f_validate_soft_token($currentuser, $mo2f_second_factor, $softtoken,$session_id_encrypt,$redirect_to = null){
3235
+ global $Mo2fdbQueries;
3236
+ $email = $Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $currentuser->ID );
3237
+ $customer = new Customer_Setup();
3238
+ $content = json_decode( $customer->validate_otp_token( $mo2f_second_factor, $email, null, $softtoken, get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ), true );
3239
+ if ( strcasecmp( $content['status'], 'SUCCESS' ) == 0 ) {
3240
+ if ( get_option( 'mo2f_remember_device' ) ) {
3241
+ $mo2fa_login_status = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
3242
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, null, $redirect_to, null, $session_id_encrypt );
3243
+ } else {
3244
+ $this->mo2fa_pass2login( $redirect_to, $session_id_encrypt );
3245
+ }
3246
+ } else {
3247
+ if( MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3248
+ $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Invalid One Time Passcode.', );
3249
+ wp_send_json_success($data);
3250
+ }
3251
+ else
3252
+ return new WP_Error( 'invalid_one_time_passcode', '<strong>ERROR</strong>: Invalid One Time Passcode.');
3253
+ }
3254
+ }
3255
+
3256
+ function mo2f_otp_over_email_send($email,$redirect_to,$session_id_encrypt,$current_user)
3257
+ {
3258
+
3259
+ $challengeMobile = new Customer_Setup();
3260
+ $content = '';
3261
+ $response = [];
3262
+ $otpLIMiTE = 0;
3263
+ if(get_site_option("cmVtYWluaW5nT1RQ")>0)
3264
+ {
3265
+ $content = $challengeMobile->send_otp_token( $email, 'EMAIL', get_option( 'mo2f_customerKey' ), get_option( 'mo2f_api_key' ) ,$current_user);
3266
+ $response = json_decode( $content, true );
3267
+ if(!MO2F_IS_ONPREM)
3268
+ {
3269
+ if(isset($response['txId'])){
3270
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_transactionid', $response['txId']);
3271
+ }
3272
+ }
3273
+
3274
+ }
3275
+ else
3276
+ {
3277
+ $response['status'] = 'FAILED';
3278
+ $response['message'] = '<p style = "color:red;">OTP limit has been exceeded</p>';
3279
+ $otpLIMiTE = 1;
3280
+ }
3281
+ if ( json_last_error() == JSON_ERROR_NONE ) {
3282
+ if ( $response['status'] == 'SUCCESS' ) {
3283
+ $cmVtYWluaW5nT1RQ = get_site_option("cmVtYWluaW5nT1RQ");
3284
+ if($cmVtYWluaW5nT1RQ>0)
3285
+ update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
3286
+ $mo2fa_login_message = 'An OTP has been sent to '.$email.' please verify to set the two-factor';
3287
+ $mo2fa_login_status = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
3288
+ $mo2fa_transaction_id = isset($response['txId'])?$response['txId']:null;
3289
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt, 1 ,$mo2fa_transaction_id);
3290
+ }
3291
+ else
3292
+ {
3293
+ if($response['status'] == 'FAILED' && $response['message'] == 'OTP limit has been exceeded'){
3294
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3295
+ $mo2fa_login_message = 'There was an issue while sending the OTP to '.$email.'. Please check your remaining transactions and try again.';
3296
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
3297
+ }else if($response['status'] == 'FAILED'){
3298
+ $mo2fa_login_status = 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
3299
+ $mo2fa_login_message = 'Your SMTP has not been set, please set your SMTP first to get OTP.';
3300
+ $this->miniorange_pass2login_form_fields( $mo2fa_login_status, $mo2fa_login_message, $redirect_to,null, $session_id_encrypt );
3301
+ }
3302
+ }
3303
+ }
3304
+ }
3305
+ function mo2f_restrict_access( $identity ) {
3306
+ apply_filters( 'mo2f_rba_addon', $identity );
3307
+ exit;
3308
+ }
3309
+
3310
+ function mo2f_collect_device_attributes_for_authenticated_user( $currentuser, $redirect_to = null ) {
3311
+ $session_id=$this->create_session();
3312
+ if ( get_option( 'mo2f_remember_device' ) ) {
3313
+ $this->miniorange_pass2login_start_session();
3314
+ MO2f_Utility::set_user_values( $session_id, "mo2f_current_user_id", $currentuser->ID );
3315
+ $this->mo2f_userID=$currentuser->ID;
3316
+ mo2f_collect_device_attributes_handler($session_id,$redirect_to );
3317
+ exit;
3318
+ } else {
3319
+ $this->miniorange_initiate_2nd_factor( $currentuser, null, $redirect_to ,null ,$session_id );
3320
+ }
3321
+ }
3322
+
3323
+ function mo2f_check_username_password( $user, $username, $password, $redirect_to = null ) {
3324
+ global $Mo2fdbQueries,$moWpnsUtility;
3325
+ if ( is_a( $user, 'WP_Error' ) && ! empty( $user ) ) {
3326
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3327
+ $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp;Invalid User Credentials', );
3328
+ wp_send_json_success($data);
3329
+ }
3330
+ else
3331
+ return $user;
3332
+ }
3333
+ if($GLOBALS['pagenow'] == 'wp-login.php' && isset($_POST['mo_woocommerce_login_prompt'])){
3334
+ return new WP_Error( 'Unauthorized Access.' , '<strong>ERROR</strong>: Access Denied.');
3335
+ }
3336
+ // if an app password is enabled, this is an XMLRPC / APP login ?
3337
+ if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
3338
+
3339
+ $currentuser = wp_authenticate_username_password( $user, $username, $password );
3340
+ if ( is_wp_error( $currentuser ) ) {
3341
+ $this->error = new IXR_Error( 403, __( 'Bad login/pass combination.' ) );
3342
+
3343
+ return false;
3344
+ } else {
3345
+ return $currentuser;
3346
+ }
3347
+
3348
+ } else {
3349
+ $currentuser = wp_authenticate_username_password( $user, $username, $password );
3350
+ if ( is_wp_error( $currentuser ) ) {
3351
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3352
+ $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Invalid User Credentials', );
3353
+ wp_send_json_success($data);
3354
+ }
3355
+ else{
3356
+ $currentuser->add( 'invalid_username_password', '<strong>' . mo2f_lt( 'ERROR' ) . '</strong>: ' . mo2f_lt( 'Invalid Username or password.' ) );
3357
+ MO2f_Utility::mo2f_debug_file('Invalid username and password.'.'User_IP-'.$moWpnsUtility->get_client_ip());
3358
+ return $currentuser;
3359
+ }
3360
+ } else {
3361
+
3362
+ $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
3363
+ MO2f_Utility::mo2f_debug_file('Username and password validate successfully'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3364
+ if(isset($_REQUEST['woocommerce-login-nonce'])){
3365
+ MO2f_Utility::mo2f_debug_file('It is a woocommerce login form. Get woocommerce redirectUrl');
3366
+ if ( ! empty( $_REQUEST[ 'redirect_to' ] ) ) {
3367
+ $redirect_to = wp_unslash( $_REQUEST[ 'redirect_to' ] );
3368
+ } elseif ( isset($_REQUEST[ '_wp_http_referer' ]) ) {
3369
+ $redirect_to = $_REQUEST[ '_wp_http_referer' ];
3370
+ } else {
3371
+ $redirect_to = wc_get_page_permalink( 'myaccount' );
3372
+ }
3373
+ }else{
3374
+ $redirect_to = isset($_REQUEST[ 'redirect_to' ]) ? $_REQUEST[ 'redirect_to' ] : (isset($_REQUEST[ 'redirect' ]) ? $_REQUEST[ 'redirect' ] : null);
3375
+ }
3376
+ $redirect_to = esc_url_raw($redirect_to);
3377
+ $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $currentuser->ID );
3378
+ $cloud_methods = array("MOBILE AUTHENTICATION","PUSH NOTIFICATIONS","SOFT TOKEN");
3379
+ if (MO2F_IS_ONPREM && $mo2f_configured_2FA_method=='Security Questions')
3380
+ {
3381
+ MO2f_Utility::mo2f_debug_file('Initiating 2nd factor for KBA'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3382
+ $this->miniorange_initiate_2nd_factor($currentuser, null , $redirect_to , "" , $session_id );
3383
+ }
3384
+ else if(MO2F_IS_ONPREM && $mo2f_configured_2FA_method =='Email Verification')
3385
+ {
3386
+ MO2f_Utility::mo2f_debug_file('Initiating 2nd factor for email verification'.'User_IP-'.$moWpnsUtility->get_client_ip() .' User_Id-'.$currentuser->ID.' Email-'.$currentuser->user_email);
3387
+ $this->miniorange_initiate_2nd_factor($currentuser, null , $redirect_to , null ,$session_id );
3388
+ }
3389
+ else
3390
+ {
3391
+ if ( empty( $_POST['mo_softtoken'] ) && MoWpnsUtility::get_mo2f_db_option('mo2f_enable_2fa_prompt_on_login_page', 'get_option') && $mo2f_configured_2FA_method && !get_option('mo2f_remember_device') && (($mo2f_configured_2FA_method == 'Google Authenticator') ||($mo2f_configured_2FA_method == 'miniOrange Soft Token') || ($mo2f_configured_2FA_method =='Authy Authenticator')) && get_option('mo2fa_administrator'))
3392
+ {
3393
+ if(class_exists('UM_Functions')){
3394
+ $passcode = isset($_POST[ "mo2f_validate_otp_token" ]) ? $_POST[ "mo2f_validate_otp_token" ] : $_POST['mo_softtoken'];
3395
+ if(!is_null($passcode) and !empty($passcode))
3396
+ {
3397
+ $passcode = sanitize_text_field($passcode);
3398
+ $this->miniorange_pass2login_start_session();
3399
+ $session_id_encrypt=$this->create_session();
3400
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_current_user_id', $currentuser->ID, 600);
3401
+ MO2f_Utility::mo2f_set_transient($session_id_encrypt, 'mo2f_1stfactor_status', 'VALIDATE_SUCCESS', 600);
3402
+
3403
+ $customer = new Customer_Setup();
3404
+ if($mo2f_configured_2FA_method == 'miniOrange Soft Token')
3405
+ $method='SOFT TOKEN';
3406
+ else if($mo2f_configured_2FA_method == 'Google Authenticator')
3407
+ $method = 'GOOGLE AUTHENTICATOR';
3408
+ $email = $Mo2fdbQueries->get_user_detail('mo2f_user_email',$currentuser->ID);
3409
+ $content = json_decode($customer->validate_otp_token( $method,$email , null, $passcode, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
3410
+
3411
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
3412
+ $redirect_to = isset($_POST[ 'redirect_to' ]) ? esc_url_raw($_POST[ 'redirect_to' ]) : null;
3413
+
3414
+ $this->mo2fa_pass2login($redirect_to, $session_id_encrypt);
3415
+ }
3416
+ else
3417
+ {
3418
+ $error = new WP_Error();
3419
+ $error->add('WRONG PASSCODE:', __('<strong>Wrong Two-factor Authentication code.</strong>'));
3420
+ return $error;
3421
+ }
3422
+
3423
+
3424
+ }
3425
+ else
3426
+ {
3427
+ $error = new WP_Error();
3428
+ $error->add('EMPTY PASSCODE:', __('<strong>Empty Two-factor Authentication code.</strong>'));
3429
+ return $error;
3430
+ }
3431
+ }
3432
+
3433
+
3434
+ if(isset($_POST['mo_woocommerce_login_prompt'])){
3435
+
3436
+ $this->miniorange_initiate_2nd_factor( $currentuser, "", $redirect_to,"",$session_id);
3437
+ }
3438
+ if(MO2f_Utility::get_index_value('GLOBALS','mo2f_is_ajax_request')){
3439
+ $data = array('notice' => '<div style="border-left:3px solid #dc3232;">&nbsp; Please enter the One Time Passcode', );
3440
+ wp_send_json_success($data);
3441
+ }
3442
+ else
3443
+ return new WP_Error( 'one_time_passcode_empty', '<strong>ERROR</strong>: Please enter the One Time Passcode.');
3444
+ // Prevent PHP notices when using app password login
3445
+
3446
+ }
3447
+ else
3448
+ {
3449
+ $otp_token = isset($_POST[ 'mo_softtoken' ]) ? trim( $_POST[ 'mo_softtoken' ] ) : '';
3450
+ }
3451
+ $attributes = isset( $_POST['miniorange_rba_attribures'] ) ? $_POST['miniorange_rba_attribures'] : null;
3452
+ $session_id = isset( $_POST['session_id'] ) ? sanitize_text_field($_POST['session_id']) : null;
3453
+ if(is_null($session_id)) {
3454
+ $session_id=$this->create_session();
3455
+ }
3456
+
3457
+
3458
+ $error=$this->miniorange_initiate_2nd_factor( $currentuser, $attributes, $redirect_to, $otp_token, $session_id );
3459
+
3460
+
3461
+ if(is_wp_error( $error)){
3462
+ return $error;
3463
+ }
3464
+ return $error;
3465
+ }
3466
+ }
3467
+ }
3468
+
3469
+ }
3470
+
3471
+ function display_email_verification($head,$body,$color)
3472
+ {
3473
+ echo "<div style='background-color: #d5e3d9; height:850px;' >
3474
+ <div style='height:350px; background-color: #3CB371; border-radius: 2px; padding:2%; '>
3475
+ <div class='mo2f_tamplate_layout' style='background-color: #ffffff;border-radius: 5px;box-shadow: 0 5px 15px rgba(0,0,0,.5); width:850px;height:350px; align-self: center; margin: 180px auto; ' >
3476
+ <img alt='logo' style='margin-left:240px ;
3477
+ margin-top:10px;width=40%;' src='https://auth.miniorange.com/moas/images/logo_large.png' />
3478
+ <div><hr></div>
3479
+
3480
+ <tbody>
3481
+ <tr>
3482
+ <td>
3483
+
3484
+ <p style='margin-top:0;margin-bottom:10px'>
3485
+ <p style='margin-top:0;margin-bottom:10px'> <h1 style='color:".$color.";text-align:center;font-size:50px'>".$head ."</h1></p>
3486
+ <p style='margin-top:0;margin-bottom:10px'>
3487
+ <p style='margin-top:0;margin-bottom:10px;text-align:center'><h2 style='text-align:center'>".$body."</h2></p>
3488
+ <p style='margin-top:0;margin-bottom:0px;font-size:11px'>
3489
+
3490
+ </td>
3491
+ </tr>
3492
+
3493
+ </div>
3494
+ </div>
3495
+ </div>";
3496
+ }
3497
+
3498
+ function mo_2_factor_enable_jquery_default_login() {
3499
+ wp_enqueue_script( 'jquery' );
3500
+ }
3501
+
3502
+ function miniorange_pass2login_footer_form() {
3503
+ ?>
3504
+ <script>
3505
+ jQuery(document).ready(function () {
3506
+ if (document.getElementById('loginform') != null) {
3507
+ jQuery('#loginform').on('submit', function (e) {
3508
+ jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
3509
+ });
3510
+ } else {
3511
+ if (document.getElementsByClassName('login') != null) {
3512
+ jQuery('.login').on('submit', function (e) {
3513
+ jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
3514
+ });
3515
+ }
3516
+ }
3517
+ });
3518
+ </script>
3519
+ <?php
3520
+
3521
+ }
3522
+
3523
+
3524
+ }
3525
+
3526
+ ?>
handler/twofa/two_fa_short_call.php CHANGED
@@ -1,43 +1,43 @@
1
- <?php
2
-
3
- include_once('two_fa_short_gateway.php');
4
-
5
- class TwoFACustomRegFormAPI
6
- {
7
- public function __construct()
8
- {
9
-
10
- }
11
-
12
- public static function challenge($phone_number,$email,$authTypeSend)
13
- {
14
-
15
-
16
- if($authTypeSend == 'email')
17
- {
18
- $auierpyasdcRy = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
19
- $cmVtYWluaW5nT1RQ = $auierpyasdcRy? $auierpyasdcRy : 0;
20
- if($cmVtYWluaW5nT1RQ > 0)
21
- {
22
- $response = TwoFAMOGateway:: mo_send_otp_token('EMAIL', '', $email);
23
- update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
24
- }
25
- else
26
- {
27
- $response = ['status'=>'ERROR','message'=>'Email Transaction Limit Exceeded'];
28
- wp_send_json($response);
29
- }
30
- }
31
- else
32
- {
33
- $response = TwoFAMOGateway:: mo_send_otp_token('SMS', $phone_number, $email);
34
- }
35
- wp_send_json($response);
36
-
37
- }
38
-
39
- public static function validate($txId, $otp)
40
- {
41
- wp_send_json(TwoFAMOGateway :: mo_validate_otp_token('OTP',$txId, $otp));
42
- }
43
  }
1
+ <?php
2
+
3
+ include_once('two_fa_short_gateway.php');
4
+
5
+ class TwoFACustomRegFormAPI
6
+ {
7
+ public function __construct()
8
+ {
9
+
10
+ }
11
+
12
+ public static function challenge($phone_number,$email,$authTypeSend)
13
+ {
14
+
15
+
16
+ if($authTypeSend == 'email')
17
+ {
18
+ $auierpyasdcRy = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
19
+ $cmVtYWluaW5nT1RQ = $auierpyasdcRy? $auierpyasdcRy : 0;
20
+ if($cmVtYWluaW5nT1RQ > 0)
21
+ {
22
+ $response = TwoFAMOGateway:: mo_send_otp_token('EMAIL', '', $email);
23
+ update_site_option("cmVtYWluaW5nT1RQ",$cmVtYWluaW5nT1RQ-1);
24
+ }
25
+ else
26
+ {
27
+ $response = ['status'=>'ERROR','message'=>'Email Transaction Limit Exceeded'];
28
+ wp_send_json($response);
29
+ }
30
+ }
31
+ else
32
+ {
33
+ $response = TwoFAMOGateway:: mo_send_otp_token('SMS', $phone_number, $email);
34
+ }
35
+ wp_send_json($response);
36
+
37
+ }
38
+
39
+ public static function validate($txId, $otp)
40
+ {
41
+ wp_send_json(TwoFAMOGateway :: mo_validate_otp_token('OTP',$txId, $otp));
42
+ }
43
  }
handler/user-profile-2fa.php CHANGED
@@ -1,275 +1,275 @@
1
- <?php
2
- $is_registered = empty(get_option('mo2f_customerkey'))?false:true;
3
- $role = $user->roles;
4
- $roles = ( array ) $user->roles;
5
- $flag = 0;
6
- foreach ( $roles as $role ) {
7
- if(get_option('mo2fa_'.$role)=='1')
8
- $flag=1;
9
- }
10
- if(!current_user_can( 'administrator', $user->ID) || (!MO2F_IS_ONPREM && !$is_registered) || $flag==0)
11
- return;
12
- else if(!MO2F_IS_ONPREM && !$is_registered)
13
- return;
14
- $cloud_methods = array("miniOrange QR Code Authentication", "miniOrange Soft Token","miniOrange Push Notification","OTP Over SMS");
15
- $id = get_current_user_id();
16
- $available_methods = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option')?get_site_option('mo2fa_free_plan_new_user_methods'):get_site_option('mo2fa_free_plan_existing_user_methods');
17
- if(!$available_methods)
18
- return;
19
- $transient_id = MO2f_Utility::random_str(20);
20
-
21
- MO2f_Utility::mo2f_set_transient($transient_id, 'mo2f_user_id', $user->ID);
22
- $same_user = $user->ID == $id?true:false;
23
- global $Mo2fdbQueries;
24
- $current_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user->ID);
25
- if($current_method == "miniOrange QR Code Authentication" || $current_method == "miniOrange Soft Token" || $current_method == "miniOrange Push Notification")
26
- $current_method = "miniOrange Authenticator";
27
- $twofactor_transactions = new Mo2fDB;
28
- $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($user->ID);
29
- if($exceeded){
30
- return;
31
- }
32
- $user_column_exists = $Mo2fdbQueries->check_if_user_column_exists( $user->ID );
33
- $email=$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
34
- if($email == ''){
35
- $Mo2fdbQueries->update_user_details($user->ID,array('mo2f_user_email'=>$user->user_email));
36
- }
37
- $email = !empty($Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ))?$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ):$user->user_email;
38
- $pass_2fa_login_session = new Miniorange_Password_2Factor_Login();
39
- if(!$user_column_exists){
40
- $Mo2fdbQueries->insert_user( $user->ID );
41
- $content = $pass_2fa_login_session->create_user_in_miniOrange($user->ID,$email,'SOFT TOKEN');
42
- }
43
- $registerMobile = new Two_Factor_Setup();
44
- $content = $registerMobile->register_mobile($email);
45
- update_user_meta($user->ID,'registered_mobile',$content);
46
- $two_factor_methods_descriptions = array(
47
- "miniOrange QR Code Authentication" => "Scan the QR code from the account in your miniOrange Authenticator App to login.",
48
- "miniOrange Authenticator" => "Scan the QR code from the account in your miniOrange Authenticator App to login.",
49
- "miniOrange Soft Token" => "Enter the soft token from the account in your miniOrange Authenticator App to login.",
50
- "miniOrange Push Notification" => "Accept a push notification in your miniOrange Authenticator App to login.",
51
- "Google Authenticator" => "Enter the soft token from the account in your Google Authenticator App to login.",
52
- "Security Questions" => "Answer the three security questions you had set, to login.",
53
- "OTP Over SMS" => "Enter the One Time Passcode sent to your phone to login.",
54
- "Authy Authenticator" => "Enter the soft token from the account in your Authy Authenticator App to login.",
55
- "OTP Over Email" => "Enter the One Time Passcode sent to your email to login.",
56
- "Email Verification" => "Accept the verification link sent to your email to login.",
57
- "OTP Over SMS and Email" => "Enter the One Time Passcode sent to your phone and email to login.",
58
- "Hardware Token" => "Enter the One Time Passcode on your Hardware Token to login."
59
- );
60
- global $mainDir;
61
- wp_enqueue_style( 'mo2f_user-profile_style', $mainDir.'/includes/css/user-profile.css');
62
- ?>
63
- <h3><?php esc_html_e( 'Set 2-Factor Authentication', 'miniorange 2-factor-authentication' ); ?></h3>
64
- <table class="form-table" id="mo2fa_form-table-user-profile">
65
- <tr>
66
- <th style="text-align: left;">
67
- <?php echo mo2f_lt( '2-Factor Options' ); ?>
68
- </th>
69
- <td>
70
- <form name="f" method="post" action="" id="mo2f_update_2fa">
71
- <div class="mo2fa_tab">
72
- <?php foreach ( $two_factor_methods_descriptions as $method => $description ){
73
- if(in_array($method, $available_methods)){
74
- $trimmed_method = str_replace(' ','',$method);?>
75
- <button class="mo2fa_tablinks" type="button"
76
- <?php if((!empty($current_method) && MO2f_Utility::is_same_method($method,$current_method)) || (empty($current_method) && MO2f_Utility::is_same_method($method,'miniOrange Authenticator')) ){?>
77
- id="defaultOpen"
78
- <?php }?>
79
- onclick='mo2fa_viewMethod(event, "<?php echo esc_attr( $trimmed_method );?>")'><?php echo esc_attr( $method );?>
80
- </button>
81
- <?php }}?>
82
- </div>
83
- </form>
84
- <?php foreach ( $two_factor_methods_descriptions as $method => $description ){
85
- if(in_array($method, $available_methods)){
86
- $trimmed_method = str_replace(' ','',$method);?>
87
- <div id="<?php echo esc_attr( $trimmed_method );?>" class="mo2fa_tabcontent">
88
- <p><?php echo esc_attr( $description );?></p>
89
- <p><?php methods_on_user_profile($method,$user,$transient_id);?></p>
90
- </div>
91
- <?php }}?>
92
- </td>
93
- </tr>
94
- </table>
95
- <div id="wpns_nav_message"></div>
96
- <input type="hidden" name="MO2F_IS_ONPREM" value="<?php echo MO2F_IS_ONPREM;?>">
97
- <input type="hidden" name="same_user" value="<?php echo $same_user;?>">
98
- <input type="hidden" name="is_registered" value="<?php echo $is_registered;?>">
99
- <input type="hidden" name="mo2f-update-mobile-nonce" value="<?php echo wp_create_nonce("mo2f-update-mobile-nonce");?>">
100
- <input type="hidden" name="transient_id" value="<?php echo $transient_id;?>">
101
- <input type="hidden" name='method' id="method" value="NONE">
102
- <input type="hidden" name='mo2f_configuration_status' id="mo2f_configuration_status" value="Configuration">
103
- <?php
104
- wp_enqueue_script( 'user-profile-2fa-script', $mainDir.'/includes/js/user-profile-twofa.js');
105
-
106
- function methods_on_user_profile($method,$user,$transient_id){
107
- global $Mo2fdbQueries,$mainDir;
108
- $email=$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
109
- $pass_2fa_login_session = new Miniorange_Password_2Factor_Login();
110
- $trimmed_method = str_replace(' ','',$method);
111
- $is_registered = get_option('mo2f_customerkey');
112
- $id = get_current_user_id();
113
- if($email == ''){
114
- $Mo2fdbQueries->update_user_details($user->ID,array('mo2f_user_email'=>$user->user_email));
115
- }
116
- $email = !empty($Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ))?$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ):$user->user_email;
117
- switch($method){
118
- case "miniOrange Authenticator":
119
- if(!$is_registered){
120
- $message = "Please register with miniOrange for using this method.";
121
- echo mo2f_lt( $message );
122
- }
123
- else{
124
- ?>
125
- <div id="mo2fa_display_mo_methods">
126
- <h4 class="mo2fa_select_method">
127
- Select Authentication method :
128
- </h4>
129
- <input type="button" name="mo2f_method" id="miniOrangeSoftTokenButton" class="mo2f_miniAuthApp" value="Soft Token" />
130
- <input type="button" name="mo2f_method" id="miniOrangeQRCodeAuthenticationButton" class="mo2f_miniAuthApp" value="QR Code Authentication" />
131
- <input type="button" name="mo2f_method" id="miniOrangePushNotificationButton" class="mo2f_miniAuthApp" value="Push Notification" />
132
- </div>
133
- <?php
134
- if($id == $user->ID)
135
- {
136
- $content = get_user_meta($user->ID,'registered_mobile',true);
137
- $response = json_decode($content, true);
138
- $message = '';
139
-
140
- if(json_last_error() == JSON_ERROR_NONE) {
141
- if($response['status'] == 'ERROR'){
142
- $mo_qr_details['message'] = Mo2fConstants::langTranslate($response['message']);
143
- delete_user_meta( $user->ID, 'miniorageqr' );
144
- }else{
145
- if($response['status'] == 'IN_PROGRESS'){
146
-
147
- $mo_qr_details['message'] = '';
148
- $mo_qr_details['mo2f-login-qrCode']=$response['qrCode'];
149
- update_user_meta($user->ID,'miniorageqr',$mo_qr_details);
150
- }else{
151
- $mo_qr_details['message'] = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
152
- delete_user_meta( $user->ID, 'miniorageqr' );
153
- }
154
- }
155
- }
156
- ?>
157
-
158
- <div class="mcol-2" id='mo2f_qrcode'>
159
- <table class="mo2f_settings_table">
160
- <br><?php
161
- echo (isset($mo_qr_details['mo2f-login-qrCode'])?'<img style="width:165px;" src="data:image/jpg;base64,' .$mo_qr_details['mo2f-login-qrCode']. '" />':'Please register with miniOrange for using this method') ;
162
- ?>
163
- </table>
164
- <?php
165
- if(isset($mo_qr_details['mo2f-login-qrCode'])){
166
- ?>
167
- <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
168
-
169
- <table id="mo2f_setup_mo_methods">
170
- <td class="bg-none"><?php echo mo2f_lt( 'Enter Code:' )?></td>
171
- <td><input type="tel" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="mo_qr_auth_code" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="" pattern="[0-9]{4,8}" title="<?php echo mo2f_lt('Enter OTP:'); ?>"/></td>
172
- <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save_qr" class="button button1" ><?php echo mo2f_lt( 'Verify and Save' ); ?></a></td>
173
- </table>
174
-
175
- </form>
176
- <?php } ?>
177
- </div>
178
-
179
- <?php
180
- }
181
- else{
182
- $message= "Link to reconfigure 2nd factor will be sent to ".$email;
183
- echo mo2f_lt( $message );
184
- }
185
- }
186
- break;
187
- case "Authy Authenticator":
188
- case "Google Authenticator":
189
- if($user->ID == $id){
190
- if(MO2F_IS_ONPREM){
191
- include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'twofa'. DIRECTORY_SEPARATOR. 'gaonprem.php';
192
- $gauth_obj= new Google_auth_onpremise();
193
-
194
- $ga_secret = $gauth_obj->createSecret();
195
- $issuer = get_site_option( 'mo2f_GA_account_name', 'miniOrangeAu' );
196
- $url = $gauth_obj->geturl( $ga_secret, $issuer, $email );
197
- $mo2f_google_auth = array('ga_qrCode'=> $url,'ga_secret'=>$ga_secret);
198
- update_user_meta( $user->ID, 'mo2f_google_auth', json_encode( $mo2f_google_auth ) );
199
- $otpcode = $gauth_obj->getCode($ga_secret);
200
- $data = isset($mo2f_google_auth) ? $mo2f_google_auth['ga_qrCode'] : null;
201
- wp_enqueue_script( 'mo_wpns_qrcode_script', $mainDir.'/includes/jquery-qrcode/jquery-qrcode.js' );
202
- wp_enqueue_script( 'mo_wpns_min_qrcode_script', $mainDir.'/includes/jquery-qrcode/jquery-qrcode.min.js');
203
- echo '<div class="mo2f_gauth_column mo2f_gauth_left" >';
204
- echo '<div class="mo2f_gauth" data-qrcode='.$data.'></div>';
205
- echo '</div>';
206
- }else{
207
- if(!get_user_meta($user->ID, 'mo2f_google_auth', true)){
208
- Miniorange_Authentication::mo2f_get_GA_parameters($user);
209
- }
210
- $mo2f_google_auth = get_user_meta($user->ID, 'mo2f_google_auth', true);
211
- $data = isset($mo2f_google_auth['ga_qrCode']) ? $mo2f_google_auth['ga_qrCode'] : null;
212
- $ga_secret = isset($mo2f_google_auth['ga_secret']) ? $mo2f_google_auth['ga_secret'] : null;
213
- echo '<br><div id="displayQrCode">
214
- <img id="mo2f_gauth" style="line-height: 0;background:white;" src="data:image/jpg;base64,' . $data . '" />
215
- </div>';
216
- }
217
- ?>
218
-
219
- <div class="mcol-2">
220
- <br>
221
- <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
222
-
223
- <table id="mo2f_setup_ga">
224
- <td class="bg-none"><?php echo mo2f_lt( 'Enter Code:' )?></td>
225
- <td><input type="tel" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="google_auth_code" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="" pattern="[0-9]{4,8}" title="<?php echo mo2f_lt('Enter OTP:'); ?>"/></td>
226
- <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save_GA" class="button button1" ><?php echo mo2f_lt( 'Verify and Save' ); ?></a></td>
227
- </table>
228
-
229
- <input type="hidden" name="ga_secret" value="<?php echo $ga_secret;?>">
230
- </form>
231
-
232
- </div>
233
- <?php
234
- }else{
235
- $message= "Link to reconfigure 2nd factor will be sent to ".$email;
236
- echo mo2f_lt( $message );
237
- }
238
- break;
239
- case "OTP Over SMS":
240
- if(!$is_registered){
241
- $message = "Please register with miniOrange for using this method.";
242
- echo mo2f_lt( $message );
243
- }
244
- else{
245
- $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
246
- $user_phone = $mo2f_user_phone ? $mo2f_user_phone : get_option( 'user_phone_temp' );
247
- ?>
248
- <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
249
-
250
- <table id="mo2f_setup_sms">
251
- <td class="bg-none"><?php echo mo2f_lt( 'Authentication codes will be sent to ' )?></td>
252
- <td><input type="text" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="verify_phone" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="<?php echo $user_phone ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" required="true" title="<?php echo mo2f_lt( 'Enter phone number without any space or dashes' ); ?>"/></td>
253
- <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save" class="button button1" ><?php echo mo2f_lt( 'Save' ); ?></a></td>
254
- </table>
255
-
256
- </form>
257
- <?php
258
- }
259
- break;
260
- case "Security Questions":
261
- mo2f_configure_kba_questions($user);
262
- break;
263
- case "OTP Over Email":
264
- case "Email Verification":
265
- if(!$Mo2fdbQueries->check_if_user_column_exists($user->ID)){
266
- $content = $pass_2fa_login_session->create_user_in_miniOrange($user->ID,$email,$method);
267
- }
268
- $email = ($email=='')?$user->user_email:$email;
269
- $message = "Authentication codes will be sent to ".$email;
270
- echo mo2f_lt( $message );
271
- break;
272
- $Mo2fdbQueries->delete_user_login_sessions($user->ID);
273
- }
274
- }
275
  ?>
1
+ <?php
2
+ $is_registered = empty(get_option('mo2f_customerkey'))?false:true;
3
+ $role = $user->roles;
4
+ $roles = ( array ) $user->roles;
5
+ $flag = 0;
6
+ foreach ( $roles as $role ) {
7
+ if(get_option('mo2fa_'.$role)=='1')
8
+ $flag=1;
9
+ }
10
+ if(!current_user_can( 'administrator', $user->ID) || (!MO2F_IS_ONPREM && !$is_registered) || $flag==0)
11
+ return;
12
+ else if(!MO2F_IS_ONPREM && !$is_registered)
13
+ return;
14
+ $cloud_methods = array("miniOrange QR Code Authentication", "miniOrange Soft Token","miniOrange Push Notification","OTP Over SMS");
15
+ $id = get_current_user_id();
16
+ $available_methods = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option')?get_site_option('mo2fa_free_plan_new_user_methods'):get_site_option('mo2fa_free_plan_existing_user_methods');
17
+ if(!$available_methods)
18
+ return;
19
+ $transient_id = MO2f_Utility::random_str(20);
20
+
21
+ MO2f_Utility::mo2f_set_transient($transient_id, 'mo2f_user_id', $user->ID);
22
+ $same_user = $user->ID == $id?true:false;
23
+ global $Mo2fdbQueries;
24
+ $current_method = $Mo2fdbQueries->get_user_detail('mo2f_configured_2FA_method',$user->ID);
25
+ if($current_method == "miniOrange QR Code Authentication" || $current_method == "miniOrange Soft Token" || $current_method == "miniOrange Push Notification")
26
+ $current_method = "miniOrange Authenticator";
27
+ $twofactor_transactions = new Mo2fDB;
28
+ $exceeded = $twofactor_transactions->check_alluser_limit_exceeded($user->ID);
29
+ if($exceeded){
30
+ return;
31
+ }
32
+ $user_column_exists = $Mo2fdbQueries->check_if_user_column_exists( $user->ID );
33
+ $email=$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
34
+ if($email == ''){
35
+ $Mo2fdbQueries->update_user_details($user->ID,array('mo2f_user_email'=>$user->user_email));
36
+ }
37
+ $email = !empty($Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ))?$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ):$user->user_email;
38
+ $pass_2fa_login_session = new Miniorange_Password_2Factor_Login();
39
+ if(!$user_column_exists){
40
+ $Mo2fdbQueries->insert_user( $user->ID );
41
+ $content = $pass_2fa_login_session->create_user_in_miniOrange($user->ID,$email,'SOFT TOKEN');
42
+ }
43
+ $registerMobile = new Two_Factor_Setup();
44
+ $content = $registerMobile->register_mobile($email);
45
+ update_user_meta($user->ID,'registered_mobile',$content);
46
+ $two_factor_methods_descriptions = array(
47
+ "miniOrange QR Code Authentication" => "Scan the QR code from the account in your miniOrange Authenticator App to login.",
48
+ "miniOrange Authenticator" => "Scan the QR code from the account in your miniOrange Authenticator App to login.",
49
+ "miniOrange Soft Token" => "Enter the soft token from the account in your miniOrange Authenticator App to login.",
50
+ "miniOrange Push Notification" => "Accept a push notification in your miniOrange Authenticator App to login.",
51
+ "Google Authenticator" => "Enter the soft token from the account in your Google Authenticator App to login.",
52
+ "Security Questions" => "Answer the three security questions you had set, to login.",
53
+ "OTP Over SMS" => "Enter the One Time Passcode sent to your phone to login.",
54
+ "Authy Authenticator" => "Enter the soft token from the account in your Authy Authenticator App to login.",
55
+ "OTP Over Email" => "Enter the One Time Passcode sent to your email to login.",
56
+ "Email Verification" => "Accept the verification link sent to your email to login.",
57
+ "OTP Over SMS and Email" => "Enter the One Time Passcode sent to your phone and email to login.",
58
+ "Hardware Token" => "Enter the One Time Passcode on your Hardware Token to login."
59
+ );
60
+ global $mainDir;
61
+ wp_enqueue_style( 'mo2f_user-profile_style', $mainDir.'/includes/css/user-profile.css');
62
+ ?>
63
+ <h3><?php esc_html_e( 'Set 2-Factor Authentication', 'miniorange 2-factor-authentication' ); ?></h3>
64
+ <table class="form-table" id="mo2fa_form-table-user-profile">
65
+ <tr>
66
+ <th style="text-align: left;">
67
+ <?php echo mo2f_lt( '2-Factor Options' ); ?>
68
+ </th>
69
+ <td>
70
+ <form name="f" method="post" action="" id="mo2f_update_2fa">
71
+ <div class="mo2fa_tab">
72
+ <?php foreach ( $two_factor_methods_descriptions as $method => $description ){
73
+ if(in_array($method, $available_methods)){
74
+ $trimmed_method = str_replace(' ','',$method);?>
75
+ <button class="mo2fa_tablinks" type="button"
76
+ <?php if((!empty($current_method) && MO2f_Utility::is_same_method($method,$current_method)) || (empty($current_method) && MO2f_Utility::is_same_method($method,'miniOrange Authenticator')) ){?>
77
+ id="defaultOpen"
78
+ <?php }?>
79
+ onclick='mo2fa_viewMethod(event, "<?php echo esc_attr( $trimmed_method );?>")'><?php echo esc_attr( $method );?>
80
+ </button>
81
+ <?php }}?>
82
+ </div>
83
+ </form>
84
+ <?php foreach ( $two_factor_methods_descriptions as $method => $description ){
85
+ if(in_array($method, $available_methods)){
86
+ $trimmed_method = str_replace(' ','',$method);?>
87
+ <div id="<?php echo esc_attr( $trimmed_method );?>" class="mo2fa_tabcontent">
88
+ <p><?php echo esc_attr( $description );?></p>
89
+ <p><?php methods_on_user_profile($method,$user,$transient_id);?></p>
90
+ </div>
91
+ <?php }}?>
92
+ </td>
93
+ </tr>
94
+ </table>
95
+ <div id="wpns_nav_message"></div>
96
+ <input type="hidden" name="MO2F_IS_ONPREM" value="<?php echo MO2F_IS_ONPREM;?>">
97
+ <input type="hidden" name="same_user" value="<?php echo $same_user;?>">
98
+ <input type="hidden" name="is_registered" value="<?php echo $is_registered;?>">
99
+ <input type="hidden" name="mo2f-update-mobile-nonce" value="<?php echo wp_create_nonce("mo2f-update-mobile-nonce");?>">
100
+ <input type="hidden" name="transient_id" value="<?php echo $transient_id;?>">
101
+ <input type="hidden" name='method' id="method" value="NONE">
102
+ <input type="hidden" name='mo2f_configuration_status' id="mo2f_configuration_status" value="Configuration">
103
+ <?php
104
+ wp_enqueue_script( 'user-profile-2fa-script', $mainDir.'/includes/js/user-profile-twofa.js');
105
+
106
+ function methods_on_user_profile($method,$user,$transient_id){
107
+ global $Mo2fdbQueries,$mainDir;
108
+ $email=$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID );
109
+ $pass_2fa_login_session = new Miniorange_Password_2Factor_Login();
110
+ $trimmed_method = str_replace(' ','',$method);
111
+ $is_registered = get_option('mo2f_customerkey');
112
+ $id = get_current_user_id();
113
+ if($email == ''){
114
+ $Mo2fdbQueries->update_user_details($user->ID,array('mo2f_user_email'=>$user->user_email));
115
+ }
116
+ $email = !empty($Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ))?$Mo2fdbQueries->get_user_detail( 'mo2f_user_email', $user->ID ):$user->user_email;
117
+ switch($method){
118
+ case "miniOrange Authenticator":
119
+ if(!$is_registered){
120
+ $message = "Please register with miniOrange for using this method.";
121
+ echo mo2f_lt( $message );
122
+ }
123
+ else{
124
+ ?>
125
+ <div id="mo2fa_display_mo_methods">
126
+ <h4 class="mo2fa_select_method">
127
+ Select Authentication method :
128
+ </h4>
129
+ <input type="button" name="mo2f_method" id="miniOrangeSoftTokenButton" class="mo2f_miniAuthApp" value="Soft Token" />
130
+ <input type="button" name="mo2f_method" id="miniOrangeQRCodeAuthenticationButton" class="mo2f_miniAuthApp" value="QR Code Authentication" />
131
+ <input type="button" name="mo2f_method" id="miniOrangePushNotificationButton" class="mo2f_miniAuthApp" value="Push Notification" />
132
+ </div>
133
+ <?php
134
+ if($id == $user->ID)
135
+ {
136
+ $content = get_user_meta($user->ID,'registered_mobile',true);
137
+ $response = json_decode($content, true);
138
+ $message = '';
139
+
140
+ if(json_last_error() == JSON_ERROR_NONE) {
141
+ if($response['status'] == 'ERROR'){
142
+ $mo_qr_details['message'] = Mo2fConstants::langTranslate($response['message']);
143
+ delete_user_meta( $user->ID, 'miniorageqr' );
144
+ }else{
145
+ if($response['status'] == 'IN_PROGRESS'){
146
+
147
+ $mo_qr_details['message'] = '';
148
+ $mo_qr_details['mo2f-login-qrCode']=$response['qrCode'];
149
+ update_user_meta($user->ID,'miniorageqr',$mo_qr_details);
150
+ }else{
151
+ $mo_qr_details['message'] = __('An error occured while processing your request. Please Try again.','miniorange-2-factor-authentication');
152
+ delete_user_meta( $user->ID, 'miniorageqr' );
153
+ }
154
+ }
155
+ }
156
+ ?>
157
+
158
+ <div class="mcol-2" id='mo2f_qrcode'>
159
+ <table class="mo2f_settings_table">
160
+ <br><?php
161
+ echo (isset($mo_qr_details['mo2f-login-qrCode'])?'<img style="width:165px;" src="data:image/jpg;base64,' .$mo_qr_details['mo2f-login-qrCode']. '" />':'Please register with miniOrange for using this method') ;
162
+ ?>
163
+ </table>
164
+ <?php
165
+ if(isset($mo_qr_details['mo2f-login-qrCode'])){
166
+ ?>
167
+ <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
168
+
169
+ <table id="mo2f_setup_mo_methods">
170
+ <td class="bg-none"><?php echo mo2f_lt( 'Enter Code:' )?></td>
171
+ <td><input type="tel" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="mo_qr_auth_code" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="" pattern="[0-9]{4,8}" title="<?php echo mo2f_lt('Enter OTP:'); ?>"/></td>
172
+ <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save_qr" class="button button1" ><?php echo mo2f_lt( 'Verify and Save' ); ?></a></td>
173
+ </table>
174
+
175
+ </form>
176
+ <?php } ?>
177
+ </div>
178
+
179
+ <?php
180
+ }
181
+ else{
182
+ $message= "Link to reconfigure 2nd factor will be sent to ".$email;
183
+ echo mo2f_lt( $message );
184
+ }
185
+ }
186
+ break;
187
+ case "Authy Authenticator":
188
+ case "Google Authenticator":
189
+ if($user->ID == $id){
190
+ if(MO2F_IS_ONPREM){
191
+ include_once dirname( __FILE__ ) . DIRECTORY_SEPARATOR.'twofa'. DIRECTORY_SEPARATOR. 'gaonprem.php';
192
+ $gauth_obj= new Google_auth_onpremise();
193
+
194
+ $ga_secret = $gauth_obj->createSecret();
195
+ $issuer = get_site_option( 'mo2f_GA_account_name', 'miniOrangeAu' );
196
+ $url = $gauth_obj->geturl( $ga_secret, $issuer, $email );
197
+ $mo2f_google_auth = array('ga_qrCode'=> $url,'ga_secret'=>$ga_secret);
198
+ update_user_meta( $user->ID, 'mo2f_google_auth', json_encode( $mo2f_google_auth ) );
199
+ $otpcode = $gauth_obj->getCode($ga_secret);
200
+ $data = isset($mo2f_google_auth) ? $mo2f_google_auth['ga_qrCode'] : null;
201
+ wp_enqueue_script( 'mo_wpns_qrcode_script', $mainDir.'/includes/jquery-qrcode/jquery-qrcode.js' );
202
+ wp_enqueue_script( 'mo_wpns_min_qrcode_script', $mainDir.'/includes/jquery-qrcode/jquery-qrcode.min.js');
203
+ echo '<div class="mo2f_gauth_column mo2f_gauth_left" >';
204
+ echo '<div class="mo2f_gauth" data-qrcode='.$data.'></div>';
205
+ echo '</div>';
206
+ }else{
207
+ if(!get_user_meta($user->ID, 'mo2f_google_auth', true)){
208
+ Miniorange_Authentication::mo2f_get_GA_parameters($user);
209
+ }
210
+ $mo2f_google_auth = get_user_meta($user->ID, 'mo2f_google_auth', true);
211
+ $data = isset($mo2f_google_auth['ga_qrCode']) ? $mo2f_google_auth['ga_qrCode'] : null;
212
+ $ga_secret = isset($mo2f_google_auth['ga_secret']) ? $mo2f_google_auth['ga_secret'] : null;
213
+ echo '<br><div id="displayQrCode">
214
+ <img id="mo2f_gauth" style="line-height: 0;background:white;" src="data:image/jpg;base64,' . $data . '" />
215
+ </div>';
216
+ }
217
+ ?>
218
+
219
+ <div class="mcol-2">
220
+ <br>
221
+ <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
222
+
223
+ <table id="mo2f_setup_ga">
224
+ <td class="bg-none"><?php echo mo2f_lt( 'Enter Code:' )?></td>
225
+ <td><input type="tel" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="google_auth_code" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="" pattern="[0-9]{4,8}" title="<?php echo mo2f_lt('Enter OTP:'); ?>"/></td>
226
+ <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save_GA" class="button button1" ><?php echo mo2f_lt( 'Verify and Save' ); ?></a></td>
227
+ </table>
228
+
229
+ <input type="hidden" name="ga_secret" value="<?php echo $ga_secret;?>">
230
+ </form>
231
+
232
+ </div>
233
+ <?php
234
+ }else{
235
+ $message= "Link to reconfigure 2nd factor will be sent to ".$email;
236
+ echo mo2f_lt( $message );
237
+ }
238
+ break;
239
+ case "OTP Over SMS":
240
+ if(!$is_registered){
241
+ $message = "Please register with miniOrange for using this method.";
242
+ echo mo2f_lt( $message );
243
+ }
244
+ else{
245
+ $mo2f_user_phone = $Mo2fdbQueries->get_user_detail( 'mo2f_user_phone', $user->ID );
246
+ $user_phone = $mo2f_user_phone ? $mo2f_user_phone : get_option( 'user_phone_temp' );
247
+ ?>
248
+ <form name="f" method="post" action="" id="<?php echo 'mo2f_verify_form-'.mo2f_lt($trimmed_method); ?>">
249
+
250
+ <table id="mo2f_setup_sms">
251
+ <td class="bg-none"><?php echo mo2f_lt( 'Authentication codes will be sent to ' )?></td>
252
+ <td><input type="text" class="mo2f_table_textbox" style="margin-left: 1%; margin-right: 1%; width:200px;" name="verify_phone" id="<?php echo 'textbox-'.mo2f_lt($trimmed_method); ?>" value="<?php echo $user_phone ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" required="true" title="<?php echo mo2f_lt( 'Enter phone number without any space or dashes' ); ?>"/></td>
253
+ <td><a id="<?php echo 'save-'.mo2f_lt($trimmed_method); ?>" name="save" class="button button1" ><?php echo mo2f_lt( 'Save' ); ?></a></td>
254
+ </table>
255
+
256
+ </form>
257
+ <?php
258
+ }
259
+ break;
260
+ case "Security Questions":
261
+ mo2f_configure_kba_questions($user);
262
+ break;
263
+ case "OTP Over Email":
264
+ case "Email Verification":
265
+ if(!$Mo2fdbQueries->check_if_user_column_exists($user->ID)){
266
+ $content = $pass_2fa_login_session->create_user_in_miniOrange($user->ID,$email,$method);
267
+ }
268
+ $email = ($email=='')?$user->user_email:$email;
269
+ $message = "Authentication codes will be sent to ".$email;
270
+ echo mo2f_lt( $message );
271
+ break;
272
+ $Mo2fdbQueries->delete_user_login_sessions($user->ID);
273
+ }
274
+ }
275
  ?>
helper/curl.php CHANGED
@@ -1,310 +1,310 @@
1
- <?php
2
-
3
- class MocURL
4
- {
5
-
6
- public static function create_customer($email, $company, $password, $phone = '', $first_name = '', $last_name = '')
7
- {
8
- $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/add';
9
- $fields = array (
10
- 'companyName' => $company,
11
- 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin',
12
- 'productInterest' => 'API_2FA',
13
- 'firstname' => $first_name,
14
- 'lastname' => $last_name,
15
- 'email' => $email,
16
- 'phone' => $phone,
17
- 'password' => $password
18
- );
19
- $json = json_encode($fields);
20
- $response = self::callAPI($url, $json);
21
- return $response;
22
- }
23
-
24
- public static function get_customer_key($email, $password)
25
- {
26
- $url = MoWpnsConstants::HOST_NAME. "/moas/rest/customer/key";
27
- $fields = array (
28
- 'email' => $email,
29
- 'password' => $password
30
- );
31
- $json = json_encode($fields);
32
- $response = self::callAPI($url, $json);
33
-
34
- return $response;
35
- }
36
-
37
- function submit_contact_us( $q_email, $q_phone, $query, $call_setup=false)
38
- {
39
- $current_user = wp_get_current_user();
40
- $url = MoWpnsConstants::HOST_NAME . "/moas/rest/customer/contact-us";
41
-
42
- $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
43
- $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
44
- $onprem = MO2F_IS_ONPREM ?'O':'C';
45
-
46
- $customer_feature = "";
47
-
48
- if ( $is_ec_with_1_user ) {
49
- $customer_feature = "V1";
50
- }else if ( $is_nc_with_1_user ) {
51
- $customer_feature = "V3";
52
- }
53
- global $moWpnsUtility;
54
- if($call_setup)
55
- $query = '[Call Request - WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
56
- else
57
- $query = '[WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
58
-
59
- $fields = array(
60
- 'firstName' => $current_user->user_firstname,
61
- 'lastName' => $current_user->user_lastname,
62
- 'company' => $_SERVER['SERVER_NAME'],
63
- 'email' => $q_email,
64
- 'ccEmail' => '2fasupport@xecurify.com',
65
- 'phone' => $q_phone,
66
- 'query' => $query
67
- );
68
- $field_string = json_encode( $fields );
69
- $response = self::callAPI($url, $field_string);
70
-
71
- return true;
72
- }
73
-
74
- function lookupIP($ip)
75
- {
76
- $url = MoWpnsConstants::HOST_NAME. "/moas/rest/security/iplookup";
77
- $fields = array (
78
- 'ip' => $ip
79
- );
80
- $json = json_encode($fields);
81
- $response = self::callAPI($url, $json);
82
- return $response;
83
- }
84
- //CHECK
85
- function send_otp_token($auth_type, $phone, $email)
86
- {
87
-
88
- $url = MoWpnsConstants::HOST_NAME . '/moas/api/auth/challenge';
89
- $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
90
- $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
91
-
92
- $fields = array(
93
- 'customerKey' => $customerKey,
94
- 'email' => $email,
95
- 'phone' => $phone,
96
- 'authType' => $auth_type,
97
- 'transactionName' => 'miniOrange 2-Factor'
98
- );
99
- $json = json_encode($fields);
100
- $authHeader = $this->createAuthHeader($customerKey,$apiKey);
101
- $response = self::callAPI($url, $json, $authHeader);
102
- return $response;
103
- }
104
-
105
- function validate_recaptcha($ip,$response)
106
- {
107
- $url = MoWpnsConstants::RECAPTCHA_VERIFY;
108
- $json = "";
109
- $fields = array(
110
- 'response' => $response,
111
- 'secret' => get_option('mo_wpns_recaptcha_secret_key'),
112
- 'remoteip' => $ip
113
- );
114
- foreach($fields as $key=>$value) { $json .= $key.'='.$value.'&'; }
115
- rtrim($json, '&');
116
- $response = self::callAPI($url, $json, null);
117
- return $response;
118
- }
119
-
120
- function get_Captcha_v3($Secretkey)
121
- {
122
-
123
- $json = "";
124
- $url = "https://www.google.com/recaptcha/api/siteverify";
125
- $fields = array(
126
- 'response' => $Secretkey,
127
- 'secret' => get_option('mo_wpns_recaptcha_secret_key_v3'),
128
- 'remoteip' => $_SERVER['REMOTE_ADDR']
129
- );
130
- foreach($fields as $key=>$value) { $json .= $key.'='.$value.'&'; }
131
- json_encode($json);
132
- $result = $this->callAPI($url, $json, null);
133
-
134
- return $result;
135
- }
136
-
137
- function validate_otp_token($transactionId,$otpToken)
138
- {
139
- $url = MoWpnsConstants::HOST_NAME . '/moas/api/auth/validate';
140
- $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
141
- $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
142
-
143
- $fields = array(
144
- 'txId' => $transactionId,
145
- 'token' => $otpToken,
146
- );
147
-
148
- $json = json_encode($fields);
149
- $authHeader = $this->createAuthHeader($customerKey,$apiKey);
150
- $response = self::callAPI($url, $json, $authHeader);
151
- return $response;
152
- }
153
-
154
- function check_customer($email)
155
- {
156
- $url = MoWpnsConstants::HOST_NAME . "/moas/rest/customer/check-if-exists";
157
- $fields = array(
158
- 'email' => $email,
159
- );
160
- $json = json_encode($fields);
161
- $response = self::callAPI($url, $json);
162
- return $response;
163
- }
164
-
165
- function mo_wpns_forgot_password()
166
- {
167
-
168
- $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/password-reset';
169
- $email = get_option('mo2f_email');
170
- $customerKey = get_option('mo2f_customerKey');
171
- $apiKey = get_option('mo2f_api_key');
172
-
173
- $fields = array(
174
- 'email' => $email
175
- );
176
-
177
- $json = json_encode($fields);
178
- $authHeader = $this->createAuthHeader($customerKey,$apiKey);
179
- $response = self::callAPI($url, $json, $authHeader);
180
- return $response;
181
- }
182
-
183
- function send_notification($toEmail,$subject,$content,$fromEmail,$fromName,$toName)
184
- {
185
- $headers = "MIME-Version: 1.0" . "\r\n";
186
- $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
187
-
188
- $headers .= 'From: '.$fromName.'<'.$fromEmail.'>' . "\r\n";
189
-
190
- mail($toEmail,$subject,$content,$headers);
191
-
192
- return json_encode(array("status"=>'SUCCESS','statusMessage'=>'SUCCESS'));
193
- }
194
-
195
- //added for feedback
196
-
197
- function send_email_alert($email,$phone,$message,$feedback_option){
198
- global $moWpnsUtility;
199
- global $user;
200
- $url = MoWpnsConstants::HOST_NAME . '/moas/api/notify/send';
201
- $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
202
- $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
203
- $fromEmail = 'no-reply@xecurify.com';
204
- $Di = get_site_option('No_of_days_active_work');
205
- $Di = intval($Di);
206
- if ($feedback_option == 'mo_wpns_skip_feedback')
207
- {
208
- $subject = "Deactivate [Feedback Skipped]: WordPress miniOrange 2-Factor Plugin :" .$Di ;
209
-
210
- }
211
- elseif ($feedback_option == 'mo_wpns_feedback' )
212
- {
213
-
214
- $subject = "Feedback: WordPress miniOrange 2-Factor Plugin - ". $email.' : ' .$Di;
215
- }
216
- elseif ($feedback_option == 'mo_wpns_rating' )
217
- {
218
- $subject = "Feedback: WordPress miniOrange 2-Factor Plugin - ". $email.' : '.$Di;
219
- }
220
-
221
-
222
- $user = wp_get_current_user();
223
-
224
- $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
225
- $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
226
- $onprem = MO2F_IS_ONPREM ? 'O':'C';
227
-
228
- $customer_feature = "";
229
-
230
-
231
- if ( $is_ec_with_1_user ) {
232
- $customer_feature = "V1";
233
- }else if ( $is_nc_with_1_user ) {
234
- $customer_feature = "V3";
235
- }
236
-
237
- $query = '[WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
238
-
239
-
240
- $content='<div >Hello, <br><br>Ticket ID:'.$moWpnsUtility->getFeatureStatus().'<br><br>First Name :'.$user->user_firstname.'<br><br>Last Name :'.$user->user_lastname.' <br><br>Company :<a href="'.$_SERVER['SERVER_NAME'].'" target="_blank" >'.$_SERVER['SERVER_NAME'].'</a><br><br>Phone Number :'.$phone.'<br><br>Email :<a href="mailto:'.$email.'" target="_blank">'.$email.'</a><br><br>Query :'.$query.'</div>';
241
-
242
-
243
- $fields = array(
244
- 'customerKey' => $customerKey,
245
- 'sendEmail' => true,
246
- 'email' => array(
247
- 'customerKey' => $customerKey,
248
- 'fromEmail' => $fromEmail,
249
- 'fromName' => 'Xecurify',
250
- 'toEmail' => '2fasupport@xecurify.com',
251
- 'toName' => '2fasupport@xecurify.com',
252
- 'subject' => $subject,
253
- 'content' => $content
254
- ),
255
- );
256
- $field_string = json_encode($fields);
257
- $authHeader = $this->createAuthHeader($customerKey,$apiKey);
258
- $response = self::callAPI($url, $field_string,$authHeader);
259
- return $response;
260
-
261
- }
262
-
263
-
264
- private static function createAuthHeader($customerKey, $apiKey) {
265
- $currentTimestampInMillis = round(microtime(true) * 1000);
266
- $currentTimestampInMillis = number_format($currentTimestampInMillis, 0, '', '');
267
-
268
- $stringToHash = $customerKey . $currentTimestampInMillis . $apiKey;
269
- $authHeader = hash("sha512", $stringToHash);
270
-
271
- $header = array (
272
- "Content-Type: application/json",
273
- "Customer-Key: $customerKey",
274
- "Timestamp: $currentTimestampInMillis",
275
- "Authorization: $authHeader"
276
- );
277
- return $header;
278
- }
279
-
280
-
281
- private static function callAPI($url, $json_string, $headers = array("Content-Type: application/json")) {
282
- //For testing (0, false)
283
- //For Production (2, true)
284
-
285
- $sslhost=2;
286
- $sslpeer=false;
287
-
288
- $ch = curl_init($url);
289
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
290
- curl_setopt($ch, CURLOPT_ENCODING, "");
291
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
292
- curl_setopt($ch, CURLOPT_AUTOREFERER, true);
293
- curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, $sslhost );
294
-
295
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, $sslpeer );
296
- curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
297
- if(!is_null($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
298
- curl_setopt($ch, CURLOPT_POST, true);
299
- curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string);
300
- $content = curl_exec($ch);
301
-
302
- if (curl_errno($ch)) {
303
- echo 'Request Error:' . curl_error($ch);
304
- exit();
305
- }
306
-
307
- curl_close($ch);
308
- return $content;
309
- }
310
- }
1
+ <?php
2
+
3
+ class MocURL
4
+ {
5
+
6
+ public static function create_customer($email, $company, $password, $phone = '', $first_name = '', $last_name = '')
7
+ {
8
+ $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/add';
9
+ $fields = array (
10
+ 'companyName' => $company,
11
+ 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin',
12
+ 'productInterest' => 'API_2FA',
13
+ 'firstname' => $first_name,
14
+ 'lastname' => $last_name,
15
+ 'email' => $email,
16
+ 'phone' => $phone,
17
+ 'password' => $password
18
+ );
19
+ $json = json_encode($fields);
20
+ $response = self::callAPI($url, $json);
21
+ return $response;
22
+ }
23
+
24
+ public static function get_customer_key($email, $password)
25
+ {
26
+ $url = MoWpnsConstants::HOST_NAME. "/moas/rest/customer/key";
27
+ $fields = array (
28
+ 'email' => $email,
29
+ 'password' => $password
30
+ );
31
+ $json = json_encode($fields);
32
+ $response = self::callAPI($url, $json);
33
+
34
+ return $response;
35
+ }
36
+
37
+ function submit_contact_us( $q_email, $q_phone, $query, $call_setup=false)
38
+ {
39
+ $current_user = wp_get_current_user();
40
+ $url = MoWpnsConstants::HOST_NAME . "/moas/rest/customer/contact-us";
41
+
42
+ $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
43
+ $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
44
+ $onprem = MO2F_IS_ONPREM ?'O':'C';
45
+
46
+ $customer_feature = "";
47
+
48
+ if ( $is_ec_with_1_user ) {
49
+ $customer_feature = "V1";
50
+ }else if ( $is_nc_with_1_user ) {
51
+ $customer_feature = "V3";
52
+ }
53
+ global $moWpnsUtility;
54
+ if($call_setup)
55
+ $query = '[Call Request - WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
56
+ else
57
+ $query = '[WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.'- Ticket Id:'.$moWpnsUtility->getFeatureStatus().']: ' . $query;
58
+
59
+ $fields = array(
60
+ 'firstName' => $current_user->user_firstname,
61
+ 'lastName' => $current_user->user_lastname,
62
+ 'company' => $_SERVER['SERVER_NAME'],
63
+ 'email' => $q_email,
64
+ 'ccEmail' => '2fasupport@xecurify.com',
65
+ 'phone' => $q_phone,
66
+ 'query' => $query
67
+ );
68
+ $field_string = json_encode( $fields );
69
+ $response = self::callAPI($url, $field_string);
70
+
71
+ return true;
72
+ }
73
+
74
+ function lookupIP($ip)
75
+ {
76
+ $url = MoWpnsConstants::HOST_NAME. "/moas/rest/security/iplookup";
77
+ $fields = array (
78
+ 'ip' => $ip
79
+ );
80
+ $json = json_encode($fields);
81
+ $response = self::callAPI($url, $json);
82
+ return $response;
83
+ }
84
+ //CHECK
85
+ function send_otp_token($auth_type, $phone, $email)
86
+ {
87
+
88
+ $url = MoWpnsConstants::HOST_NAME . '/moas/api/auth/challenge';
89
+ $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
90
+ $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
91
+
92
+ $fields = array(
93
+ 'customerKey' => $customerKey,
94
+ 'email' => $email,
95
+ 'phone' => $phone,
96
+ 'authType' => $auth_type,
97
+ 'transactionName' => 'miniOrange 2-Factor'
98
+ );
99
+ $json = json_encode($fields);
100
+ $authHeader = $this->createAuthHeader($customerKey,$apiKey);
101
+ $response = self::callAPI($url, $json, $authHeader);
102
+ return $response;
103
+ }
104
+
105
+ function validate_recaptcha($ip,$response)
106
+ {
107
+ $url = MoWpnsConstants::RECAPTCHA_VERIFY;
108
+ $json = "";
109
+ $fields = array(
110
+ 'response' => $response,
111
+ 'secret' => get_option('mo_wpns_recaptcha_secret_key'),
112
+ 'remoteip' => $ip
113
+ );
114
+ foreach($fields as $key=>$value) { $json .= $key.'='.$value.'&'; }
115
+ rtrim($json, '&');
116
+ $response = self::callAPI($url, $json, null);
117
+ return $response;
118
+ }
119
+
120
+ function get_Captcha_v3($Secretkey)
121
+ {
122
+
123
+ $json = "";
124
+ $url = "https://www.google.com/recaptcha/api/siteverify";
125
+ $fields = array(
126
+ 'response' => $Secretkey,
127
+ 'secret' => get_option('mo_wpns_recaptcha_secret_key_v3'),
128
+ 'remoteip' => $_SERVER['REMOTE_ADDR']
129
+ );
130
+ foreach($fields as $key=>$value) { $json .= $key.'='.$value.'&'; }
131
+ json_encode($json);
132
+ $result = $this->callAPI($url, $json, null);
133
+
134
+ return $result;
135
+ }
136
+
137
+ function validate_otp_token($transactionId,$otpToken)
138
+ {
139
+ $url = MoWpnsConstants::HOST_NAME . '/moas/api/auth/validate';
140
+ $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
141
+ $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
142
+
143
+ $fields = array(
144
+ 'txId' => $transactionId,
145
+ 'token' => $otpToken,
146
+ );
147
+
148
+ $json = json_encode($fields);
149
+ $authHeader = $this->createAuthHeader($customerKey,$apiKey);
150
+ $response = self::callAPI($url, $json, $authHeader);
151
+ return $response;
152
+ }
153
+
154
+ function check_customer($email)
155
+ {
156
+ $url = MoWpnsConstants::HOST_NAME . "/moas/rest/customer/check-if-exists";
157
+ $fields = array(
158
+ 'email' => $email,
159
+ );
160
+ $json = json_encode($fields);
161
+ $response = self::callAPI($url, $json);
162
+ return $response;
163
+ }
164
+
165
+ function mo_wpns_forgot_password()
166
+ {
167
+
168
+ $url = MoWpnsConstants::HOST_NAME . '/moas/rest/customer/password-reset';
169
+ $email = get_option('mo2f_email');
170
+ $customerKey = get_option('mo2f_customerKey');
171
+ $apiKey = get_option('mo2f_api_key');
172
+
173
+ $fields = array(
174
+ 'email' => $email
175
+ );
176
+
177
+ $json = json_encode($fields);
178
+ $authHeader = $this->createAuthHeader($customerKey,$apiKey);
179
+ $response = self::callAPI($url, $json, $authHeader);
180
+ return $response;
181
+ }
182
+
183
+ function send_notification($toEmail,$subject,$content,$fromEmail,$fromName,$toName)
184
+ {
185
+ $headers = "MIME-Version: 1.0" . "\r\n";
186
+ $headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
187
+
188
+ $headers .= 'From: '.$fromName.'<'.$fromEmail.'>' . "\r\n";
189
+
190
+ mail($toEmail,$subject,$content,$headers);
191
+
192
+ return json_encode(array("status"=>'SUCCESS','statusMessage'=>'SUCCESS'));
193
+ }
194
+
195
+ //added for feedback
196
+
197
+ function send_email_alert($email,$phone,$message,$feedback_option){
198
+ global $moWpnsUtility;
199
+ global $user;
200
+ $url = MoWpnsConstants::HOST_NAME . '/moas/api/notify/send';
201
+ $customerKey = MoWpnsConstants::DEFAULT_CUSTOMER_KEY;
202
+ $apiKey = MoWpnsConstants::DEFAULT_API_KEY;
203
+ $fromEmail = 'no-reply@xecurify.com';
204
+ $Di = get_site_option('No_of_days_active_work');
205
+ $Di = intval($Di);
206
+ if ($feedback_option == 'mo_wpns_skip_feedback')
207
+ {
208
+ $subject = "Deactivate [Feedback Skipped]: WordPress miniOrange 2-Factor Plugin :" .$Di ;
209
+
210
+ }
211
+ elseif ($feedback_option == 'mo_wpns_feedback' )
212
+ {
213
+
214
+ $subject = "Feedback: WordPress miniOrange 2-Factor Plugin - ". $email.' : ' .$Di;
215
+ }
216
+ elseif ($feedback_option == 'mo_wpns_rating' )
217
+ {
218
+ $subject = "Feedback: WordPress miniOrange 2-Factor Plugin - ". $email.' : '.$Di;
219
+ }
220
+
221
+
222
+ $user = wp_get_current_user();
223
+
224
+ $is_nc_with_1_user = MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option') && MoWpnsUtility::get_mo2f_db_option('mo2f_is_NNC', 'get_option');
225
+ $is_ec_with_1_user = ! MoWpnsUtility::get_mo2f_db_option('mo2f_is_NC', 'get_option');
226
+ $onprem = MO2F_IS_ONPREM ? 'O':'C';
227
+
228
+ $customer_feature = "";
229
+
230
+
231
+ if ( $is_ec_with_1_user ) {
232
+ $customer_feature = "V1";
233
+ }else if ( $is_nc_with_1_user ) {
234
+ $customer_feature = "V3";
235
+ }
236
+
237
+ $query = '[WordPress 2 Factor Authentication Plugin: ' .$onprem.$customer_feature . ' - V '.MO2F_VERSION.']: ' . $message;
238
+
239
+
240
+ $content='<div >Hello, <br><br>Ticket ID:'.$moWpnsUtility->getFeatureStatus().'<br><br>First Name :'.$user->user_firstname.'<br><br>Last Name :'.$user->user_lastname.' <br><br>Company :<a href="'.$_SERVER['SERVER_NAME'].'" target="_blank" >'.$_SERVER['SERVER_NAME'].'</a><br><br>Phone Number :'.$phone.'<br><br>Email :<a href="mailto:'.$email.'" target="_blank">'.$email.'</a><br><br>Query :'.$query.'</div>';
241
+
242
+
243
+ $fields = array(
244
+ 'customerKey' => $customerKey,
245
+ 'sendEmail' => true,
246
+ 'email' => array(
247
+ 'customerKey' => $customerKey,
248
+ 'fromEmail' => $fromEmail,
249
+ 'fromName' => 'Xecurify',
250
+ 'toEmail' => '2fasupport@xecurify.com',
251
+ 'toName' => '2fasupport@xecurify.com',
252
+ 'subject' => $subject,
253
+ 'content' => $content
254
+ ),
255
+ );
256
+ $field_string = json_encode($fields);
257
+ $authHeader = $this->createAuthHeader($customerKey,$apiKey);
258
+ $response = self::callAPI($url, $field_string,$authHeader);
259
+ return $response;
260
+
261
+ }
262
+
263
+
264
+ private static function createAuthHeader($customerKey, $apiKey) {
265
+ $currentTimestampInMillis = round(microtime(true) * 1000);
266
+ $currentTimestampInMillis = number_format($currentTimestampInMillis, 0, '', '');
267
+
268
+ $stringToHash = $customerKey . $currentTimestampInMillis . $apiKey;
269
+ $authHeader = hash("sha512", $stringToHash);
270
+
271
+ $header = array (
272
+ "Content-Type: application/json",
273
+ "Customer-Key: $customerKey",
274
+ "Timestamp: $currentTimestampInMillis",
275
+ "Authorization: $authHeader"
276
+ );
277
+ return $header;
278
+ }
279
+
280
+
281
+ private static function callAPI($url, $json_string, $headers = array("Content-Type: application/json")) {
282
+ //For testing (0, false)
283
+ //For Production (2, true)
284
+
285
+ $sslhost=2;
286
+ $sslpeer=false;
287
+
288
+ $ch = curl_init($url);
289
+ curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
290
+ curl_setopt($ch, CURLOPT_ENCODING, "");
291
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
292
+ curl_setopt($ch, CURLOPT_AUTOREFERER, true);
293
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, $sslhost );
294
+
295
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, $sslpeer );
296
+ curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
297
+ if(!is_null($headers)) curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
298
+ curl_setopt($ch, CURLOPT_POST, true);
299
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string);
300
+ $content = curl_exec($ch);
301
+
302
+ if (curl_errno($ch)) {
303
+ echo 'Request Error:' . curl_error($ch);
304
+ exit();
305
+ }
306
+
307
+ curl_close($ch);
308
+ return $content;
309
+ }
310
+ }
helper/pluginUtility.php CHANGED
@@ -1,513 +1,513 @@
1
- <?php
2
- /** Copyright (C) 2015 miniOrange
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU General Public License as published by
6
- the Free Software Foundation, either version 3 of the License, or
7
- (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU General Public License for more details.
13
-
14
- You should have received a copy of the GNU General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>
16
- * @package miniOrange OAuth
17
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
18
- *
19
- **/
20
-
21
-
22
- // need to have different classes here for each ipblocking, whitelisting, htaccess and transaction related functions
23
- class MoWpnsHandler
24
- {
25
-
26
- function mo_wpns_is_ip_blocked($ipAddress)
27
- {
28
- global $wpnsDbQueries;
29
- if(empty($ipAddress))
30
- return false;
31
-
32
- $user_count = $wpnsDbQueries->get_ip_blocked_count($ipAddress);
33
-
34
- if($user_count)
35
- $user_count = intval($user_count);
36
- if($user_count>0)
37
- return true;
38
-
39
- return false;
40
- }
41
- function get_blocked_attacks_count($attackName)
42
- {
43
- global $wpnsDbQueries;
44
- $attackCount = $wpnsDbQueries->get_blocked_attack_count($attackName);
45
- if($attackCount)
46
- $attackCount = intval($attackCount);
47
- return $attackCount;
48
- }
49
- function get_blocked_countries()
50
- {
51
- $countrycodes = get_option('mo_wpns_countrycodes');
52
- $countries = explode(';', $countrycodes);
53
- return sizeof($countries)-1;
54
- }
55
- function get_blocked_ip_waf()
56
- {
57
- global $wpnsDbQueries;
58
- $ip_count = $wpnsDbQueries->get_total_blocked_ips_waf();
59
- if($ip_count)
60
- $ip_count = intval($ip_count);
61
-
62
- return $ip_count;
63
- }
64
- function get_manual_blocked_ip_count()
65
- {
66
- global $wpnsDbQueries;
67
- $ip_count = $wpnsDbQueries->get_total_manual_blocked_ips();
68
- if($ip_count)
69
- $ip_count = intval($ip_count);
70
-
71
- return $ip_count;
72
- }
73
- function get_blocked_attacks()
74
- {
75
- global $wpnsDbQueries;
76
- return $wpnsDbQueries->get_blocked_attack_list('wpns_attack_logs');
77
- }
78
- function get_blocked_ips()
79
- {
80
- global $wpnsDbQueries;
81
- return $wpnsDbQueries->get_blocked_ip_list();
82
- }
83
- function get_blocked_sqli()
84
- {
85
- global $wpnsDbQueries;
86
- return $wpnsDbQueries->get_blocked_sqli_list();
87
- }
88
- function get_blocked_rfi()
89
- {
90
- global $wpnsDbQueries;
91
- return $wpnsDbQueries->get_blocked_rfi_list();
92
- }
93
- function get_blocked_lfi()
94
- {
95
- global $wpnsDbQueries;
96
- return $wpnsDbQueries->get_blocked_lfi_list();
97
- }
98
- function get_blocked_rce()
99
- {
100
- global $wpnsDbQueries;
101
- return $wpnsDbQueries->get_blocked_rce_list();
102
- }
103
- function get_blocked_xss()
104
- {
105
- global $wpnsDbQueries;
106
- return $wpnsDbQueries->get_blocked_xss_list();
107
- }
108
-
109
- function mo_wpns_block_ip($ipAddress, $reason, $permenently)
110
- {
111
- global $wpnsDbQueries;
112
- if(empty($ipAddress))
113
- return;
114
- if($this->mo_wpns_is_ip_blocked($ipAddress))
115
- return;
116
- $blocked_for_time = null;
117
- if(!$permenently && get_option('mo2f_time_of_blocking_type'))
118
- {
119
- $blocking_type = get_option('mo2f_time_of_blocking_type');
120
- $time_of_blocking_val = 3;
121
- if(get_option('mo2f_time_of_blocking_val'))
122
- $time_of_blocking_val = get_option('mo2f_time_of_blocking_val');
123
- if($blocking_type=="months")
124
- $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 30 * 24 * 60 * 60;
125
- else if($blocking_type=="days")
126
- $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 24 * 60 * 60;
127
- else if($blocking_type=="hours")
128
- $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 60 * 60;
129
- }
130
-
131
- if(get_option('mo_wpns_enable_htaccess_blocking'))
132
- {
133
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
134
- $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
135
- fwrite($f, "\ndeny from ".trim($ipAddress));
136
- fclose($f);
137
- }
138
-
139
- $wpnsDbQueries->insert_blocked_ip($ipAddress, $reason,$blocked_for_time);
140
-
141
- //send notification
142
- global $moWpnsUtility;
143
- if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option'))
144
- $moWpnsUtility->sendIpBlockedNotification($ipAddress,MoWpnsConstants::LOGIN_ATTEMPTS_EXCEEDED);
145
-
146
- }
147
-
148
- function unblock_ip_entry($entryid)
149
- {
150
- global $wpnsDbQueries;
151
- $myrows = $wpnsDbQueries->get_blocked_ip($entryid);
152
- if(count($myrows)>0)
153
- if(get_option('mo_wpns_enable_htaccess_blocking'))
154
- {
155
- $ip_address = $myrows[0]->ip_address;
156
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
157
- $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
158
- $contents = file_get_contents($hpath);
159
- if (strpos($contents, "\ndeny from ".trim($ip_address)) !== false)
160
- {
161
- $contents = str_replace("\ndeny from ".trim($ip_address), '', $contents);
162
- file_put_contents($hpath, $contents);
163
- }
164
- }
165
-
166
- $wpnsDbQueries->delete_blocked_ip($entryid);
167
- }
168
-
169
- function remove_htaccess_ips()
170
- {
171
- global $wpnsDbQueries;
172
- $myrows = $wpnsDbQueries->get_blocked_ip_list();
173
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
174
- $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
175
- $contents = file_get_contents($hpath);
176
- $changed = 0;
177
- foreach($myrows as $row)
178
- {
179
- $ip_address = $row->ip_address;
180
- if (strpos($contents, "\ndeny from ".trim($ip_address)) !== false)
181
- {
182
- $contents = str_replace("\ndeny from ".trim($ip_address), '', $contents);
183
- $changed = 1;
184
- }
185
- }
186
- if($changed==1)
187
- file_put_contents($hpath, $contents);
188
- }
189
-
190
- function add_htaccess_ips()
191
- {
192
- global $wpnsDbQueries;
193
- $myrows = $wpnsDbQueries->get_blocked_ip_list();
194
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
195
- $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
196
- $contents = file_get_contents($hpath);
197
- $f = fopen($hpath, "a");
198
- foreach($myrows as $row)
199
- {
200
- $ip_address = $row->ip_address;
201
- if (strpos($contents, "\ndeny from ".trim($ip_address)) === false)
202
- fwrite($f, "\ndeny from ".trim($ip_address));
203
- }
204
- fclose($f);
205
- }
206
-
207
-
208
- function is_whitelisted($ipAddress)
209
- {
210
- global $wpnsDbQueries;
211
- $count = $wpnsDbQueries->get_whitelisted_ip_count($ipAddress);
212
-
213
- if(empty($ipAddress))
214
- return false;
215
- if($count)
216
- $count = intval($count);
217
-
218
- if($count>0)
219
- return true;
220
- return false;
221
- }
222
-
223
- function whitelist_ip($ipAddress)
224
- {
225
- global $wpnsDbQueries;
226
- if(get_option('mo_wpns_enable_htaccess_blocking'))
227
- {
228
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
229
- $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
230
- $contents = file_get_contents($hpath);
231
- if (strpos($contents, "\ndeny from ".trim($ipAddress)) !== false)
232
- {
233
- $contents = str_replace("\ndeny from ".trim($ipAddress), '', $contents);
234
- file_put_contents($hpath, $contents);
235
- }
236
- }
237
-
238
- if(empty($ipAddress))
239
- return;
240
- if($this->is_whitelisted($ipAddress))
241
- return;
242
-
243
- $wpnsDbQueries->insert_whitelisted_ip($ipAddress);
244
- }
245
-
246
- function update_htaccess_configuration()
247
- {
248
- $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
249
- $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
250
- if(!file_exists($htaccesspath)){
251
- $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
252
- fwrite($f, "# BEGIN WordPress\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteBase /\r\nRewriteRule ^index\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . /index.php [L]\r\n</IfModule>\r\n# END WordPress");
253
- fclose($f);
254
- }
255
- $this->change_wp_config_protection($base);
256
- $this->change_content_protection($base);
257
- $this->mo2f_change_htaccess_file($htaccesspath);
258
- }
259
-
260
- function mo2f_change_htaccess_file($htaccesspath){
261
- $contents = file_get_contents($htaccesspath);
262
- if (strpos($contents, "\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>") !== false) {
263
- if(!get_option('mo2f_htaccess_file')){
264
- $contents = str_replace("\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>", '', $contents);
265
- file_put_contents($htaccesspath, $contents);
266
- }
267
- } else {
268
- if(get_option('mo2f_htaccess_file')){
269
- $f = fopen($htaccesspath, "a");
270
- fwrite($f, "\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>");
271
- fclose($f);
272
- }
273
- }
274
- }
275
-
276
- function change_wp_config_protection($base)
277
- {
278
- $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
279
- $contents = file_get_contents($htaccesspath);
280
- if (strpos($contents, "\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>") !== false)
281
- {
282
- if(!get_option('mo2f_protect_wp_config'))
283
- {
284
- $contents = str_replace("\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>", '', $contents);
285
- file_put_contents($htaccesspath, $contents);
286
- }
287
- }
288
- else
289
- {
290
- if(get_option('mo2f_protect_wp_config'))
291
- {
292
- $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
293
- fwrite($f, "\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>");
294
- fclose($f);
295
- }
296
- }
297
- }
298
-
299
- function change_content_protection($base)
300
- {
301
- $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
302
- $contents = file_get_contents($htaccesspath);
303
- if (strpos($contents, "\nOptions All -Indexes") !== false)
304
- {
305
- if(!get_option('mo2f_prevent_directory_browsing'))
306
- {
307
- $contents = str_replace("\nOptions All -Indexes", '', $contents);
308
- file_put_contents($htaccesspath, $contents);
309
- }
310
- }
311
- else
312
- {
313
- if(get_option('mo2f_prevent_directory_browsing'))
314
- {
315
- $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
316
- fwrite($f, "\nOptions All -Indexes");
317
- fclose($f);
318
- }
319
- }
320
- }
321
-
322
- function remove_whitelist_entry($entryid)
323
- {
324
- global $wpnsDbQueries;
325
- $wpnsDbQueries->delete_whitelisted_ip($entryid);
326
- }
327
-
328
- function get_whitelisted_ips()
329
- {
330
- global $wpnsDbQueries;
331
- return $wpnsDbQueries->get_whitelisted_ips_list();
332
- }
333
-
334
- function is_email_sent_to_user($username, $ipAddress)
335
- {
336
- global $wpnsDbQueries;
337
- if(empty($ipAddress))
338
- return false;
339
- $sent_count = $wpnsDbQueries->get_email_audit_count($ipAddress,$username);
340
- if($sent_count)
341
- $sent_count = intval($sent_count);
342
- if($sent_count>0)
343
- return true;
344
- return false;
345
- }
346
-
347
- function audit_email_notification_sent_to_user($username, $ipAddress, $reason)
348
- {
349
- if(empty($ipAddress) || empty($username))
350
- return;
351
- global $wpnsDbQueries;
352
- $wpnsDbQueries->insert_email_audit($ipAddress,$username,$reason);
353
- }
354
-
355
- function add_transactions($ipAddress, $username, $type, $status, $url=null)
356
- {
357
- global $wpnsDbQueries;
358
- $wpnsDbQueries->insert_transaction_audit($ipAddress, $username, $type, $status, $url);
359
- }
360
-
361
- function get_login_transaction_report()
362
- {
363
- global $wpnsDbQueries;
364
- return $wpnsDbQueries->get_login_transaction_report();
365
- }
366
-
367
- function get_error_transaction_report()
368
- {
369
- global $wpnsDbQueries;
370
- return $wpnsDbQueries->get_error_transaction_report();
371
- }
372
-
373
-
374
- function get_all_transactions()
375
- {
376
- global $wpnsDbQueries;
377
- return $wpnsDbQueries->get_transasction_list();
378
- }
379
-
380
- function move_failed_transactions_to_past_failed($ipAddress)
381
- {
382
- global $wpnsDbQueries;
383
- $wpnsDbQueries->update_transaction_table(array('status'=>MoWpnsConstants::FAILED,'ip_address'=>$ipAddress),
384
- array('status'=>MoWpnsConstants::PAST_FAILED));
385
- }
386
-
387
- function remove_failed_transactions($ipAddress)
388
- {
389
- global $wpnsDbQueries;
390
- $wpnsDbQueries->delete_transaction($ipAddress);
391
- }
392
-
393
- function get_failed_attempts_count($ipAddress)
394
- {
395
- global $wpnsDbQueries;
396
- $count = $wpnsDbQueries->get_failed_transaction_count($ipAddress);
397
- if($count)
398
- {
399
- $count = intval($count);
400
- return $count;
401
- }
402
- return 0;
403
- }
404
-
405
- function is_ip_blocked_in_anyway($userIp)
406
- {
407
- $isBlocked = false;
408
- if($this->mo_wpns_is_ip_blocked($userIp))
409
- $isBlocked = true;
410
- else if($this->is_ip_range_blocked($userIp))
411
- $isBlocked = true;
412
- else if($this->is_browser_blocked())
413
- $isBlocked = true;
414
- else if($this->is_country_blocked($userIp))
415
- $isBlocked = true;
416
- else if($this->is_referer_blocked())
417
- $isBlocked = true;
418
-
419
- return $isBlocked;
420
- }
421
-
422
- function is_ip_range_blocked($userIp)
423
- {
424
- if(empty($userIp))
425
- return false;
426
- $range_count = 0;
427
- if(is_numeric(get_option('mo_wpns_iprange_count')))
428
- $range_count = intval(get_option('mo_wpns_iprange_count'));
429
- for($i = 1 ; $i <= $range_count ; $i++){
430
- $blockedrange = get_option('mo_wpns_iprange_range_'.$i);
431
- $rangearray = explode("-",$blockedrange);
432
- if(sizeof($rangearray)==2){
433
- $lowip = ip2long(trim($rangearray[0]));
434
- $highip = ip2long(trim($rangearray[1]));
435
- if(ip2long($userIp)>=$lowip && ip2long($userIp)<=$highip){
436
- $mo_wpns_config = new MoWpnsHandler();
437
- $mo_wpns_config->mo_wpns_block_ip($userIp, MoWpnsConstants::IP_RANGE_BLOCKING, true);
438
- return true;
439
- }
440
- }
441
- }
442
- return false;
443
- }
444
-
445
-
446
- function is_browser_blocked()
447
- {
448
- global $moWpnsUtility;
449
- if(get_option( 'mo_wpns_enable_user_agent_blocking'))
450
- {
451
- $current_browser = $moWpnsUtility->getCurrentBrowser();
452
- if(get_option('mo_wpns_block_chrome') && $current_browser=='chrome')
453
- return true;
454
- else if(get_option('mo_wpns_block_firefox') && $current_browser=='firefox')
455
- return true;
456
- else if(get_option('mo_wpns_block_ie') && $current_browser=='ie')
457
- return true;
458
- else if(get_option('mo_wpns_block_opera') && $current_browser=='opera')
459
- return true;
460
- else if(get_option('mo_wpns_block_safari')&& $current_browser=='safari')
461
- return true;
462
- else if(get_option('mo_wpns_block_edge') && $current_browser=='edge')
463
- return true;
464
- }
465
- return false;
466
- }
467
-
468
-
469
- function is_country_blocked($userIp)
470
- {
471
-
472
- $countrycodes = get_option('mo_wpns_countrycodes');
473
-
474
- if($countrycodes && !empty($countrycodes)){
475
- $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$userIp));
476
- if($ip_data && $ip_data->geoplugin_countryName != null){
477
- $country_code = $ip_data->geoplugin_countryCode;
478
- if(!empty($country_code)){
479
- $countrycodes = get_option('mo_wpns_countrycodes');
480
- $codes = explode(";", $countrycodes);
481
- foreach($codes as $code){
482
- if(!empty($code) && strcasecmp($code,$country_code)==0)
483
- return true;
484
- }
485
- }
486
- }
487
- }
488
- return false;
489
- }
490
-
491
- function lockedOutlink(){
492
- if(MO2F_IS_ONPREM){
493
- return MoWpnsConstants::OnPremiseLockedOut;
494
- }else{
495
- return MoWpnsConstants::CloudLockedOut;
496
- }
497
- }
498
-
499
- function is_referer_blocked()
500
- {
501
- if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && get_option('mo_wpns_referrers')){
502
- $userreferer = $_SERVER['HTTP_REFERER'];
503
- $referrers = explode(";",get_option('mo_wpns_referrers'));
504
- foreach($referrers as $referrer){
505
- if(!empty($referrer) && strpos(strtolower($userreferer), strtolower($referrer)) !== false){
506
- return true;
507
- }
508
- }
509
- }
510
- return false;
511
- }
512
-
513
  } ?>
1
+ <?php
2
+ /** Copyright (C) 2015 miniOrange
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU General Public License as published by
6
+ the Free Software Foundation, either version 3 of the License, or
7
+ (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU General Public License for more details.
13
+
14
+ You should have received a copy of the GNU General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>
16
+ * @package miniOrange OAuth
17
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
18
+ *
19
+ **/
20
+
21
+
22
+ // need to have different classes here for each ipblocking, whitelisting, htaccess and transaction related functions
23
+ class MoWpnsHandler
24
+ {
25
+
26
+ function mo_wpns_is_ip_blocked($ipAddress)
27
+ {
28
+ global $wpnsDbQueries;
29
+ if(empty($ipAddress))
30
+ return false;
31
+
32
+ $user_count = $wpnsDbQueries->get_ip_blocked_count($ipAddress);
33
+
34
+ if($user_count)
35
+ $user_count = intval($user_count);
36
+ if($user_count>0)
37
+ return true;
38
+
39
+ return false;
40
+ }
41
+ function get_blocked_attacks_count($attackName)
42
+ {
43
+ global $wpnsDbQueries;
44
+ $attackCount = $wpnsDbQueries->get_blocked_attack_count($attackName);
45
+ if($attackCount)
46
+ $attackCount = intval($attackCount);
47
+ return $attackCount;
48
+ }
49
+ function get_blocked_countries()
50
+ {
51
+ $countrycodes = get_option('mo_wpns_countrycodes');
52
+ $countries = explode(';', $countrycodes);
53
+ return sizeof($countries)-1;
54
+ }
55
+ function get_blocked_ip_waf()
56
+ {
57
+ global $wpnsDbQueries;
58
+ $ip_count = $wpnsDbQueries->get_total_blocked_ips_waf();
59
+ if($ip_count)
60
+ $ip_count = intval($ip_count);
61
+
62
+ return $ip_count;
63
+ }
64
+ function get_manual_blocked_ip_count()
65
+ {
66
+ global $wpnsDbQueries;
67
+ $ip_count = $wpnsDbQueries->get_total_manual_blocked_ips();
68
+ if($ip_count)
69
+ $ip_count = intval($ip_count);
70
+
71
+ return $ip_count;
72
+ }
73
+ function get_blocked_attacks()
74
+ {
75
+ global $wpnsDbQueries;
76
+ return $wpnsDbQueries->get_blocked_attack_list('wpns_attack_logs');
77
+ }
78
+ function get_blocked_ips()
79
+ {
80
+ global $wpnsDbQueries;
81
+ return $wpnsDbQueries->get_blocked_ip_list();
82
+ }
83
+ function get_blocked_sqli()
84
+ {
85
+ global $wpnsDbQueries;
86
+ return $wpnsDbQueries->get_blocked_sqli_list();
87
+ }
88
+ function get_blocked_rfi()
89
+ {
90
+ global $wpnsDbQueries;
91
+ return $wpnsDbQueries->get_blocked_rfi_list();
92
+ }
93
+ function get_blocked_lfi()
94
+ {
95
+ global $wpnsDbQueries;
96
+ return $wpnsDbQueries->get_blocked_lfi_list();
97
+ }
98
+ function get_blocked_rce()
99
+ {
100
+ global $wpnsDbQueries;
101
+ return $wpnsDbQueries->get_blocked_rce_list();
102
+ }
103
+ function get_blocked_xss()
104
+ {
105
+ global $wpnsDbQueries;
106
+ return $wpnsDbQueries->get_blocked_xss_list();
107
+ }
108
+
109
+ function mo_wpns_block_ip($ipAddress, $reason, $permenently)
110
+ {
111
+ global $wpnsDbQueries;
112
+ if(empty($ipAddress))
113
+ return;
114
+ if($this->mo_wpns_is_ip_blocked($ipAddress))
115
+ return;
116
+ $blocked_for_time = null;
117
+ if(!$permenently && get_option('mo2f_time_of_blocking_type'))
118
+ {
119
+ $blocking_type = get_option('mo2f_time_of_blocking_type');
120
+ $time_of_blocking_val = 3;
121
+ if(get_option('mo2f_time_of_blocking_val'))
122
+ $time_of_blocking_val = get_option('mo2f_time_of_blocking_val');
123
+ if($blocking_type=="months")
124
+ $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 30 * 24 * 60 * 60;
125
+ else if($blocking_type=="days")
126
+ $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 24 * 60 * 60;
127
+ else if($blocking_type=="hours")
128
+ $blocked_for_time = current_time( 'timestamp' )+$time_of_blocking_val * 60 * 60;
129
+ }
130
+
131
+ if(get_option('mo_wpns_enable_htaccess_blocking'))
132
+ {
133
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
134
+ $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
135
+ fwrite($f, "\ndeny from ".trim($ipAddress));
136
+ fclose($f);
137
+ }
138
+
139
+ $wpnsDbQueries->insert_blocked_ip($ipAddress, $reason,$blocked_for_time);
140
+
141
+ //send notification
142
+ global $moWpnsUtility;
143
+ if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_enable_ip_blocked_email_to_admin', 'get_option'))
144
+ $moWpnsUtility->sendIpBlockedNotification($ipAddress,MoWpnsConstants::LOGIN_ATTEMPTS_EXCEEDED);
145
+
146
+ }
147
+
148
+ function unblock_ip_entry($entryid)
149
+ {
150
+ global $wpnsDbQueries;
151
+ $myrows = $wpnsDbQueries->get_blocked_ip($entryid);
152
+ if(count($myrows)>0)
153
+ if(get_option('mo_wpns_enable_htaccess_blocking'))
154
+ {
155
+ $ip_address = $myrows[0]->ip_address;
156
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
157
+ $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
158
+ $contents = file_get_contents($hpath);
159
+ if (strpos($contents, "\ndeny from ".trim($ip_address)) !== false)
160
+ {
161
+ $contents = str_replace("\ndeny from ".trim($ip_address), '', $contents);
162
+ file_put_contents($hpath, $contents);
163
+ }
164
+ }
165
+
166
+ $wpnsDbQueries->delete_blocked_ip($entryid);
167
+ }
168
+
169
+ function remove_htaccess_ips()
170
+ {
171
+ global $wpnsDbQueries;
172
+ $myrows = $wpnsDbQueries->get_blocked_ip_list();
173
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
174
+ $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
175
+ $contents = file_get_contents($hpath);
176
+ $changed = 0;
177
+ foreach($myrows as $row)
178
+ {
179
+ $ip_address = $row->ip_address;
180
+ if (strpos($contents, "\ndeny from ".trim($ip_address)) !== false)
181
+ {
182
+ $contents = str_replace("\ndeny from ".trim($ip_address), '', $contents);
183
+ $changed = 1;
184
+ }
185
+ }
186
+ if($changed==1)
187
+ file_put_contents($hpath, $contents);
188
+ }
189
+
190
+ function add_htaccess_ips()
191
+ {
192
+ global $wpnsDbQueries;
193
+ $myrows = $wpnsDbQueries->get_blocked_ip_list();
194
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
195
+ $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
196
+ $contents = file_get_contents($hpath);
197
+ $f = fopen($hpath, "a");
198
+ foreach($myrows as $row)
199
+ {
200
+ $ip_address = $row->ip_address;
201
+ if (strpos($contents, "\ndeny from ".trim($ip_address)) === false)
202
+ fwrite($f, "\ndeny from ".trim($ip_address));
203
+ }
204
+ fclose($f);
205
+ }
206
+
207
+
208
+ function is_whitelisted($ipAddress)
209
+ {
210
+ global $wpnsDbQueries;
211
+ $count = $wpnsDbQueries->get_whitelisted_ip_count($ipAddress);
212
+
213
+ if(empty($ipAddress))
214
+ return false;
215
+ if($count)
216
+ $count = intval($count);
217
+
218
+ if($count>0)
219
+ return true;
220
+ return false;
221
+ }
222
+
223
+ function whitelist_ip($ipAddress)
224
+ {
225
+ global $wpnsDbQueries;
226
+ if(get_option('mo_wpns_enable_htaccess_blocking'))
227
+ {
228
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
229
+ $hpath = $base.DIRECTORY_SEPARATOR.".htaccess";
230
+ $contents = file_get_contents($hpath);
231
+ if (strpos($contents, "\ndeny from ".trim($ipAddress)) !== false)
232
+ {
233
+ $contents = str_replace("\ndeny from ".trim($ipAddress), '', $contents);
234
+ file_put_contents($hpath, $contents);
235
+ }
236
+ }
237
+
238
+ if(empty($ipAddress))
239
+ return;
240
+ if($this->is_whitelisted($ipAddress))
241
+ return;
242
+
243
+ $wpnsDbQueries->insert_whitelisted_ip($ipAddress);
244
+ }
245
+
246
+ function update_htaccess_configuration()
247
+ {
248
+ $base = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
249
+ $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
250
+ if(!file_exists($htaccesspath)){
251
+ $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
252
+ fwrite($f, "# BEGIN WordPress\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine On\r\nRewriteBase /\r\nRewriteRule ^index\.php$ - [L]\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule . /index.php [L]\r\n</IfModule>\r\n# END WordPress");
253
+ fclose($f);
254
+ }
255
+ $this->change_wp_config_protection($base);
256
+ $this->change_content_protection($base);
257
+ $this->mo2f_change_htaccess_file($htaccesspath);
258
+ }
259
+
260
+ function mo2f_change_htaccess_file($htaccesspath){
261
+ $contents = file_get_contents($htaccesspath);
262
+ if (strpos($contents, "\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>") !== false) {
263
+ if(!get_option('mo2f_htaccess_file')){
264
+ $contents = str_replace("\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>", '', $contents);
265
+ file_put_contents($htaccesspath, $contents);
266
+ }
267
+ } else {
268
+ if(get_option('mo2f_htaccess_file')){
269
+ $f = fopen($htaccesspath, "a");
270
+ fwrite($f, "\r\n<files ~ \"^.*\.([Hh][Tt][Aa])\">\r\norder allow,deny\r\ndeny from all\r\nsatisfy all\r\n</files>");
271
+ fclose($f);
272
+ }
273
+ }
274
+ }
275
+
276
+ function change_wp_config_protection($base)
277
+ {
278
+ $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
279
+ $contents = file_get_contents($htaccesspath);
280
+ if (strpos($contents, "\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>") !== false)
281
+ {
282
+ if(!get_option('mo2f_protect_wp_config'))
283
+ {
284
+ $contents = str_replace("\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>", '', $contents);
285
+ file_put_contents($htaccesspath, $contents);
286
+ }
287
+ }
288
+ else
289
+ {
290
+ if(get_option('mo2f_protect_wp_config'))
291
+ {
292
+ $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
293
+ fwrite($f, "\n<files wp-config.php>\norder allow,deny\ndeny from all\n</files>");
294
+ fclose($f);
295
+ }
296
+ }
297
+ }
298
+
299
+ function change_content_protection($base)
300
+ {
301
+ $htaccesspath = $base.DIRECTORY_SEPARATOR.".htaccess";
302
+ $contents = file_get_contents($htaccesspath);
303
+ if (strpos($contents, "\nOptions All -Indexes") !== false)
304
+ {
305
+ if(!get_option('mo2f_prevent_directory_browsing'))
306
+ {
307
+ $contents = str_replace("\nOptions All -Indexes", '', $contents);
308
+ file_put_contents($htaccesspath, $contents);
309
+ }
310
+ }
311
+ else
312
+ {
313
+ if(get_option('mo2f_prevent_directory_browsing'))
314
+ {
315
+ $f = fopen($base.DIRECTORY_SEPARATOR.".htaccess", "a");
316
+ fwrite($f, "\nOptions All -Indexes");
317
+ fclose($f);
318
+ }
319
+ }
320
+ }
321
+
322
+ function remove_whitelist_entry($entryid)
323
+ {
324
+ global $wpnsDbQueries;
325
+ $wpnsDbQueries->delete_whitelisted_ip($entryid);
326
+ }
327
+
328
+ function get_whitelisted_ips()
329
+ {
330
+ global $wpnsDbQueries;
331
+ return $wpnsDbQueries->get_whitelisted_ips_list();
332
+ }
333
+
334
+ function is_email_sent_to_user($username, $ipAddress)
335
+ {
336
+ global $wpnsDbQueries;
337
+ if(empty($ipAddress))
338
+ return false;
339
+ $sent_count = $wpnsDbQueries->get_email_audit_count($ipAddress,$username);
340
+ if($sent_count)
341
+ $sent_count = intval($sent_count);
342
+ if($sent_count>0)
343
+ return true;
344
+ return false;
345
+ }
346
+
347
+ function audit_email_notification_sent_to_user($username, $ipAddress, $reason)
348
+ {
349
+ if(empty($ipAddress) || empty($username))
350
+ return;
351
+ global $wpnsDbQueries;
352
+ $wpnsDbQueries->insert_email_audit($ipAddress,$username,$reason);
353
+ }
354
+
355
+ function add_transactions($ipAddress, $username, $type, $status, $url=null)
356
+ {
357
+ global $wpnsDbQueries;
358
+ $wpnsDbQueries->insert_transaction_audit($ipAddress, $username, $type, $status, $url);
359
+ }
360
+
361
+ function get_login_transaction_report()
362
+ {
363
+ global $wpnsDbQueries;
364
+ return $wpnsDbQueries->get_login_transaction_report();
365
+ }
366
+
367
+ function get_error_transaction_report()
368
+ {
369
+ global $wpnsDbQueries;
370
+ return $wpnsDbQueries->get_error_transaction_report();
371
+ }
372
+
373
+
374
+ function get_all_transactions()
375
+ {
376
+ global $wpnsDbQueries;
377
+ return $wpnsDbQueries->get_transasction_list();
378
+ }
379
+
380
+ function move_failed_transactions_to_past_failed($ipAddress)
381
+ {
382
+ global $wpnsDbQueries;
383
+ $wpnsDbQueries->update_transaction_table(array('status'=>MoWpnsConstants::FAILED,'ip_address'=>$ipAddress),
384
+ array('status'=>MoWpnsConstants::PAST_FAILED));
385
+ }
386
+
387
+ function remove_failed_transactions($ipAddress)
388
+ {
389
+ global $wpnsDbQueries;
390
+ $wpnsDbQueries->delete_transaction($ipAddress);
391
+ }
392
+
393
+ function get_failed_attempts_count($ipAddress)
394
+ {
395
+ global $wpnsDbQueries;
396
+ $count = $wpnsDbQueries->get_failed_transaction_count($ipAddress);
397
+ if($count)
398
+ {
399
+ $count = intval($count);
400
+ return $count;
401
+ }
402
+ return 0;
403
+ }
404
+
405
+ function is_ip_blocked_in_anyway($userIp)
406
+ {
407
+ $isBlocked = false;
408
+ if($this->mo_wpns_is_ip_blocked($userIp))
409
+ $isBlocked = true;
410
+ else if($this->is_ip_range_blocked($userIp))
411
+ $isBlocked = true;
412
+ else if($this->is_browser_blocked())
413
+ $isBlocked = true;
414
+ else if($this->is_country_blocked($userIp))
415
+ $isBlocked = true;
416
+ else if($this->is_referer_blocked())
417
+ $isBlocked = true;
418
+
419
+ return $isBlocked;
420
+ }
421
+
422
+ function is_ip_range_blocked($userIp)
423
+ {
424
+ if(empty($userIp))
425
+ return false;
426
+ $range_count = 0;
427
+ if(is_numeric(get_option('mo_wpns_iprange_count')))
428
+ $range_count = intval(get_option('mo_wpns_iprange_count'));
429
+ for($i = 1 ; $i <= $range_count ; $i++){
430
+ $blockedrange = get_option('mo_wpns_iprange_range_'.$i);
431
+ $rangearray = explode("-",$blockedrange);
432
+ if(sizeof($rangearray)==2){
433
+ $lowip = ip2long(trim($rangearray[0]));
434
+ $highip = ip2long(trim($rangearray[1]));
435
+ if(ip2long($userIp)>=$lowip && ip2long($userIp)<=$highip){
436
+ $mo_wpns_config = new MoWpnsHandler();
437
+ $mo_wpns_config->mo_wpns_block_ip($userIp, MoWpnsConstants::IP_RANGE_BLOCKING, true);
438
+ return true;
439
+ }
440
+ }
441
+ }
442
+ return false;
443
+ }
444
+
445
+
446
+ function is_browser_blocked()
447
+ {
448
+ global $moWpnsUtility;
449
+ if(get_option( 'mo_wpns_enable_user_agent_blocking'))
450
+ {
451
+ $current_browser = $moWpnsUtility->getCurrentBrowser();
452
+ if(get_option('mo_wpns_block_chrome') && $current_browser=='chrome')
453
+ return true;
454
+ else if(get_option('mo_wpns_block_firefox') && $current_browser=='firefox')
455
+ return true;
456
+ else if(get_option('mo_wpns_block_ie') && $current_browser=='ie')
457
+ return true;
458
+ else if(get_option('mo_wpns_block_opera') && $current_browser=='opera')
459
+ return true;
460
+ else if(get_option('mo_wpns_block_safari')&& $current_browser=='safari')
461
+ return true;
462
+ else if(get_option('mo_wpns_block_edge') && $current_browser=='edge')
463
+ return true;
464
+ }
465
+ return false;
466
+ }
467
+
468
+
469
+ function is_country_blocked($userIp)
470
+ {
471
+
472
+ $countrycodes = get_option('mo_wpns_countrycodes');
473
+
474
+ if($countrycodes && !empty($countrycodes)){
475
+ $ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=".$userIp));
476
+ if($ip_data && $ip_data->geoplugin_countryName != null){
477
+ $country_code = $ip_data->geoplugin_countryCode;
478
+ if(!empty($country_code)){
479
+ $countrycodes = get_option('mo_wpns_countrycodes');
480
+ $codes = explode(";", $countrycodes);
481
+ foreach($codes as $code){
482
+ if(!empty($code) && strcasecmp($code,$country_code)==0)
483
+ return true;
484
+ }
485
+ }
486
+ }
487
+ }
488
+ return false;
489
+ }
490
+
491
+ function lockedOutlink(){
492
+ if(MO2F_IS_ONPREM){
493
+ return MoWpnsConstants::OnPremiseLockedOut;
494
+ }else{
495
+ return MoWpnsConstants::CloudLockedOut;
496
+ }
497
+ }
498
+
499
+ function is_referer_blocked()
500
+ {
501
+ if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && get_option('mo_wpns_referrers')){
502
+ $userreferer = $_SERVER['HTTP_REFERER'];
503
+ $referrers = explode(";",get_option('mo_wpns_referrers'));
504
+ foreach($referrers as $referrer){
505
+ if(!empty($referrer) && strpos(strtolower($userreferer), strtolower($referrer)) !== false){
506
+ return true;
507
+ }
508
+ }
509
+ }
510
+ return false;
511
+ }
512
+
513
  } ?>
helper/plugins.php CHANGED
@@ -1,103 +1,103 @@
1
- <?php
2
-
3
- class FeaturePluginInterface
4
- {
5
- function __construct()
6
- {
7
- if ( ! function_exists( 'get_plugins' ) )
8
- require_once ABSPATH . 'wp-admin/includes/plugin.php';
9
- }
10
- }
11
-
12
-
13
- class TwoFAPlugin extends FeaturePluginInterface
14
- {
15
-
16
- function getstatus()
17
- {
18
- $all_plugins = get_plugins();
19
- $status = 'NOT_INSTALLED';
20
- if(isset($all_plugins[MoWpnsConstants::TWO_FACTOR_SETTINGS]))
21
- $status = is_plugin_active(MoWpnsConstants::TWO_FACTOR_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
22
- return $status;
23
- }
24
-
25
-
26
- function updatePluginConfiguration()
27
- {
28
- if(!get_option('mo_wpns_enable_2fa'))
29
- return;
30
-
31
- if(!get_option( 'mo2f_customerKey') || !get_option( 'mo2f_api_key') || !get_option( 'mo2f_customer_token') || !get_option( 'mo2f_app_secret'))
32
- {
33
- global $mo2f_dirName;
34
- $current_user = wp_get_current_user();
35
- $mo2fa = new Two_Factor_Setup();
36
- update_option( 'mo2f_email' ,get_option( 'mo2f_email'));
37
- update_option( 'mo2f_host_name' ,MoWpnsConstants::HOST_NAME);
38
- update_option( 'mo2f_phone' ,get_option( 'mo_wpns_admin_phone'));
39
- update_option( 'mo2f_customerKey' ,get_option( 'mo2f_customerKey'));
40
- update_option( 'mo2f_api_key' ,get_option( 'mo2f_api_key'));
41
- update_option( 'mo2f_customer_token' ,get_option( 'mo2f_customer_token'));
42
- update_option( 'mo2f_app_secret' ,get_option( 'mo2f_app_secret'));
43
- update_option( 'mo2f_miniorange_admin' ,$current_user->ID);
44
- update_option( 'mo2f_new_customer' ,true);
45
-
46
- update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
47
- update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
48
- update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option( 'mo2f_email'));
49
- update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
50
- $mo2fa->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
51
- update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
52
- }
53
- }
54
- }
55
-
56
-
57
- class OTPPlugin extends FeaturePluginInterface
58
- {
59
- function getstatus()
60
- {
61
- $all_plugins = get_plugins();
62
- $status = 'NOT_INSTALLED';
63
- if(isset($all_plugins[MoWpnsConstants::OTP_VERIFICATION_SETTINGS]))
64
- $status = is_plugin_active(MoWpnsConstants::OTP_VERIFICATION_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
65
- return $status;
66
- }
67
-
68
- function updatePluginConfiguration()
69
- {
70
- if(!get_option('mo_wpns_enable_advanced_user_verification'))
71
- return;
72
-
73
- if(!get_option( 'mo_customer_validation_admin_email') || !get_option( 'mo_customer_validation_admin_customer_key') || !get_option( 'mo_customer_validation_admin_api_key') || !get_option( 'mo_customer_validation_customer_token'))
74
- {
75
- update_option( 'mo_customer_validation_wp_default_enable' ,1);
76
- update_option( 'mo_customer_validation_admin_email' ,get_option( 'mo2f_email'));
77
- update_option( 'mo_customer_validation_admin_phone' ,get_option( 'mo_wpns_admin_phone'));
78
- update_option( 'mo_customer_validation_admin_customer_key' ,get_option( 'mo2f_customerKey') );
79
- update_option( 'mo_customer_validation_admin_api_key' ,get_option( 'mo2f_api_key') );
80
- update_option( 'mo_customer_validation_customer_token' ,get_option( 'mo2f_customer_token') );
81
- update_option( 'mo_customer_validation_admin_password' ,'');
82
- update_option( 'mo_customer_validation_message' ,'Registration complete!');
83
- update_option( 'mo_customer_validation_registration_status' ,'MO_CUSTOMER_VALIDATION_REGISTRATION_COMPLETE');
84
- update_option( 'mo_customer_email_transactions_remaining' ,10);
85
- update_option( 'mo_customer_phone_transactions_remaining' ,10);
86
- update_option( 'mo_otp_plugin_version' ,1.8);
87
- }
88
- }
89
-
90
- }
91
-
92
-
93
- class SocialPlugin extends FeaturePluginInterface
94
- {
95
- function getstatus()
96
- {
97
- $all_plugins = get_plugins();
98
- $status = 'NOT_INSTALLED';
99
- if(isset($all_plugins[MoWpnsConstants::SOCIAL_LOGIN_SETTINGS]))
100
- $status = is_plugin_active(MoWpnsConstants::SOCIAL_LOGIN_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
101
- return $status;
102
- }
103
  }
1
+ <?php
2
+
3
+ class FeaturePluginInterface
4
+ {
5
+ function __construct()
6
+ {
7
+ if ( ! function_exists( 'get_plugins' ) )
8
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
9
+ }
10
+ }
11
+
12
+
13
+ class TwoFAPlugin extends FeaturePluginInterface
14
+ {
15
+
16
+ function getstatus()
17
+ {
18
+ $all_plugins = get_plugins();
19
+ $status = 'NOT_INSTALLED';
20
+ if(isset($all_plugins[MoWpnsConstants::TWO_FACTOR_SETTINGS]))
21
+ $status = is_plugin_active(MoWpnsConstants::TWO_FACTOR_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
22
+ return $status;
23
+ }
24
+
25
+
26
+ function updatePluginConfiguration()
27
+ {
28
+ if(!get_option('mo_wpns_enable_2fa'))
29
+ return;
30
+
31
+ if(!get_option( 'mo2f_customerKey') || !get_option( 'mo2f_api_key') || !get_option( 'mo2f_customer_token') || !get_option( 'mo2f_app_secret'))
32
+ {
33
+ global $mo2f_dirName;
34
+ $current_user = wp_get_current_user();
35
+ $mo2fa = new Two_Factor_Setup();
36
+ update_option( 'mo2f_email' ,get_option( 'mo2f_email'));
37
+ update_option( 'mo2f_host_name' ,MoWpnsConstants::HOST_NAME);
38
+ update_option( 'mo2f_phone' ,get_option( 'mo_wpns_admin_phone'));
39
+ update_option( 'mo2f_customerKey' ,get_option( 'mo2f_customerKey'));
40
+ update_option( 'mo2f_api_key' ,get_option( 'mo2f_api_key'));
41
+ update_option( 'mo2f_customer_token' ,get_option( 'mo2f_customer_token'));
42
+ update_option( 'mo2f_app_secret' ,get_option( 'mo2f_app_secret'));
43
+ update_option( 'mo2f_miniorange_admin' ,$current_user->ID);
44
+ update_option( 'mo2f_new_customer' ,true);
45
+
46
+ update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
47
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
48
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option( 'mo2f_email'));
49
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
50
+ $mo2fa->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
51
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
52
+ }
53
+ }
54
+ }
55
+
56
+
57
+ class OTPPlugin extends FeaturePluginInterface
58
+ {
59
+ function getstatus()
60
+ {
61
+ $all_plugins = get_plugins();
62
+ $status = 'NOT_INSTALLED';
63
+ if(isset($all_plugins[MoWpnsConstants::OTP_VERIFICATION_SETTINGS]))
64
+ $status = is_plugin_active(MoWpnsConstants::OTP_VERIFICATION_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
65
+ return $status;
66
+ }
67
+
68
+ function updatePluginConfiguration()
69
+ {
70
+ if(!get_option('mo_wpns_enable_advanced_user_verification'))
71
+ return;
72
+
73
+ if(!get_option( 'mo_customer_validation_admin_email') || !get_option( 'mo_customer_validation_admin_customer_key') || !get_option( 'mo_customer_validation_admin_api_key') || !get_option( 'mo_customer_validation_customer_token'))
74
+ {
75
+ update_option( 'mo_customer_validation_wp_default_enable' ,1);
76
+ update_option( 'mo_customer_validation_admin_email' ,get_option( 'mo2f_email'));
77
+ update_option( 'mo_customer_validation_admin_phone' ,get_option( 'mo_wpns_admin_phone'));
78
+ update_option( 'mo_customer_validation_admin_customer_key' ,get_option( 'mo2f_customerKey') );
79
+ update_option( 'mo_customer_validation_admin_api_key' ,get_option( 'mo2f_api_key') );
80
+ update_option( 'mo_customer_validation_customer_token' ,get_option( 'mo2f_customer_token') );
81
+ update_option( 'mo_customer_validation_admin_password' ,'');
82
+ update_option( 'mo_customer_validation_message' ,'Registration complete!');
83
+ update_option( 'mo_customer_validation_registration_status' ,'MO_CUSTOMER_VALIDATION_REGISTRATION_COMPLETE');
84
+ update_option( 'mo_customer_email_transactions_remaining' ,10);
85
+ update_option( 'mo_customer_phone_transactions_remaining' ,10);
86
+ update_option( 'mo_otp_plugin_version' ,1.8);
87
+ }
88
+ }
89
+
90
+ }
91
+
92
+
93
+ class SocialPlugin extends FeaturePluginInterface
94
+ {
95
+ function getstatus()
96
+ {
97
+ $all_plugins = get_plugins();
98
+ $status = 'NOT_INSTALLED';
99
+ if(isset($all_plugins[MoWpnsConstants::SOCIAL_LOGIN_SETTINGS]))
100
+ $status = is_plugin_active(MoWpnsConstants::SOCIAL_LOGIN_SETTINGS) ? 'ACTIVE' : 'INSTALLED';
101
+ return $status;
102
+ }
103
  }
helper/utility.php CHANGED
@@ -1,431 +1,431 @@
1
- <?php
2
-
3
- /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
4
- Copyright (C) 2015 miniOrange
5
-
6
- This program is free software: you can redistribute it and/or modify
7
- it under the terms of the GNU General Public License as published by
8
- the Free Software Foundation, either version 3 of the License, or
9
- (at your option) any later version.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- You should have received a copy of the GNU General Public License
17
- along with this program. If not, see <http://www.gnu.org/licenses/>
18
- * @package miniOrange OAuth
19
- * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
20
- */
21
-
22
- class MoWpnsUtility
23
- {
24
-
25
- public static function icr()
26
- {
27
- $email = get_option('mo2f_email');
28
- $customerKey = get_option('mo2f_customerKey');
29
- if( ! $email || ! $customerKey || ! is_numeric( trim( $customerKey ) ) )
30
- return 0;
31
- else
32
- return 1;
33
- }
34
-
35
- public static function check_empty_or_null( $value )
36
- {
37
- if( ! isset( $value ) || empty( $value ) )
38
- return true;
39
- return false;
40
- }
41
-
42
- public static function rand()
43
- {
44
- $length = wp_rand(0, 15);
45
- $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
46
- $randomString = '';
47
- for ($i = 0; $i < $length; $i++) {
48
- $randomString .= $characters[wp_rand(0, strlen($characters) - 1)];
49
- }
50
- return $randomString;
51
- }
52
-
53
- public static function is_curl_installed()
54
- {
55
- if (in_array ('curl', get_loaded_extensions()))
56
- return 1;
57
- else
58
- return 0;
59
- }
60
-
61
- public static function is_extension_installed($name)
62
- {
63
- if (in_array ($name, get_loaded_extensions()))
64
- return true;
65
- else
66
- return false;
67
- }
68
-
69
- public static function get_client_ip()
70
- {
71
- if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
72
- return $_SERVER['HTTP_CLIENT_IP'];
73
- } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
74
- return $_SERVER['HTTP_X_FORWARDED_FOR'];
75
- } else {
76
- return $_SERVER['REMOTE_ADDR'];
77
- }
78
- return '';
79
- }
80
-
81
- public static function check_if_valid_email($email)
82
- {
83
- $emailarray = explode("@",$email);
84
- if(sizeof($emailarray)==2)
85
- return in_array(trim($emailarray[1]), MoWpnsConstants::$domains);
86
- else
87
- return false;
88
- }
89
-
90
- public static function check_user_password_strength($user,$password)
91
- {
92
-
93
- if(!self::check_if_strong_password_enabled_for_user_role($user->roles))
94
- return "success";
95
- else if(strlen($password) > 5 && preg_match("#[0-9]+#", $password) && preg_match("#[a-zA-Z]+#", $password) && preg_match('/[^a-zA-Z\d]/', $password))
96
- return "success";
97
- else
98
- return "false";
99
-
100
- return "success";
101
- }
102
-
103
- public static function check_if_strong_password_enabled_for_user_role($userroles)
104
- {
105
- $enforce_strong_pass = MoWpnsUtility::get_mo2f_db_option('mo2f_enforce_strong_passswords_for_accounts', 'get_option');
106
-
107
- switch($enforce_strong_pass)
108
- {
109
- case "all":
110
- return true;
111
- break;
112
- case "admin":
113
- if(!in_array("administrator", $userroles))
114
- return false;
115
- break;
116
- case "user":
117
- if(in_array("administrator", $userroles))
118
- return false;
119
- break;
120
- }
121
- return true;
122
- }
123
-
124
- public static function get_current_url()
125
- {
126
- $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
127
- $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
128
- return $url;
129
- }
130
-
131
- //Function to handle recaptcha
132
- function verify_recaptcha($response)
133
- {
134
- $error = new WP_Error();
135
- if(!empty($response))
136
- {
137
- if(!mo2f_ReCaptcha::recaptcha_verify($response))
138
- $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Invalid Captcha. Please verify captcha again.'));
139
- else
140
- return true;
141
- }
142
- else
143
- $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Please verify the captcha.'));
144
- return $error;
145
- }
146
-
147
- function verify_recaptcha_3($response)
148
- {
149
- $error = new WP_Error();
150
- if(!empty($response))
151
- {
152
- if(!mo2f_ReCaptcha::recaptcha_verify_3($response))
153
- $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Access Denied.'));
154
- else
155
- return true;
156
- }
157
- else{
158
-
159
- $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Please verify the captcha.'));
160
- }
161
- return $error;
162
- }
163
-
164
-
165
- function sendIpBlockedNotification($ipAddress, $reason)
166
- {
167
- global $moWpnsUtility;
168
- $subject = 'User with IP address '.$ipAddress.' is blocked | '.get_bloginfo();
169
- $toEmail = get_option('admin_email_address');
170
- $content = "";
171
- if(get_option('custom_admin_template'))
172
- {
173
- $content = get_option('custom_admin_template');
174
- $content = str_replace("##ipaddress##",$ipAddress,$content);
175
- }
176
- else
177
- $content = $this->getMessageContent($reason,$ipAddress);
178
-
179
- if(isset($content))
180
- return $this->wp_mail_send_notification($toEmail,$subject,$content);
181
- }
182
-
183
- function wp_mail_send_notification($toEmail,$subject,$content){
184
- $headers = array('Content-Type: text/html; charset=UTF-8');
185
- wp_mail( $toEmail, $subject, $content, $headers);
186
-
187
- }
188
-
189
-
190
- function sendNotificationToUserForUnusualActivities($username, $ipAddress, $reason)
191
- {
192
- $content = "";
193
- //check if email not already sent
194
- if(get_option($ipAddress.$reason)){
195
- return json_encode(array("status"=>'SUCCESS','statusMessage'=>'SUCCESS'));
196
- }
197
-
198
- global $moWpnsUtility;
199
-
200
- $user = get_user_by( 'login', $username );
201
- if($user && !empty($user->user_email))
202
- $toEmail = $user->user_email;
203
- else
204
- return;
205
-
206
- $mo_wpns_config = new MoWpnsHandler();
207
- if($mo_wpns_config->is_email_sent_to_user($username,$ipAddress))
208
- return;
209
-
210
- $fromEmail = get_option('mo2f_email');
211
- $subject = 'Sign in from new location for your user account | '.get_bloginfo();
212
-
213
- if(get_option('custom_user_template'))
214
- {
215
- $content = get_option('custom_user_template');
216
- $content = str_replace("##ipaddress##",$ipAddress,$content);
217
- $content = str_replace("##username##",$username,$content);
218
- }
219
- else
220
- $content = $this->getMessageContent($reason,$ipAddress,$username,$fromEmail);
221
-
222
- $mo_wpns_config->audit_email_notification_sent_to_user($username,$ipAddress,$reason);
223
- $status = $this->wp_mail_send_notification($toEmail,$subject,$content,$fromEmail);
224
- return $status;
225
- }
226
-
227
- //Check if null what will be the message
228
- function getMessageContent($reason,$ipAddress,$username=null,$fromEmail=null)
229
- {
230
- switch($reason)
231
- {
232
- case MoWpnsConstants::LOGIN_ATTEMPTS_EXCEEDED:
233
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has exceeded allowed failed login attempts on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
234
- return $content;
235
- case MoWpnsConstants::IP_RANGE_BLOCKING:
236
- $content = "Hello,<br><br>The user's IP Address <b>".$ipAddress."</b> was found in IP Range specified by you in Advanced IP Blocking and we have blocked his IP address for further access to your website <b>".get_bloginfo()."</b>.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
237
- return $content;
238
- case MoWpnsConstants::BLOCKED_BY_ADMIN:
239
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has blocked by admin and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
240
- return $content;
241
- case MoWpnsConstants::ATTACK_LIMIT_EXCEEDED:
242
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has attack limit exceed on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
243
- return $content;
244
- case MoWpnsConstants::RATE_LIMIT_EXCEEDED:
245
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has rate limit exceed on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
246
- return $content;
247
- case MoWpnsConstants::RATE_LIMIT_EXCEEDED_CRAWLER_ATTACK:
248
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has found as a crawler on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
249
- return $content;
250
- case MoWpnsConstants::LOGGED_IN_FROM_NEW_IP:
251
- $content = "Hello ".$username.",<br><br>Your account was logged in from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
252
- return $content;
253
- case MoWpnsConstants::FAILED_LOGIN_ATTEMPTS_FROM_NEW_IP:
254
- $subject = 'Someone trying to access you account | '.get_bloginfo();
255
- $content = "Hello ".$username.",<br><br>Someone tried to login to your account from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b> with failed login attempts. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
256
- return $content;
257
- default:
258
- if(is_null($username))
259
- $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has exceeded allowed trasaction limit on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
260
- else
261
- $content = "Hello ".$username.",<br><br>Your account was logged in from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
262
- return $content;
263
- }
264
- }
265
-
266
- public static function hasLoginCookie(){
267
- if(isset($_COOKIE)){
268
- if(is_array($_COOKIE)){
269
- foreach($_COOKIE as $key => $val){
270
- if(strpos($key, 'wordpress_logged_in') === 0){
271
- return true;
272
- }
273
- }
274
- }
275
- }
276
- return false;
277
- }
278
- function getCurrentBrowser()
279
- {
280
- $useragent = $_SERVER['HTTP_USER_AGENT'];
281
- if(empty($useragent))
282
- return false;
283
-
284
- $useragent = strtolower($useragent);
285
- if(strpos($useragent, 'edge') !== false)
286
- return 'edge';
287
- else if(strpos($useragent, 'edg') !== false)
288
- return 'edge';
289
- else if(strpos($useragent, 'opr') !== false)
290
- return 'opera';
291
- else if(strpos($useragent, 'chrome') !== false || strpos($useragent, 'CriOS') !== false)
292
- return 'chrome';
293
- else if(strpos($useragent, 'firefox') !== false)
294
- return 'firefox';
295
- else if(strpos($useragent, 'msie') !== false || strpos($useragent, 'trident') !==false)
296
- return 'ie';
297
- else if(strpos($useragent, 'safari') !== false)
298
- return 'safari';
299
- }
300
-
301
- public static function getFeatureStatus(){
302
- $status='';
303
- $status.="#";
304
-
305
- if(mo2f_is_customer_registered())
306
- $status.="CT1";
307
- if(get_site_option('mo2f_visit_waf'))
308
- $status.="WF1";
309
- if(get_site_option('mo2f_visit_login_and_spam'))
310
- $status.="LS1";
311
- if(get_site_option('mo2f_visit_malware'))
312
- $status.="M1";
313
- if(get_site_option('mo2f_visit_backup'))
314
- $status.="B1";
315
- if(get_site_option('mo2f_two_factor'))
316
- $status.="TF1";
317
- if(time()-get_site_option("mo_2fa_pnp")<2592000)
318
- $status.='U1';
319
- $status.="R".rand(0,1000);
320
- return $status;
321
- }
322
- function checkPlugins(){
323
- $installed="";
324
- $filedirname=dirname(dirname(dirname(__FILE__)));
325
- if(file_exists($filedirname."/wordfence/wordfence.php")){
326
- $installed.="wordfence;";
327
- }
328
- if(file_exists($filedirname."/all-in-one-wp-security-and-firewall/wp-security.php")){
329
- $installed.="all-in-one-wp-security-and-firewall;";
330
- }
331
- if(file_exists($filedirname."/better-wp-security/better-wp-security.php")){
332
- $installed.="better-wp-security;";
333
- }
334
- if(file_exists($filedirname."/sucuri-scanner/sucuri.php")){
335
- $installed.="sucuri-scanner;";
336
- }
337
- return $installed;
338
-
339
- }
340
-
341
- public static function get_mo2f_db_option($value, $type){
342
- if($type == 'site_option'){
343
- $db_value = get_site_option($value, $GLOBALS[$value]);
344
- }else{
345
- $db_value = get_option($value, $GLOBALS[$value]);
346
- }
347
- return $db_value;
348
- }
349
- public static function checkSecurity(){
350
-
351
- $guestcustomer = new Customer_Setup();
352
-
353
- $guestcustomer->guest_audit();
354
- }
355
- public static function mo_2fa_send_configuration($send_all_configuration=false){
356
- global $Mo2fdbQueries,$moWpnsUtility;
357
- $user_object = wp_get_current_user();
358
- $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user_object->ID );
359
- $other_methods = $Mo2fdbQueries->get_all_user_2fa_methods();
360
- $key = get_option('mo2f_customerKey');
361
- $is_plugin_active_for_network = is_plugin_active_for_network( MoWpnsConstants::TWO_FACTOR_SETTINGS);
362
- $is_onprem = get_option('is_onprem');
363
- $WAFEnabled = get_site_option('WAFEnabled');
364
- $WAFLevel = get_site_option('WAF');
365
- $NoOf2faUsers = $Mo2fdbQueries->get_no_of_2fa_users();
366
- $EmailTransactions = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
367
- $SMSTransactions = get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')?get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z'):0;
368
- $SQLInjection = get_option('SQLInjection');
369
- $XSSAttack = get_option('XSSAttack');
370
- $RFIAttack = get_option('RFIAttack');
371
- $LFIAttack = get_option('LFIAttack');
372
- $Rate_request = get_option('Rate_request');
373
- $limitAttack = get_option('limitAttack');
374
- $RCEAttack = get_option('RCEAttack');
375
- $mo_wpns_countrycodes = get_option('mo_wpns_countrycodes');
376
- $mo2f_enable_brute_force = get_option('mo2f_enable_brute_force');
377
- $space = "<span>&nbsp;&nbsp;&nbsp;</span>";
378
- $browser = $moWpnsUtility->getCurrentBrowser();
379
- $specific_plugins = array('UM_Functions'=>'Ultimate Member', 'wc_get_product'=>'WooCommerce','pmpro_gateways'=>'Paid MemberShip Pro');
380
- $backup_codes_remaining = get_user_meta($user_object->ID, 'mo2f_backup_codes', true);
381
- if(is_array($backup_codes_remaining)){
382
- $backup_codes_remaining = sizeof($backup_codes_remaining);
383
- }else{
384
- $backup_codes_remaining = 0;
385
- }
386
- $plugin_configuration ="<br><br><I>Plugin Configuration :-</I>".$space."On-premise:".($is_onprem?"Yes":"No"). $space."2FA method:" . ($mo2f_configured_2FA_method==''?"Not selected":$mo2f_configured_2FA_method).$space."No. of 2FA users :".$NoOf2faUsers.$space."Methods of users:".($other_methods==''?"NONE":$other_methods).$space."Email transactions:".$EmailTransactions.$space."SMS Transactions:".$SMSTransactions.$space.(is_multisite()?"Multisite:Yes":"Single-site:Yes").((mo2f_is_customer_registered())?($space."Customer Key:".$key):($space."Customer Registered:'No")).$space."Browser:".$browser;
387
- if(get_user_meta($user_object->ID, 'mo_backup_code_generated', true) || get_user_meta($user_object->ID, 'mo_backup_code_downloaded', true))
388
- $plugin_configuration=$plugin_configuration.$space."Backup Codes:".$backup_codes_remaining."/5";
389
- $plugins='';
390
- foreach($specific_plugins as $class_name => $plugin_name){
391
- if(class_exists($class_name) || function_exists($class_name)){
392
- $plugins = $plugins."<span>&nbsp;</span>'".$plugin_name."'";
393
- }
394
- }
395
- $plugin_configuration=$plugin_configuration.($plugins!=''?$space."Installed Plugins:".$plugins:'');
396
- if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
397
- $plugin_configuration=$plugin_configuration.$space."WAF enabled:".$WAFEnabled.($WAFEnabled?$space."WAF level : ".$WAFLevel:"").$space."Brute force enabled : ".($mo2f_enable_brute_force?"Yes":"No");
398
- if(is_multisite()){
399
- $plugin_configuration = $plugin_configuration.$space.($is_plugin_active_for_network?"Network activated:'Yes":"Site activated:'Yes");
400
- }
401
- if(time()-get_site_option("mo_2fa_pnp")<2592000 && (get_site_option('mo_2fa_plan_type')|| get_site_option('mo_2fa_addon_plan_type'))){
402
- $plugin_configuration=$plugin_configuration.$space."Checked plans:'";
403
- if(get_site_option('mo_2fa_plan_type'))
404
- $plugin_configuration=$plugin_configuration.get_site_option('mo_2fa_plan_type')."'";
405
- if(get_site_option('mo_2fa_addon_plan_type'))
406
- $plugin_configuration=$plugin_configuration."<span>&nbsp;</span>'".get_site_option('mo_2fa_addon_plan_type')."'";
407
- }
408
- $plugin_configuration=$plugin_configuration.$space."PHP_version:" . phpversion().$space."Wordpress_version:" . get_bloginfo('version');
409
- if(!$send_all_configuration)
410
- return $plugin_configuration;
411
- if(get_site_option('enable_form_shortcode')){
412
- $forms = array('mo2f_custom_reg_bbpress','mo2f_custom_reg_wocommerce','mo2f_custom_reg_custom');
413
- foreach($forms as $form){
414
- if(get_site_option($form))
415
- $plugin_configuration = $plugin_configuration.$space.$form.":".get_option($form);
416
- }
417
- }
418
- if(!MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
419
- return $plugin_configuration;
420
- $plugin_configuration = $plugin_configuration.$space."SQL Injection:".$SQLInjection .$space."XSS Attack:".$XSSAttack.$space."RFI Attack:".$RFIAttack.$space."Limit Attack:".$limitAttack.$space."RCE Attack:".$RCEAttack;
421
- $plugin_configuration=$plugin_configuration.(get_option('Rate_limiting')?$space."Rate request:".$Rate_request:'');
422
- $plugin_configuration = get_option('mo_wpns_countrycodes')?$plugin_configuration.$space."mo_wpns_countrycodes:".$mo_wpns_countrycodes:$plugin_configuration.$space."Country Blocking:'Disabled";
423
- $browser_block = array('mo_wpns_block_chrome','mo_wpns_block_firefox','mo_wpns_block_ie','mo_wpns_block_safari','mo_wpns_block_opera','mo_wpns_block_edge');
424
- foreach($browser_block as $browser){
425
- if(get_option($browser))
426
- $plugin_configuration = $plugin_configuration.$space.$browser.":".get_option($browser);
427
- }
428
- return $plugin_configuration;
429
- }
430
-
431
- }
1
+ <?php
2
+
3
+ /** miniOrange enables user to log in through mobile authentication as an additional layer of security over password.
4
+ Copyright (C) 2015 miniOrange
5
+
6
+ This program is free software: you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation, either version 3 of the License, or
9
+ (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ You should have received a copy of the GNU General Public License
17
+ along with this program. If not, see <http://www.gnu.org/licenses/>
18
+ * @package miniOrange OAuth
19
+ * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
20
+ */
21
+
22
+ class MoWpnsUtility
23
+ {
24
+
25
+ public static function icr()
26
+ {
27
+ $email = get_option('mo2f_email');
28
+ $customerKey = get_option('mo2f_customerKey');
29
+ if( ! $email || ! $customerKey || ! is_numeric( trim( $customerKey ) ) )
30
+ return 0;
31
+ else
32
+ return 1;
33
+ }
34
+
35
+ public static function check_empty_or_null( $value )
36
+ {
37
+ if( ! isset( $value ) || empty( $value ) )
38
+ return true;
39
+ return false;
40
+ }
41
+
42
+ public static function rand()
43
+ {
44
+ $length = wp_rand(0, 15);
45
+ $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
46
+ $randomString = '';
47
+ for ($i = 0; $i < $length; $i++) {
48
+ $randomString .= $characters[wp_rand(0, strlen($characters) - 1)];
49
+ }
50
+ return $randomString;
51
+ }
52
+
53
+ public static function is_curl_installed()
54
+ {
55
+ if (in_array ('curl', get_loaded_extensions()))
56
+ return 1;
57
+ else
58
+ return 0;
59
+ }
60
+
61
+ public static function is_extension_installed($name)
62
+ {
63
+ if (in_array ($name, get_loaded_extensions()))
64
+ return true;
65
+ else
66
+ return false;
67
+ }
68
+
69
+ public static function get_client_ip()
70
+ {
71
+ if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
72
+ return $_SERVER['HTTP_CLIENT_IP'];
73
+ } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
74
+ return $_SERVER['HTTP_X_FORWARDED_FOR'];
75
+ } else {
76
+ return $_SERVER['REMOTE_ADDR'];
77
+ }
78
+ return '';
79
+ }
80
+
81
+ public static function check_if_valid_email($email)
82
+ {
83
+ $emailarray = explode("@",$email);
84
+ if(sizeof($emailarray)==2)
85
+ return in_array(trim($emailarray[1]), MoWpnsConstants::$domains);
86
+ else
87
+ return false;
88
+ }
89
+
90
+ public static function check_user_password_strength($user,$password)
91
+ {
92
+
93
+ if(!self::check_if_strong_password_enabled_for_user_role($user->roles))
94
+ return "success";
95
+ else if(strlen($password) > 5 && preg_match("#[0-9]+#", $password) && preg_match("#[a-zA-Z]+#", $password) && preg_match('/[^a-zA-Z\d]/', $password))
96
+ return "success";
97
+ else
98
+ return "false";
99
+
100
+ return "success";
101
+ }
102
+
103
+ public static function check_if_strong_password_enabled_for_user_role($userroles)
104
+ {
105
+ $enforce_strong_pass = MoWpnsUtility::get_mo2f_db_option('mo2f_enforce_strong_passswords_for_accounts', 'get_option');
106
+
107
+ switch($enforce_strong_pass)
108
+ {
109
+ case "all":
110
+ return true;
111
+ break;
112
+ case "admin":
113
+ if(!in_array("administrator", $userroles))
114
+ return false;
115
+ break;
116
+ case "user":
117
+ if(in_array("administrator", $userroles))
118
+ return false;
119
+ break;
120
+ }
121
+ return true;
122
+ }
123
+
124
+ public static function get_current_url()
125
+ {
126
+ $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
127
+ $url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
128
+ return $url;
129
+ }
130
+
131
+ //Function to handle recaptcha
132
+ function verify_recaptcha($response)
133
+ {
134
+ $error = new WP_Error();
135
+ if(!empty($response))
136
+ {
137
+ if(!mo2f_ReCaptcha::recaptcha_verify($response))
138
+ $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Invalid Captcha. Please verify captcha again.'));
139
+ else
140
+ return true;
141
+ }
142
+ else
143
+ $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Please verify the captcha.'));
144
+ return $error;
145
+ }
146
+
147
+ function verify_recaptcha_3($response)
148
+ {
149
+ $error = new WP_Error();
150
+ if(!empty($response))
151
+ {
152
+ if(!mo2f_ReCaptcha::recaptcha_verify_3($response))
153
+ $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Access Denied.'));
154
+ else
155
+ return true;
156
+ }
157
+ else{
158
+
159
+ $error->add('recaptcha_error', __( '<strong>ERROR</strong> : Please verify the captcha.'));
160
+ }
161
+ return $error;
162
+ }
163
+
164
+
165
+ function sendIpBlockedNotification($ipAddress, $reason)
166
+ {
167
+ global $moWpnsUtility;
168
+ $subject = 'User with IP address '.$ipAddress.' is blocked | '.get_bloginfo();
169
+ $toEmail = get_option('admin_email_address');
170
+ $content = "";
171
+ if(get_option('custom_admin_template'))
172
+ {
173
+ $content = get_option('custom_admin_template');
174
+ $content = str_replace("##ipaddress##",$ipAddress,$content);
175
+ }
176
+ else
177
+ $content = $this->getMessageContent($reason,$ipAddress);
178
+
179
+ if(isset($content))
180
+ return $this->wp_mail_send_notification($toEmail,$subject,$content);
181
+ }
182
+
183
+ function wp_mail_send_notification($toEmail,$subject,$content){
184
+ $headers = array('Content-Type: text/html; charset=UTF-8');
185
+ wp_mail( $toEmail, $subject, $content, $headers);
186
+
187
+ }
188
+
189
+
190
+ function sendNotificationToUserForUnusualActivities($username, $ipAddress, $reason)
191
+ {
192
+ $content = "";
193
+ //check if email not already sent
194
+ if(get_option($ipAddress.$reason)){
195
+ return json_encode(array("status"=>'SUCCESS','statusMessage'=>'SUCCESS'));
196
+ }
197
+
198
+ global $moWpnsUtility;
199
+
200
+ $user = get_user_by( 'login', $username );
201
+ if($user && !empty($user->user_email))
202
+ $toEmail = $user->user_email;
203
+ else
204
+ return;
205
+
206
+ $mo_wpns_config = new MoWpnsHandler();
207
+ if($mo_wpns_config->is_email_sent_to_user($username,$ipAddress))
208
+ return;
209
+
210
+ $fromEmail = get_option('mo2f_email');
211
+ $subject = 'Sign in from new location for your user account | '.get_bloginfo();
212
+
213
+ if(get_option('custom_user_template'))
214
+ {
215
+ $content = get_option('custom_user_template');
216
+ $content = str_replace("##ipaddress##",$ipAddress,$content);
217
+ $content = str_replace("##username##",$username,$content);
218
+ }
219
+ else
220
+ $content = $this->getMessageContent($reason,$ipAddress,$username,$fromEmail);
221
+
222
+ $mo_wpns_config->audit_email_notification_sent_to_user($username,$ipAddress,$reason);
223
+ $status = $this->wp_mail_send_notification($toEmail,$subject,$content,$fromEmail);
224
+ return $status;
225
+ }
226
+
227
+ //Check if null what will be the message
228
+ function getMessageContent($reason,$ipAddress,$username=null,$fromEmail=null)
229
+ {
230
+ switch($reason)
231
+ {
232
+ case MoWpnsConstants::LOGIN_ATTEMPTS_EXCEEDED:
233
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has exceeded allowed failed login attempts on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
234
+ return $content;
235
+ case MoWpnsConstants::IP_RANGE_BLOCKING:
236
+ $content = "Hello,<br><br>The user's IP Address <b>".$ipAddress."</b> was found in IP Range specified by you in Advanced IP Blocking and we have blocked his IP address for further access to your website <b>".get_bloginfo()."</b>.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
237
+ return $content;
238
+ case MoWpnsConstants::BLOCKED_BY_ADMIN:
239
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has blocked by admin and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
240
+ return $content;
241
+ case MoWpnsConstants::ATTACK_LIMIT_EXCEEDED:
242
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has attack limit exceed on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
243
+ return $content;
244
+ case MoWpnsConstants::RATE_LIMIT_EXCEEDED:
245
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has rate limit exceed on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
246
+ return $content;
247
+ case MoWpnsConstants::RATE_LIMIT_EXCEEDED_CRAWLER_ATTACK:
248
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has found as a crawler on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange";
249
+ return $content;
250
+ case MoWpnsConstants::LOGGED_IN_FROM_NEW_IP:
251
+ $content = "Hello ".$username.",<br><br>Your account was logged in from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
252
+ return $content;
253
+ case MoWpnsConstants::FAILED_LOGIN_ATTEMPTS_FROM_NEW_IP:
254
+ $subject = 'Someone trying to access you account | '.get_bloginfo();
255
+ $content = "Hello ".$username.",<br><br>Someone tried to login to your account from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b> with failed login attempts. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
256
+ return $content;
257
+ default:
258
+ if(is_null($username))
259
+ $content = "Hello,<br><br>The user with IP Address <b>".$ipAddress."</b> has exceeded allowed trasaction limit on your website <b>".get_bloginfo()."</b> and we have blocked his IP address for further access to website.<br><br>You can login to your WordPress dashaboard to check more details.<br><br>Thanks,<br>miniOrange" ;
260
+ else
261
+ $content = "Hello ".$username.",<br><br>Your account was logged in from new IP Address <b>".$ipAddress."</b> on website <b>".get_bloginfo()."</b>. Please <a href='mailto:".$fromEmail."'>contact us</a> if you don't recognise this activity.<br><br>Thanks,<br>".get_bloginfo() ;
262
+ return $content;
263
+ }
264
+ }
265
+
266
+ public static function hasLoginCookie(){
267
+ if(isset($_COOKIE)){
268
+ if(is_array($_COOKIE)){
269
+ foreach($_COOKIE as $key => $val){
270
+ if(strpos($key, 'wordpress_logged_in') === 0){
271
+ return true;
272
+ }
273
+ }
274
+ }
275
+ }
276
+ return false;
277
+ }
278
+ function getCurrentBrowser()
279
+ {
280
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
281
+ if(empty($useragent))
282
+ return false;
283
+
284
+ $useragent = strtolower($useragent);
285
+ if(strpos($useragent, 'edge') !== false)
286
+ return 'edge';
287
+ else if(strpos($useragent, 'edg') !== false)
288
+ return 'edge';
289
+ else if(strpos($useragent, 'opr') !== false)
290
+ return 'opera';
291
+ else if(strpos($useragent, 'chrome') !== false || strpos($useragent, 'CriOS') !== false)
292
+ return 'chrome';
293
+ else if(strpos($useragent, 'firefox') !== false)
294
+ return 'firefox';
295
+ else if(strpos($useragent, 'msie') !== false || strpos($useragent, 'trident') !==false)
296
+ return 'ie';
297
+ else if(strpos($useragent, 'safari') !== false)
298
+ return 'safari';
299
+ }
300
+
301
+ public static function getFeatureStatus(){
302
+ $status='';
303
+ $status.="#";
304
+
305
+ if(mo2f_is_customer_registered())
306
+ $status.="CT1";
307
+ if(get_site_option('mo2f_visit_waf'))
308
+ $status.="WF1";
309
+ if(get_site_option('mo2f_visit_login_and_spam'))
310
+ $status.="LS1";
311
+ if(get_site_option('mo2f_visit_malware'))
312
+ $status.="M1";
313
+ if(get_site_option('mo2f_visit_backup'))
314
+ $status.="B1";
315
+ if(get_site_option('mo2f_two_factor'))
316
+ $status.="TF1";
317
+ if(time()-get_site_option("mo_2fa_pnp")<2592000)
318
+ $status.='U1';
319
+ $status.="R".rand(0,1000);
320
+ return $status;
321
+ }
322
+ function checkPlugins(){
323
+ $installed="";
324
+ $filedirname=dirname(dirname(dirname(__FILE__)));
325
+ if(file_exists($filedirname."/wordfence/wordfence.php")){
326
+ $installed.="wordfence;";
327
+ }
328
+ if(file_exists($filedirname."/all-in-one-wp-security-and-firewall/wp-security.php")){
329
+ $installed.="all-in-one-wp-security-and-firewall;";
330
+ }
331
+ if(file_exists($filedirname."/better-wp-security/better-wp-security.php")){
332
+ $installed.="better-wp-security;";
333
+ }
334
+ if(file_exists($filedirname."/sucuri-scanner/sucuri.php")){
335
+ $installed.="sucuri-scanner;";
336
+ }
337
+ return $installed;
338
+
339
+ }
340
+
341
+ public static function get_mo2f_db_option($value, $type){
342
+ if($type == 'site_option'){
343
+ $db_value = get_site_option($value, $GLOBALS[$value]);
344
+ }else{
345
+ $db_value = get_option($value, $GLOBALS[$value]);
346
+ }
347
+ return $db_value;
348
+ }
349
+ public static function checkSecurity(){
350
+
351
+ $guestcustomer = new Customer_Setup();
352
+
353
+ $guestcustomer->guest_audit();
354
+ }
355
+ public static function mo_2fa_send_configuration($send_all_configuration=false){
356
+ global $Mo2fdbQueries,$moWpnsUtility;
357
+ $user_object = wp_get_current_user();
358
+ $mo2f_configured_2FA_method = $Mo2fdbQueries->get_user_detail( 'mo2f_configured_2FA_method', $user_object->ID );
359
+ $other_methods = $Mo2fdbQueries->get_all_user_2fa_methods();
360
+ $key = get_option('mo2f_customerKey');
361
+ $is_plugin_active_for_network = is_plugin_active_for_network( MoWpnsConstants::TWO_FACTOR_SETTINGS);
362
+ $is_onprem = get_option('is_onprem');
363
+ $WAFEnabled = get_site_option('WAFEnabled');
364
+ $WAFLevel = get_site_option('WAF');
365
+ $NoOf2faUsers = $Mo2fdbQueries->get_no_of_2fa_users();
366
+ $EmailTransactions = MoWpnsUtility::get_mo2f_db_option('cmVtYWluaW5nT1RQ', 'site_option');
367
+ $SMSTransactions = get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z')?get_site_option('cmVtYWluaW5nT1RQVHJhbnNhY3Rpb25z'):0;
368
+ $SQLInjection = get_option('SQLInjection');
369
+ $XSSAttack = get_option('XSSAttack');
370
+ $RFIAttack = get_option('RFIAttack');
371
+ $LFIAttack = get_option('LFIAttack');
372
+ $Rate_request = get_option('Rate_request');
373
+ $limitAttack = get_option('limitAttack');
374
+ $RCEAttack = get_option('RCEAttack');
375
+ $mo_wpns_countrycodes = get_option('mo_wpns_countrycodes');
376
+ $mo2f_enable_brute_force = get_option('mo2f_enable_brute_force');
377
+ $space = "<span>&nbsp;&nbsp;&nbsp;</span>";
378
+ $browser = $moWpnsUtility->getCurrentBrowser();
379
+ $specific_plugins = array('UM_Functions'=>'Ultimate Member', 'wc_get_product'=>'WooCommerce','pmpro_gateways'=>'Paid MemberShip Pro');
380
+ $backup_codes_remaining = get_user_meta($user_object->ID, 'mo2f_backup_codes', true);
381
+ if(is_array($backup_codes_remaining)){
382
+ $backup_codes_remaining = sizeof($backup_codes_remaining);
383
+ }else{
384
+ $backup_codes_remaining = 0;
385
+ }
386
+ $plugin_configuration ="<br><br><I>Plugin Configuration :-</I>".$space."On-premise:".($is_onprem?"Yes":"No"). $space."2FA method:" . ($mo2f_configured_2FA_method==''?"Not selected":$mo2f_configured_2FA_method).$space."No. of 2FA users :".$NoOf2faUsers.$space."Methods of users:".($other_methods==''?"NONE":$other_methods).$space."Email transactions:".$EmailTransactions.$space."SMS Transactions:".$SMSTransactions.$space.(is_multisite()?"Multisite:Yes":"Single-site:Yes").((mo2f_is_customer_registered())?($space."Customer Key:".$key):($space."Customer Registered:'No")).$space."Browser:".$browser;
387
+ if(get_user_meta($user_object->ID, 'mo_backup_code_generated', true) || get_user_meta($user_object->ID, 'mo_backup_code_downloaded', true))
388
+ $plugin_configuration=$plugin_configuration.$space."Backup Codes:".$backup_codes_remaining."/5";
389
+ $plugins='';
390
+ foreach($specific_plugins as $class_name => $plugin_name){
391
+ if(class_exists($class_name) || function_exists($class_name)){
392
+ $plugins = $plugins."<span>&nbsp;</span>'".$plugin_name."'";
393
+ }
394
+ }
395
+ $plugin_configuration=$plugin_configuration.($plugins!=''?$space."Installed Plugins:".$plugins:'');
396
+ if(MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
397
+ $plugin_configuration=$plugin_configuration.$space."WAF enabled:".$WAFEnabled.($WAFEnabled?$space."WAF level : ".$WAFLevel:"").$space."Brute force enabled : ".($mo2f_enable_brute_force?"Yes":"No");
398
+ if(is_multisite()){
399
+ $plugin_configuration = $plugin_configuration.$space.($is_plugin_active_for_network?"Network activated:'Yes":"Site activated:'Yes");
400
+ }
401
+ if(time()-get_site_option("mo_2fa_pnp")<2592000 && (get_site_option('mo_2fa_plan_type')|| get_site_option('mo_2fa_addon_plan_type'))){
402
+ $plugin_configuration=$plugin_configuration.$space."Checked plans:'";
403
+ if(get_site_option('mo_2fa_plan_type'))
404
+ $plugin_configuration=$plugin_configuration.get_site_option('mo_2fa_plan_type')."'";
405
+ if(get_site_option('mo_2fa_addon_plan_type'))
406
+ $plugin_configuration=$plugin_configuration."<span>&nbsp;</span>'".get_site_option('mo_2fa_addon_plan_type')."'";
407
+ }
408
+ $plugin_configuration=$plugin_configuration.$space."PHP_version:" . phpversion().$space."Wordpress_version:" . get_bloginfo('version');
409
+ if(!$send_all_configuration)
410
+ return $plugin_configuration;
411
+ if(get_site_option('enable_form_shortcode')){
412
+ $forms = array('mo2f_custom_reg_bbpress','mo2f_custom_reg_wocommerce','mo2f_custom_reg_custom');
413
+ foreach($forms as $form){
414
+ if(get_site_option($form))
415
+ $plugin_configuration = $plugin_configuration.$space.$form.":".get_option($form);
416
+ }
417
+ }
418
+ if(!MoWpnsUtility::get_mo2f_db_option('mo_wpns_2fa_with_network_security', 'get_option'))
419
+ return $plugin_configuration;
420
+ $plugin_configuration = $plugin_configuration.$space."SQL Injection:".$SQLInjection .$space."XSS Attack:".$XSSAttack.$space."RFI Attack:".$RFIAttack.$space."Limit Attack:".$limitAttack.$space."RCE Attack:".$RCEAttack;
421
+ $plugin_configuration=$plugin_configuration.(get_option('Rate_limiting')?$space."Rate request:".$Rate_request:'');
422
+ $plugin_configuration = get_option('mo_wpns_countrycodes')?$plugin_configuration.$space."mo_wpns_countrycodes:".$mo_wpns_countrycodes:$plugin_configuration.$space."Country Blocking:'Disabled";
423
+ $browser_block = array('mo_wpns_block_chrome','mo_wpns_block_firefox','mo_wpns_block_ie','mo_wpns_block_safari','mo_wpns_block_opera','mo_wpns_block_edge');
424
+ foreach($browser_block as $browser){
425
+ if(get_option($browser))
426
+ $plugin_configuration = $plugin_configuration.$space.$browser.":".get_option($browser);
427
+ }
428
+ return $plugin_configuration;
429
+ }
430
+
431
+ }
includes/css/jquery.ui.css CHANGED
@@ -1,918 +1,918 @@
1
- /*! jQuery UI - v1.11.4 - 2015-07-30
2
- * http://jqueryui.com
3
- * Includes: core.css, draggable.css, resizable.css, button.css, dialog.css, theme.css
4
- * To view and modify this theme, visit http://jqueryui.com/themeroller/
5
- * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
6
-
7
- /* Layout helpers
8
- ----------------------------------*/
9
- .ui-helper-hidden {
10
- display: none;
11
- }
12
- .ui-helper-hidden-accessible {
13
- border: 0;
14
- clip: rect(0 0 0 0);
15
- height: 1px;
16
- margin: -1px;
17
- overflow: hidden;
18
- padding: 0;
19
- position: absolute;
20
- width: 1px;
21
- }
22
- .ui-helper-reset {
23
- margin: 0;
24
- padding: 0;
25
- border: 0;
26
- outline: 0;
27
- line-height: 1.3;
28
- text-decoration: none;
29
- font-size: 100%;
30
- list-style: none;
31
- }
32
- .ui-helper-clearfix:before,
33
- .ui-helper-clearfix:after {
34
- content: "";
35
- display: table;
36
- border-collapse: collapse;
37
- }
38
- .ui-helper-clearfix:after {
39
- clear: both;
40
- }
41
- .ui-helper-clearfix {
42
- min-height: 0; /* support: IE7 */
43
- }
44
- .ui-helper-zfix {
45
- width: 100%;
46
- height: 100%;
47
- top: 0;
48
- left: 0;
49
- position: absolute;
50
- opacity: 0;
51
- filter:Alpha(Opacity=0); /* support: IE8 */
52
- }
53
-
54
- .ui-front {
55
- z-index: 100;
56
- }
57
-
58
-
59
- /* Interaction Cues
60
- ----------------------------------*/
61
- .ui-state-disabled {
62
- cursor: default !important;
63
- }
64
-
65
-
66
- /* Icons
67
- ----------------------------------*/
68
-
69
- /* states and images */
70
- .ui-icon {
71
- display: block;
72
- text-indent: -99999px;
73
- overflow: hidden;
74
- background-repeat: no-repeat;
75
- }
76
-
77
-
78
- /* Misc visuals
79
- ----------------------------------*/
80
-
81
- /* Overlays */
82
- .ui-widget-overlay {
83
- position: fixed;
84
- top: 0;
85
- left: 0;
86
- width: 100%;
87
- height: 100%;
88
- }
89
- .ui-draggable-handle {
90
- -ms-touch-action: none;
91
- touch-action: none;
92
- }
93
- .ui-resizable {
94
- position: relative;
95
- }
96
- .ui-resizable-handle {
97
- position: absolute;
98
- font-size: 0.1px;
99
- display: block;
100
- -ms-touch-action: none;
101
- touch-action: none;
102
- }
103
- .ui-resizable-disabled .ui-resizable-handle,
104
- .ui-resizable-autohide .ui-resizable-handle {
105
- display: none;
106
- }
107
- .ui-resizable-n {
108
- cursor: n-resize;
109
- height: 7px;
110
- width: 100%;
111
- top: -5px;
112
- left: 0;
113
- }
114
- .ui-resizable-s {
115
- cursor: s-resize;
116
- height: 7px;
117
- width: 100%;
118
- bottom: -5px;
119
- left: 0;
120
- }
121
- .ui-resizable-e {
122
- cursor: e-resize;
123
- width: 7px;
124
- right: -5px;
125
- top: 0;
126
- height: 100%;
127
- }
128
- .ui-resizable-w {
129
- cursor: w-resize;
130
- width: 7px;
131
- left: -5px;
132
- top: 0;
133
- height: 100%;
134
- }
135
- .ui-resizable-se {
136
- cursor: se-resize;
137
- width: 12px;
138
- height: 12px;
139
- right: 1px;
140
- bottom: 1px;
141
- }
142
- .ui-resizable-sw {
143
- cursor: sw-resize;
144
- width: 9px;
145
- height: 9px;
146
- left: -5px;
147
- bottom: -5px;
148
- }
149
- .ui-resizable-nw {
150
- cursor: nw-resize;
151
- width: 9px;
152
- height: 9px;
153
- left: -5px;
154
- top: -5px;
155
- }
156
- .ui-resizable-ne {
157
- cursor: ne-resize;
158
- width: 9px;
159
- height: 9px;
160
- right: -5px;
161
- top: -5px;
162
- }
163
- .ui-button {
164
- display: inline-block;
165
- position: relative;
166
- padding: 0;
167
- line-height: normal;
168
- margin-right: .1em;
169
- cursor: pointer;
170
- vertical-align: middle;
171
- text-align: center;
172
- overflow: visible; /* removes extra width in IE */
173
- }
174
- .ui-button,
175
- .ui-button:link,
176
- .ui-button:visited,
177
- .ui-button:hover,
178
- .ui-button:active {
179
- text-decoration: none;
180
- }
181
- /* to make room for the icon, a width needs to be set here */
182
- .ui-button-icon-only {
183
- width: 2.2em;
184
- }
185
- /* button elements seem to need a little more width */
186
- button.ui-button-icon-only {
187
- width: 2.4em;
188
- }
189
- .ui-button-icons-only {
190
- width: 3.4em;
191
- }
192
- button.ui-button-icons-only {
193
- width: 3.7em;
194
- }
195
-
196
- /* button text element */
197
- .ui-button .ui-button-text {
198
- display: block;
199
- line-height: normal;
200
- }
201
- .ui-button-text-only .ui-button-text {
202
- padding: .4em 1em;
203
- }
204
- .ui-button-icon-only .ui-button-text,
205
- .ui-button-icons-only .ui-button-text {
206
- padding: .4em;
207
- text-indent: -9999999px;
208
- }
209
- .ui-button-text-icon-primary .ui-button-text,
210
- .ui-button-text-icons .ui-button-text {
211
- padding: .4em 1em .4em 2.1em;
212
- }
213
- .ui-button-text-icon-secondary .ui-button-text,
214
- .ui-button-text-icons .ui-button-text {
215
- padding: .4em 2.1em .4em 1em;
216
- }
217
- .ui-button-text-icons .ui-button-text {
218
- padding-left: 2.1em;
219
- padding-right: 2.1em;
220
- }
221
- /* no icon support for input elements, provide padding by default */
222
- input.ui-button {
223
- padding: .4em 1em;
224
- }
225
-
226
- /* button icon element(s) */
227
- .ui-button-icon-only .ui-icon,
228
- .ui-button-text-icon-primary .ui-icon,
229
- .ui-button-text-icon-secondary .ui-icon,
230
- .ui-button-text-icons .ui-icon,
231
- .ui-button-icons-only .ui-icon {
232
- position: absolute;
233
- top: 50%;
234
- margin-top: -8px;
235
- }
236
- .ui-button-icon-only .ui-icon {
237
- left: 50%;
238
- margin-left: -8px;
239
- }
240
- .ui-button-text-icon-primary .ui-button-icon-primary,
241
- .ui-button-text-icons .ui-button-icon-primary,
242
- .ui-button-icons-only .ui-button-icon-primary {
243
- left: .5em;
244
- }
245
- .ui-button-text-icon-secondary .ui-button-icon-secondary,
246
- .ui-button-text-icons .ui-button-icon-secondary,
247
- .ui-button-icons-only .ui-button-icon-secondary {
248
- right: .5em;
249
- }
250
-
251
- /* button sets */
252
- .ui-buttonset {
253
- margin-right: 7px;
254
- }
255
- .ui-buttonset .ui-button {
256
- margin-left: 0;
257
- margin-right: -.3em;
258
- }
259
-
260
- /* workarounds */
261
- /* reset extra padding in Firefox, see h5bp.com/l */
262
- input.ui-button::-moz-focus-inner,
263
- button.ui-button::-moz-focus-inner {
264
- border: 0;
265
- padding: 0;
266
- }
267
- .ui-dialog {
268
- overflow: hidden;
269
- position: absolute;
270
- top: 0;
271
- left: 0;
272
- padding: .2em;
273
- outline: 0;
274
- width: 450px !important;
275
- font-family: "Times New Roman", Times, serif !important;
276
- font-size:16px !important;
277
- z-index:200 !important;
278
-
279
- }
280
- .ui-dialog .ui-dialog-titlebar {
281
- padding: .4em 1em;
282
- position: relative;
283
- }
284
- .ui-dialog .ui-dialog-title {
285
- float: left;
286
- margin: .1em 0;
287
- white-space: nowrap;
288
- width: 90%;
289
- overflow: hidden;
290
- text-overflow: ellipsis;
291
- }
292
- .ui-dialog .ui-dialog-titlebar-close {
293
- position: absolute;
294
- right: .3em;
295
- top: 50%;
296
- width: 20px;
297
- margin: -10px 0 0 0;
298
- padding: 1px;
299
- height: 20px;
300
- }
301
- .ui-dialog .ui-dialog-content {
302
- position: relative;
303
- border: 0;
304
- padding: .5em 1em;
305
- background: none;
306
- overflow: auto;
307
- }
308
- .ui-dialog .ui-dialog-buttonpane {
309
- text-align: left;
310
- border-width: 1px 0 0 0;
311
- background-image: none;
312
- margin-top: .5em;
313
- padding: .3em 1em .5em .4em;
314
- }
315
- .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
316
- float: right;
317
- }
318
- .ui-dialog .ui-dialog-buttonpane button {
319
- margin: .5em .4em .5em 0;
320
- cursor: pointer;
321
- }
322
- .ui-dialog .ui-resizable-se {
323
- width: 12px;
324
- height: 12px;
325
- right: -5px;
326
- bottom: -5px;
327
- background-position: 16px 16px;
328
- }
329
- .ui-draggable .ui-dialog-titlebar {
330
- cursor: move;
331
- }
332
-
333
- /* Component containers
334
- ----------------------------------*/
335
- .ui-widget {
336
- font-family: Verdana,Arial,sans-serif;
337
- font-size: 1.1em;
338
- }
339
- .ui-widget .ui-widget {
340
- font-size: 1em;
341
- }
342
- .ui-widget input,
343
- .ui-widget select,
344
- .ui-widget textarea,
345
- .ui-widget button {
346
- font-family: Verdana,Arial,sans-serif;
347
- font-size: 1em;
348
- }
349
- .ui-widget-content {
350
- border: 1px solid #aaaaaa;
351
- background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
352
- color: #222222;
353
- }
354
- .ui-widget-content a {
355
- color: #222222;
356
- }
357
- .ui-widget-header {
358
- border: 1px solid #aaaaaa;
359
- background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
360
- color: #222222;
361
- font-weight: bold;
362
- }
363
- .ui-widget-header a {
364
- color: #222222;
365
- }
366
-
367
- /* Interaction states
368
- ----------------------------------*/
369
- .ui-state-default,
370
- .ui-widget-content .ui-state-default,
371
- .ui-widget-header .ui-state-default {
372
- border: 1px solid #d3d3d3;
373
- background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;
374
- font-weight: normal;
375
- color: #555555;
376
- }
377
- .ui-state-default a,
378
- .ui-state-default a:link,
379
- .ui-state-default a:visited {
380
- color: #555555;
381
- text-decoration: none;
382
- }
383
- .ui-state-hover,
384
- .ui-widget-content .ui-state-hover,
385
- .ui-widget-header .ui-state-hover,
386
- .ui-state-focus,
387
- .ui-widget-content .ui-state-focus,
388
- .ui-widget-header .ui-state-focus {
389
- border: 1px solid #999999;
390
- background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;
391
- font-weight: normal;
392
- color: #212121;
393
- }
394
- .ui-state-hover a,
395
- .ui-state-hover a:hover,
396
- .ui-state-hover a:link,
397
- .ui-state-hover a:visited,
398
- .ui-state-focus a,
399
- .ui-state-focus a:hover,
400
- .ui-state-focus a:link,
401
- .ui-state-focus a:visited {
402
- color: #212121;
403
- text-decoration: none;
404
- }
405
- .ui-state-active,
406
- .ui-widget-content .ui-state-active,
407
- .ui-widget-header .ui-state-active {
408
- border: 1px solid #aaaaaa;
409
- background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
410
- font-weight: normal;
411
- color: #212121;
412
- }
413
- .ui-state-active a,
414
- .ui-state-active a:link,
415
- .ui-state-active a:visited {
416
- color: #212121;
417
- text-decoration: none;
418
- }
419
-
420
- /* Interaction Cues
421
- ----------------------------------*/
422
- .ui-state-highlight,
423
- .ui-widget-content .ui-state-highlight,
424
- .ui-widget-header .ui-state-highlight {
425
- border: 1px solid #fcefa1;
426
- background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;
427
- color: #363636;
428
- }
429
- .ui-state-highlight a,
430
- .ui-widget-content .ui-state-highlight a,
431
- .ui-widget-header .ui-state-highlight a {
432
- color: #363636;
433
- }
434
- .ui-state-error,
435
- .ui-widget-content .ui-state-error,
436
- .ui-widget-header .ui-state-error {
437
- border: 1px solid #cd0a0a;
438
- background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;
439
- color: #cd0a0a;
440
- }
441
- .ui-state-error a,
442
- .ui-widget-content .ui-state-error a,
443
- .ui-widget-header .ui-state-error a {
444
- color: #cd0a0a;
445
- }
446
- .ui-state-error-text,
447
- .ui-widget-content .ui-state-error-text,
448
- .ui-widget-header .ui-state-error-text {
449
- color: #cd0a0a;
450
- }
451
- .ui-priority-primary,
452
- .ui-widget-content .ui-priority-primary,
453
- .ui-widget-header .ui-priority-primary {
454
- font-weight: bold;
455
- }
456
- .ui-priority-secondary,
457
- .ui-widget-content .ui-priority-secondary,
458
- .ui-widget-header .ui-priority-secondary {
459
- opacity: .7;
460
- filter:Alpha(Opacity=70); /* support: IE8 */
461
- font-weight: normal;
462
- }
463
- .ui-state-disabled,
464
- .ui-widget-content .ui-state-disabled,
465
- .ui-widget-header .ui-state-disabled {
466
- opacity: .35;
467
- filter:Alpha(Opacity=35); /* support: IE8 */
468
- background-image: none;
469
- }
470
- .ui-state-disabled .ui-icon {
471
- filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
472
- }
473
-
474
- /* Icons
475
- ----------------------------------*/
476
-
477
- /* states and images */
478
- .ui-icon {
479
- width: 16px;
480
- height: 16px;
481
- }
482
- .ui-icon,
483
- .ui-widget-content .ui-icon {
484
- background-image: url("images/ui-icons_222222_256x240.png");
485
- }
486
- .ui-widget-header .ui-icon {
487
- background-image: url("images/ui-icons_222222_256x240.png");
488
- }
489
- .ui-state-default .ui-icon {
490
- background-image: url("images/ui-icons_888888_256x240.png");
491
- }
492
- .ui-state-hover .ui-icon,
493
- .ui-state-focus .ui-icon {
494
- background-image: url("images/ui-icons_454545_256x240.png");
495
- }
496
- .ui-state-active .ui-icon {
497
- background-image: url("images/ui-icons_454545_256x240.png");
498
- }
499
- .ui-state-highlight .ui-icon {
500
- background-image: url("images/ui-icons_2e83ff_256x240.png");
501
- }
502
- .ui-state-error .ui-icon,
503
- .ui-state-error-text .ui-icon {
504
- background-image: url("images/ui-icons_cd0a0a_256x240.png");
505
- }
506
-
507
- /* positioning */
508
- .ui-icon-blank { background-position: 16px 16px; }
509
- .ui-icon-carat-1-n { background-position: 0 0; }
510
- .ui-icon-carat-1-ne { background-position: -16px 0; }
511
- .ui-icon-carat-1-e { background-position: -32px 0; }
512
- .ui-icon-carat-1-se { background-position: -48px 0; }
513
- .ui-icon-carat-1-s { background-position: -64px 0; }
514
- .ui-icon-carat-1-sw { background-position: -80px 0; }
515
- .ui-icon-carat-1-w { background-position: -96px 0; }
516
- .ui-icon-carat-1-nw { background-position: -112px 0; }
517
- .ui-icon-carat-2-n-s { background-position: -128px 0; }
518
- .ui-icon-carat-2-e-w { background-position: -144px 0; }
519
- .ui-icon-triangle-1-n { background-position: 0 -16px; }
520
- .ui-icon-triangle-1-ne { background-position: -16px -16px; }
521
- .ui-icon-triangle-1-e { background-position: -32px -16px; }
522
- .ui-icon-triangle-1-se { background-position: -48px -16px; }
523
- .ui-icon-triangle-1-s { background-position: -64px -16px; }
524
- .ui-icon-triangle-1-sw { background-position: -80px -16px; }
525
- .ui-icon-triangle-1-w { background-position: -96px -16px; }
526
- .ui-icon-triangle-1-nw { background-position: -112px -16px; }
527
- .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
528
- .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
529
- .ui-icon-arrow-1-n { background-position: 0 -32px; }
530
- .ui-icon-arrow-1-ne { background-position: -16px -32px; }
531
- .ui-icon-arrow-1-e { background-position: -32px -32px; }
532
- .ui-icon-arrow-1-se { background-position: -48px -32px; }
533
- .ui-icon-arrow-1-s { background-position: -64px -32px; }
534
- .ui-icon-arrow-1-sw { background-position: -80px -32px; }
535
- .ui-icon-arrow-1-w { background-position: -96px -32px; }
536
- .ui-icon-arrow-1-nw { background-position: -112px -32px; }
537
- .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
538
- .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
539
- .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
540
- .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
541
- .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
542
- .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
543
- .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
544
- .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
545
- .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
546
- .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
547
- .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
548
- .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
549
- .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
550
- .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
551
- .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
552
- .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
553
- .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
554
- .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
555
- .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
556
- .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
557
- .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
558
- .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
559
- .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
560
- .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
561
- .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
562
- .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
563
- .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
564
- .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
565
- .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
566
- .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
567
- .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
568
- .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
569
- .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
570
- .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
571
- .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
572
- .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
573
- .ui-icon-arrow-4 { background-position: 0 -80px; }
574
- .ui-icon-arrow-4-diag { background-position: -16px -80px; }
575
- .ui-icon-extlink { background-position: -32px -80px; }
576
- .ui-icon-newwin { background-position: -48px -80px; }
577
- .ui-icon-refresh { background-position: -64px -80px; }
578
- .ui-icon-shuffle { background-position: -80px -80px; }
579
- .ui-icon-transfer-e-w { background-position: -96px -80px; }
580
- .ui-icon-transferthick-e-w { background-position: -112px -80px; }
581
- .ui-icon-folder-collapsed { background-position: 0 -96px; }
582
- .ui-icon-folder-open { background-position: -16px -96px; }
583
- .ui-icon-document { background-position: -32px -96px; }
584
- .ui-icon-document-b { background-position: -48px -96px; }
585
- .ui-icon-note { background-position: -64px -96px; }
586
- .ui-icon-mail-closed { background-position: -80px -96px; }
587
- .ui-icon-mail-open { background-position: -96px -96px; }
588
- .ui-icon-suitcase { background-position: -112px -96px; }
589
- .ui-icon-comment { background-position: -128px -96px; }
590
- .ui-icon-person { background-position: -144px -96px; }
591
- .ui-icon-print { background-position: -160px -96px; }
592
- .ui-icon-trash { background-position: -176px -96px; }
593
- .ui-icon-locked { background-position: -192px -96px; }
594
- .ui-icon-unlocked { background-position: -208px -96px; }
595
- .ui-icon-bookmark { background-position: -224px -96px; }
596
- .ui-icon-tag { background-position: -240px -96px; }
597
- .ui-icon-home { background-position: 0 -112px; }
598
- .ui-icon-flag { background-position: -16px -112px; }
599
- .ui-icon-calendar { background-position: -32px -112px; }
600
- .ui-icon-cart { background-position: -48px -112px; }
601
- .ui-icon-pencil { background-position: -64px -112px; }
602
- .ui-icon-clock { background-position: -80px -112px; }
603
- .ui-icon-disk { background-position: -96px -112px; }
604
- .ui-icon-calculator { background-position: -112px -112px; }
605
- .ui-icon-zoomin { background-position: -128px -112px; }
606
- .ui-icon-zoomout { background-position: -144px -112px; }
607
- .ui-icon-search { background-position: -160px -112px; }
608
- .ui-icon-wrench { background-position: -176px -112px; }
609
- .ui-icon-gear { background-position: -192px -112px; }
610
- .ui-icon-heart { background-position: -208px -112px; }
611
- .ui-icon-star { background-position: -224px -112px; }
612
- .ui-icon-link { background-position: -240px -112px; }
613
- .ui-icon-cancel { background-position: 0 -128px; }
614
- .ui-icon-plus { background-position: -16px -128px; }
615
- .ui-icon-plusthick { background-position: -32px -128px; }
616
- .ui-icon-minus { background-position: -48px -128px; }
617
- .ui-icon-minusthick { background-position: -64px -128px; }
618
- .ui-icon-close { background-position: -80px -128px; }
619
- .ui-icon-closethick { background-position: -96px -128px; }
620
- .ui-icon-key { background-position: -112px -128px; }
621
- .ui-icon-lightbulb { background-position: -128px -128px; }
622
- .ui-icon-scissors { background-position: -144px -128px; }
623
- .ui-icon-clipboard { background-position: -160px -128px; }
624
- .ui-icon-copy { background-position: -176px -128px; }
625
- .ui-icon-contact { background-position: -192px -128px; }
626
- .ui-icon-image { background-position: -208px -128px; }
627
- .ui-icon-video { background-position: -224px -128px; }
628
- .ui-icon-script { background-position: -240px -128px; }
629
- .ui-icon-alert { background-position: 0 -144px; }
630
- .ui-icon-info { background-position: -16px -144px; }
631
- .ui-icon-notice { background-position: -32px -144px; }
632
- .ui-icon-help { background-position: -48px -144px; }
633
- .ui-icon-check { background-position: -64px -144px; }
634
- .ui-icon-bullet { background-position: -80px -144px; }
635
- .ui-icon-radio-on { background-position: -96px -144px; }
636
- .ui-icon-radio-off { background-position: -112px -144px; }
637
- .ui-icon-pin-w { background-position: -128px -144px; }
638
- .ui-icon-pin-s { background-position: -144px -144px; }
639
- .ui-icon-play { background-position: 0 -160px; }
640
- .ui-icon-pause { background-position: -16px -160px; }
641
- .ui-icon-seek-next { background-position: -32px -160px; }
642
- .ui-icon-seek-prev { background-position: -48px -160px; }
643
- .ui-icon-seek-end { background-position: -64px -160px; }
644
- .ui-icon-seek-start { background-position: -80px -160px; }
645
- /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
646
- .ui-icon-seek-first { background-position: -80px -160px; }
647
- .ui-icon-stop { background-position: -96px -160px; }
648
- .ui-icon-eject { background-position: -112px -160px; }
649
- .ui-icon-volume-off { background-position: -128px -160px; }
650
- .ui-icon-volume-on { background-position: -144px -160px; }
651
- .ui-icon-power { background-position: 0 -176px; }
652
- .ui-icon-signal-diag { background-position: -16px -176px; }
653
- .ui-icon-signal { background-position: -32px -176px; }
654
- .ui-icon-battery-0 { background-position: -48px -176px; }
655
- .ui-icon-battery-1 { background-position: -64px -176px; }
656
- .ui-icon-battery-2 { background-position: -80px -176px; }
657
- .ui-icon-battery-3 { background-position: -96px -176px; }
658
- .ui-icon-circle-plus { background-position: 0 -192px; }
659
- .ui-icon-circle-minus { background-position: -16px -192px; }
660
- .ui-icon-circle-close { background-position: -32px -192px; }
661
- .ui-icon-circle-triangle-e { background-position: -48px -192px; }
662
- .ui-icon-circle-triangle-s { background-position: -64px -192px; }
663
- .ui-icon-circle-triangle-w { background-position: -80px -192px; }
664
- .ui-icon-circle-triangle-n { background-position: -96px -192px; }
665
- .ui-icon-circle-arrow-e { background-position: -112px -192px; }
666
- .ui-icon-circle-arrow-s { background-position: -128px -192px; }
667
- .ui-icon-circle-arrow-w { background-position: -144px -192px; }
668
- .ui-icon-circle-arrow-n { background-position: -160px -192px; }
669
- .ui-icon-circle-zoomin { background-position: -176px -192px; }
670
- .ui-icon-circle-zoomout { background-position: -192px -192px; }
671
- .ui-icon-circle-check { background-position: -208px -192px; }
672
- .ui-icon-circlesmall-plus { background-position: 0 -208px; }
673
- .ui-icon-circlesmall-minus { background-position: -16px -208px; }
674
- .ui-icon-circlesmall-close { background-position: -32px -208px; }
675
- .ui-icon-squaresmall-plus { background-position: -48px -208px; }
676
- .ui-icon-squaresmall-minus { background-position: -64px -208px; }
677
- .ui-icon-squaresmall-close { background-position: -80px -208px; }
678
- .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
679
- .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
680
- .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
681
- .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
682
- .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
683
- .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
684
-
685
-
686
- /* Misc visuals
687
- ----------------------------------*/
688
-
689
- /* Corner radius */
690
- .ui-corner-all,
691
- .ui-corner-top,
692
- .ui-corner-left,
693
- .ui-corner-tl {
694
- border-top-left-radius: 4px;
695
- }
696
- .ui-corner-all,
697
- .ui-corner-top,
698
- .ui-corner-right,
699
- .ui-corner-tr {
700
- border-top-right-radius: 4px;
701
- }
702
- .ui-corner-all,
703
- .ui-corner-bottom,
704
- .ui-corner-left,
705
- .ui-corner-bl {
706
- border-bottom-left-radius: 4px;
707
- }
708
- .ui-corner-all,
709
- .ui-corner-bottom,
710
- .ui-corner-right,
711
- .ui-corner-br {
712
- border-bottom-right-radius: 4px;
713
- }
714
-
715
- /* Overlays */
716
- .overlay_back {
717
- position:fixed;
718
- display:none;
719
-
720
- /* color with alpha channel */
721
- background-color: rgba(0, 0, 0, 0.7); /* 0.7 = 70% opacity */
722
-
723
- /* stretch to screen edges */
724
- top: 0;
725
- left: 0;
726
- bottom: 0;
727
- right: 0;
728
- min-height:100%;
729
- width:100%;
730
- z-index:111;
731
- }
732
- .ui-widget-overlay {
733
- background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
734
-
735
- }
736
- .ui-widget-shadow {
737
- margin: -8px 0 0 -8px;
738
- padding: 8px;
739
- background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
740
- opacity: .3;
741
- filter: Alpha(Opacity=30); /* support: IE8 */
742
- border-radius: 8px;
743
- }
744
- .ui-datepicker {
745
- width: 17em;
746
- padding: .2em .2em 0;
747
- display: none;
748
- }
749
- .ui-datepicker .ui-datepicker-header {
750
- position: relative;
751
- padding: .2em 0;
752
- }
753
- .ui-datepicker .ui-datepicker-prev,
754
- .ui-datepicker .ui-datepicker-next {
755
- position: absolute;
756
- top: 2px;
757
- width: 1.8em;
758
- height: 1.8em;
759
- }
760
- .ui-datepicker .ui-datepicker-prev-hover,
761
- .ui-datepicker .ui-datepicker-next-hover {
762
- top: 1px;
763
- }
764
- .ui-datepicker .ui-datepicker-prev {
765
- left: 2px;
766
- }
767
- .ui-datepicker .ui-datepicker-next {
768
- right: 2px;
769
- }
770
- .ui-datepicker .ui-datepicker-prev-hover {
771
- left: 1px;
772
- }
773
- .ui-datepicker .ui-datepicker-next-hover {
774
- right: 1px;
775
- }
776
- .ui-datepicker .ui-datepicker-prev span,
777
- .ui-datepicker .ui-datepicker-next span {
778
- display: block;
779
- position: absolute;
780
- left: 50%;
781
- margin-left: -8px;
782
- top: 50%;
783
- margin-top: -8px;
784
- }
785
- .ui-datepicker .ui-datepicker-title {
786
- margin: 0 2.3em;
787
- line-height: 1.8em;
788
- text-align: center;
789
- }
790
- .ui-datepicker .ui-datepicker-title select {
791
- font-size: 1em;
792
- margin: 1px 0;
793
- }
794
- .ui-datepicker select.ui-datepicker-month,
795
- .ui-datepicker select.ui-datepicker-year {
796
- width: 45%;
797
- }
798
- .ui-datepicker table {
799
- width: 100%;
800
- font-size: .9em;
801
- border-collapse: collapse;
802
- margin: 0 0 .4em;
803
- }
804
- .ui-datepicker th {
805
- padding: .7em .3em;
806
- text-align: center;
807
- font-weight: bold;
808
- border: 0;
809
- }
810
- .ui-datepicker td {
811
- border: 0;
812
- padding: 1px;
813
- }
814
- .ui-datepicker td span,
815
- .ui-datepicker td a {
816
- display: block;
817
- padding: .2em;
818
- text-align: right;
819
- text-decoration: none;
820
- }
821
- .ui-datepicker .ui-datepicker-buttonpane {
822
- background-image: none;
823
- margin: .7em 0 0 0;
824
- padding: 0 .2em;
825
- border-left: 0;
826
- border-right: 0;
827
- border-bottom: 0;
828
- }
829
- .ui-datepicker .ui-datepicker-buttonpane button {
830
- float: right;
831
- margin: .5em .2em .4em;
832
- cursor: pointer;
833
- padding: .2em .6em .3em .6em;
834
- width: auto;
835
- overflow: visible;
836
- }
837
- .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
838
- float: left;
839
- }
840
-
841
- /* with multiple calendars */
842
- .ui-datepicker.ui-datepicker-multi {
843
- width: auto;
844
- }
845
- .ui-datepicker-multi .ui-datepicker-group {
846
- float: left;
847
- }
848
- .ui-datepicker-multi .ui-datepicker-group table {
849
- width: 95%;
850
- margin: 0 auto .4em;
851
- }
852
- .ui-datepicker-multi-2 .ui-datepicker-group {
853
- width: 50%;
854
- }
855
- .ui-datepicker-multi-3 .ui-datepicker-group {
856
- width: 33.3%;
857
- }
858
- .ui-datepicker-multi-4 .ui-datepicker-group {
859
- width: 25%;
860
- }
861
- .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
862
- .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
863
- border-left-width: 0;
864
- }
865
- .ui-datepicker-multi .ui-datepicker-buttonpane {
866
- clear: left;
867
- }
868
- .ui-datepicker-row-break {
869
- clear: both;
870
- width: 100%;
871
- font-size: 0;
872
- }
873
-
874
- /* RTL support */
875
- .ui-datepicker-rtl {
876
- direction: rtl;
877
- }
878
- .ui-datepicker-rtl .ui-datepicker-prev {
879
- right: 2px;
880
- left: auto;
881
- }
882
- .ui-datepicker-rtl .ui-datepicker-next {
883
- left: 2px;
884
- right: auto;
885
- }
886
- .ui-datepicker-rtl .ui-datepicker-prev:hover {
887
- right: 1px;
888
- left: auto;
889
- }
890
- .ui-datepicker-rtl .ui-datepicker-next:hover {
891
- left: 1px;
892
- right: auto;
893
- }
894
- .ui-datepicker-rtl .ui-datepicker-buttonpane {
895
- clear: right;
896
- }
897
- .ui-datepicker-rtl .ui-datepicker-buttonpane button {
898
- float: left;
899
- }
900
- .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
901
- .ui-datepicker-rtl .ui-datepicker-group {
902
- float: right;
903
- }
904
- .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
905
- .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
906
- border-right-width: 0;
907
- border-left-width: 1px;
908
- }
909
-
910
- /* Icons */
911
- .ui-datepicker .ui-icon {
912
- display: block;
913
- text-indent: -99999px;
914
- overflow: hidden;
915
- background-repeat: no-repeat;
916
- left: .5em;
917
- top: .3em;
918
  }
1
+ /*! jQuery UI - v1.11.4 - 2015-07-30
2
+ * http://jqueryui.com
3
+ * Includes: core.css, draggable.css, resizable.css, button.css, dialog.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/
5
+ * Copyright 2015 jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ /* Layout helpers
8
+ ----------------------------------*/
9
+ .ui-helper-hidden {
10
+ display: none;
11
+ }
12
+ .ui-helper-hidden-accessible {
13
+ border: 0;
14
+ clip: rect(0 0 0 0);
15
+ height: 1px;
16
+ margin: -1px;
17
+ overflow: hidden;
18
+ padding: 0;
19
+ position: absolute;
20
+ width: 1px;
21
+ }
22
+ .ui-helper-reset {
23
+ margin: 0;
24
+ padding: 0;
25
+ border: 0;
26
+ outline: 0;
27
+ line-height: 1.3;
28
+ text-decoration: none;
29
+ font-size: 100%;
30
+ list-style: none;
31
+ }
32
+ .ui-helper-clearfix:before,
33
+ .ui-helper-clearfix:after {
34
+ content: "";
35
+ display: table;
36
+ border-collapse: collapse;
37
+ }
38
+ .ui-helper-clearfix:after {
39
+ clear: both;
40
+ }
41
+ .ui-helper-clearfix {
42
+ min-height: 0; /* support: IE7 */
43
+ }
44
+ .ui-helper-zfix {
45
+ width: 100%;
46
+ height: 100%;
47
+ top: 0;
48
+ left: 0;
49
+ position: absolute;
50
+ opacity: 0;
51
+ filter:Alpha(Opacity=0); /* support: IE8 */
52
+ }
53
+
54
+ .ui-front {
55
+ z-index: 100;
56
+ }
57
+
58
+
59
+ /* Interaction Cues
60
+ ----------------------------------*/
61
+ .ui-state-disabled {
62
+ cursor: default !important;
63
+ }
64
+
65
+
66
+ /* Icons
67
+ ----------------------------------*/
68
+
69
+ /* states and images */
70
+ .ui-icon {
71
+ display: block;
72
+ text-indent: -99999px;
73
+ overflow: hidden;
74
+ background-repeat: no-repeat;
75
+ }
76
+
77
+
78
+ /* Misc visuals
79
+ ----------------------------------*/
80
+
81
+ /* Overlays */
82
+ .ui-widget-overlay {
83
+ position: fixed;
84
+ top: 0;
85
+ left: 0;
86
+ width: 100%;
87
+ height: 100%;
88
+ }
89
+ .ui-draggable-handle {
90
+ -ms-touch-action: none;
91
+ touch-action: none;
92
+ }
93
+ .ui-resizable {
94
+ position: relative;
95
+ }
96
+ .ui-resizable-handle {
97
+ position: absolute;
98
+ font-size: 0.1px;
99
+ display: block;
100
+ -ms-touch-action: none;
101
+ touch-action: none;
102
+ }
103
+ .ui-resizable-disabled .ui-resizable-handle,
104
+ .ui-resizable-autohide .ui-resizable-handle {
105
+ display: none;
106
+ }
107
+ .ui-resizable-n {
108
+ cursor: n-resize;
109
+ height: 7px;
110
+ width: 100%;
111
+ top: -5px;
112
+ left: 0;
113
+ }
114
+ .ui-resizable-s {
115
+ cursor: s-resize;
116
+ height: 7px;
117
+ width: 100%;
118
+ bottom: -5px;
119
+ left: 0;
120
+ }
121
+ .ui-resizable-e {
122
+ cursor: e-resize;
123
+ width: 7px;
124
+ right: -5px;
125
+ top: 0;
126
+ height: 100%;
127
+ }
128
+ .ui-resizable-w {
129
+ cursor: w-resize;
130
+ width: 7px;
131
+ left: -5px;
132
+ top: 0;
133
+ height: 100%;
134
+ }
135
+ .ui-resizable-se {
136
+ cursor: se-resize;
137
+ width: 12px;
138
+ height: 12px;
139
+ right: 1px;
140
+ bottom: 1px;
141
+ }
142
+ .ui-resizable-sw {
143
+ cursor: sw-resize;
144
+ width: 9px;
145
+ height: 9px;
146
+ left: -5px;
147
+ bottom: -5px;
148
+ }
149
+ .ui-resizable-nw {
150
+ cursor: nw-resize;
151
+ width: 9px;
152
+ height: 9px;
153
+ left: -5px;
154
+ top: -5px;
155
+ }
156
+ .ui-resizable-ne {
157
+ cursor: ne-resize;
158
+ width: 9px;
159
+ height: 9px;
160
+ right: -5px;
161
+ top: -5px;
162
+ }
163
+ .ui-button {
164
+ display: inline-block;
165
+ position: relative;
166
+ padding: 0;
167
+ line-height: normal;
168
+ margin-right: .1em;
169
+ cursor: pointer;
170
+ vertical-align: middle;
171
+ text-align: center;
172
+ overflow: visible; /* removes extra width in IE */
173
+ }
174
+ .ui-button,
175
+ .ui-button:link,
176
+ .ui-button:visited,
177
+ .ui-button:hover,
178
+ .ui-button:active {
179
+ text-decoration: none;
180
+ }
181
+ /* to make room for the icon, a width needs to be set here */
182
+ .ui-button-icon-only {
183
+ width: 2.2em;
184
+ }
185
+ /* button elements seem to need a little more width */
186
+ button.ui-button-icon-only {
187
+ width: 2.4em;
188
+ }
189
+ .ui-button-icons-only {
190
+ width: 3.4em;
191
+ }
192
+ button.ui-button-icons-only {
193
+ width: 3.7em;
194
+ }
195
+
196
+ /* button text element */
197
+ .ui-button .ui-button-text {
198
+ display: block;
199
+ line-height: normal;
200
+ }
201
+ .ui-button-text-only .ui-button-text {
202
+ padding: .4em 1em;
203
+ }
204
+ .ui-button-icon-only .ui-button-text,
205
+ .ui-button-icons-only .ui-button-text {
206
+ padding: .4em;
207
+ text-indent: -9999999px;
208
+ }
209
+ .ui-button-text-icon-primary .ui-button-text,
210
+ .ui-button-text-icons .ui-button-text {
211
+ padding: .4em 1em .4em 2.1em;
212
+ }
213
+ .ui-button-text-icon-secondary .ui-button-text,
214
+ .ui-button-text-icons .ui-button-text {
215
+ padding: .4em 2.1em .4em 1em;
216
+ }
217
+ .ui-button-text-icons .ui-button-text {
218
+ padding-left: 2.1em;
219
+ padding-right: 2.1em;
220
+ }
221
+ /* no icon support for input elements, provide padding by default */
222
+ input.ui-button {
223
+ padding: .4em 1em;
224
+ }
225
+
226
+ /* button icon element(s) */
227
+ .ui-button-icon-only .ui-icon,
228
+ .ui-button-text-icon-primary .ui-icon,
229
+ .ui-button-text-icon-secondary .ui-icon,
230
+ .ui-button-text-icons .ui-icon,
231
+ .ui-button-icons-only .ui-icon {
232
+ position: absolute;
233
+ top: 50%;
234
+ margin-top: -8px;
235
+ }
236
+ .ui-button-icon-only .ui-icon {
237
+ left: 50%;
238
+ margin-left: -8px;
239
+ }
240
+ .ui-button-text-icon-primary .ui-button-icon-primary,
241
+ .ui-button-text-icons .ui-button-icon-primary,
242
+ .ui-button-icons-only .ui-button-icon-primary {
243
+ left: .5em;
244
+ }
245
+ .ui-button-text-icon-secondary .ui-button-icon-secondary,
246
+ .ui-button-text-icons .ui-button-icon-secondary,
247
+ .ui-button-icons-only .ui-button-icon-secondary {
248
+ right: .5em;
249
+ }
250
+
251
+ /* button sets */
252
+ .ui-buttonset {
253
+ margin-right: 7px;
254
+ }
255
+ .ui-buttonset .ui-button {
256
+ margin-left: 0;
257
+ margin-right: -.3em;
258
+ }
259
+
260
+ /* workarounds */
261
+ /* reset extra padding in Firefox, see h5bp.com/l */
262
+ input.ui-button::-moz-focus-inner,
263
+ button.ui-button::-moz-focus-inner {
264
+ border: 0;
265
+ padding: 0;
266
+ }
267
+ .ui-dialog {
268
+ overflow: hidden;
269
+ position: absolute;
270
+ top: 0;
271
+ left: 0;
272
+ padding: .2em;
273
+ outline: 0;
274
+ width: 450px !important;
275
+ font-family: "Times New Roman", Times, serif !important;
276
+ font-size:16px !important;
277
+ z-index:200 !important;
278
+
279
+ }
280
+ .ui-dialog .ui-dialog-titlebar {
281
+ padding: .4em 1em;
282
+ position: relative;
283
+ }
284
+ .ui-dialog .ui-dialog-title {
285
+ float: left;
286
+ margin: .1em 0;
287
+ white-space: nowrap;
288
+ width: 90%;
289
+ overflow: hidden;
290
+ text-overflow: ellipsis;
291
+ }
292
+ .ui-dialog .ui-dialog-titlebar-close {
293
+ position: absolute;
294
+ right: .3em;
295
+ top: 50%;
296
+ width: 20px;
297
+ margin: -10px 0 0 0;
298
+ padding: 1px;
299
+ height: 20px;
300
+ }
301
+ .ui-dialog .ui-dialog-content {
302
+ position: relative;
303
+ border: 0;
304
+ padding: .5em 1em;
305
+ background: none;
306
+ overflow: auto;
307
+ }
308
+ .ui-dialog .ui-dialog-buttonpane {
309
+ text-align: left;
310
+ border-width: 1px 0 0 0;
311
+ background-image: none;
312
+ margin-top: .5em;
313
+ padding: .3em 1em .5em .4em;
314
+ }
315
+ .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset {
316
+ float: right;
317
+ }
318
+ .ui-dialog .ui-dialog-buttonpane button {
319
+ margin: .5em .4em .5em 0;
320
+ cursor: pointer;
321
+ }
322
+ .ui-dialog .ui-resizable-se {
323
+ width: 12px;
324
+ height: 12px;
325
+ right: -5px;
326
+ bottom: -5px;
327
+ background-position: 16px 16px;
328
+ }
329
+ .ui-draggable .ui-dialog-titlebar {
330
+ cursor: move;
331
+ }
332
+
333
+ /* Component containers
334
+ ----------------------------------*/
335
+ .ui-widget {
336
+ font-family: Verdana,Arial,sans-serif;
337
+ font-size: 1.1em;
338
+ }
339
+ .ui-widget .ui-widget {
340
+ font-size: 1em;
341
+ }
342
+ .ui-widget input,
343
+ .ui-widget select,
344
+ .ui-widget textarea,
345
+ .ui-widget button {
346
+ font-family: Verdana,Arial,sans-serif;
347
+ font-size: 1em;
348
+ }
349
+ .ui-widget-content {
350
+ border: 1px solid #aaaaaa;
351
+ background: #ffffff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;
352
+ color: #222222;
353
+ }
354
+ .ui-widget-content a {
355
+ color: #222222;
356
+ }
357
+ .ui-widget-header {
358
+ border: 1px solid #aaaaaa;
359
+ background: #cccccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;
360
+ color: #222222;
361
+ font-weight: bold;
362
+ }
363
+ .ui-widget-header a {
364
+ color: #222222;
365
+ }
366
+
367
+ /* Interaction states
368
+ ----------------------------------*/
369
+ .ui-state-default,
370
+ .ui-widget-content .ui-state-default,
371
+ .ui-widget-header .ui-state-default {
372
+ border: 1px solid #d3d3d3;
373
+ background: #e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;
374
+ font-weight: normal;
375
+ color: #555555;
376
+ }
377
+ .ui-state-default a,
378
+ .ui-state-default a:link,
379
+ .ui-state-default a:visited {
380
+ color: #555555;
381
+ text-decoration: none;
382
+ }
383
+ .ui-state-hover,
384
+ .ui-widget-content .ui-state-hover,
385
+ .ui-widget-header .ui-state-hover,
386
+ .ui-state-focus,
387
+ .ui-widget-content .ui-state-focus,
388
+ .ui-widget-header .ui-state-focus {
389
+ border: 1px solid #999999;
390
+ background: #dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;
391
+ font-weight: normal;
392
+ color: #212121;
393
+ }
394
+ .ui-state-hover a,
395
+ .ui-state-hover a:hover,
396
+ .ui-state-hover a:link,
397
+ .ui-state-hover a:visited,
398
+ .ui-state-focus a,
399
+ .ui-state-focus a:hover,
400
+ .ui-state-focus a:link,
401
+ .ui-state-focus a:visited {
402
+ color: #212121;
403
+ text-decoration: none;
404
+ }
405
+ .ui-state-active,
406
+ .ui-widget-content .ui-state-active,
407
+ .ui-widget-header .ui-state-active {
408
+ border: 1px solid #aaaaaa;
409
+ background: #ffffff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;
410
+ font-weight: normal;
411
+ color: #212121;
412
+ }
413
+ .ui-state-active a,
414
+ .ui-state-active a:link,
415
+ .ui-state-active a:visited {
416
+ color: #212121;
417
+ text-decoration: none;
418
+ }
419
+
420
+ /* Interaction Cues
421
+ ----------------------------------*/
422
+ .ui-state-highlight,
423
+ .ui-widget-content .ui-state-highlight,
424
+ .ui-widget-header .ui-state-highlight {
425
+ border: 1px solid #fcefa1;
426
+ background: #fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;
427
+ color: #363636;
428
+ }
429
+ .ui-state-highlight a,
430
+ .ui-widget-content .ui-state-highlight a,
431
+ .ui-widget-header .ui-state-highlight a {
432
+ color: #363636;
433
+ }
434
+ .ui-state-error,
435
+ .ui-widget-content .ui-state-error,
436
+ .ui-widget-header .ui-state-error {
437
+ border: 1px solid #cd0a0a;
438
+ background: #fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;
439
+ color: #cd0a0a;
440
+ }
441
+ .ui-state-error a,
442
+ .ui-widget-content .ui-state-error a,
443
+ .ui-widget-header .ui-state-error a {
444
+ color: #cd0a0a;
445
+ }
446
+ .ui-state-error-text,
447
+ .ui-widget-content .ui-state-error-text,
448
+ .ui-widget-header .ui-state-error-text {
449
+ color: #cd0a0a;
450
+ }
451
+ .ui-priority-primary,
452
+ .ui-widget-content .ui-priority-primary,
453
+ .ui-widget-header .ui-priority-primary {
454
+ font-weight: bold;
455
+ }
456
+ .ui-priority-secondary,
457
+ .ui-widget-content .ui-priority-secondary,
458
+ .ui-widget-header .ui-priority-secondary {
459
+ opacity: .7;
460
+ filter:Alpha(Opacity=70); /* support: IE8 */
461
+ font-weight: normal;
462
+ }
463
+ .ui-state-disabled,
464
+ .ui-widget-content .ui-state-disabled,
465
+ .ui-widget-header .ui-state-disabled {
466
+ opacity: .35;
467
+ filter:Alpha(Opacity=35); /* support: IE8 */
468
+ background-image: none;
469
+ }
470
+ .ui-state-disabled .ui-icon {
471
+ filter:Alpha(Opacity=35); /* support: IE8 - See #6059 */
472
+ }
473
+
474
+ /* Icons
475
+ ----------------------------------*/
476
+
477
+ /* states and images */
478
+ .ui-icon {
479
+ width: 16px;
480
+ height: 16px;
481
+ }
482
+ .ui-icon,
483
+ .ui-widget-content .ui-icon {
484
+ background-image: url("images/ui-icons_222222_256x240.png");
485
+ }
486
+ .ui-widget-header .ui-icon {
487
+ background-image: url("images/ui-icons_222222_256x240.png");
488
+ }
489
+ .ui-state-default .ui-icon {
490
+ background-image: url("images/ui-icons_888888_256x240.png");
491
+ }
492
+ .ui-state-hover .ui-icon,
493
+ .ui-state-focus .ui-icon {
494
+ background-image: url("images/ui-icons_454545_256x240.png");
495
+ }
496
+ .ui-state-active .ui-icon {
497
+ background-image: url("images/ui-icons_454545_256x240.png");
498
+ }
499
+ .ui-state-highlight .ui-icon {
500
+ background-image: url("images/ui-icons_2e83ff_256x240.png");
501
+ }
502
+ .ui-state-error .ui-icon,
503
+ .ui-state-error-text .ui-icon {
504
+ background-image: url("images/ui-icons_cd0a0a_256x240.png");
505
+ }
506
+
507
+ /* positioning */
508
+ .ui-icon-blank { background-position: 16px 16px; }
509
+ .ui-icon-carat-1-n { background-position: 0 0; }
510
+ .ui-icon-carat-1-ne { background-position: -16px 0; }
511
+ .ui-icon-carat-1-e { background-position: -32px 0; }
512
+ .ui-icon-carat-1-se { background-position: -48px 0; }
513
+ .ui-icon-carat-1-s { background-position: -64px 0; }
514
+ .ui-icon-carat-1-sw { background-position: -80px 0; }
515
+ .ui-icon-carat-1-w { background-position: -96px 0; }
516
+ .ui-icon-carat-1-nw { background-position: -112px 0; }
517
+ .ui-icon-carat-2-n-s { background-position: -128px 0; }
518
+ .ui-icon-carat-2-e-w { background-position: -144px 0; }
519
+ .ui-icon-triangle-1-n { background-position: 0 -16px; }
520
+ .ui-icon-triangle-1-ne { background-position: -16px -16px; }
521
+ .ui-icon-triangle-1-e { background-position: -32px -16px; }
522
+ .ui-icon-triangle-1-se { background-position: -48px -16px; }
523
+ .ui-icon-triangle-1-s { background-position: -64px -16px; }
524
+ .ui-icon-triangle-1-sw { background-position: -80px -16px; }
525
+ .ui-icon-triangle-1-w { background-position: -96px -16px; }
526
+ .ui-icon-triangle-1-nw { background-position: -112px -16px; }
527
+ .ui-icon-triangle-2-n-s { background-position: -128px -16px; }
528
+ .ui-icon-triangle-2-e-w { background-position: -144px -16px; }
529
+ .ui-icon-arrow-1-n { background-position: 0 -32px; }
530
+ .ui-icon-arrow-1-ne { background-position: -16px -32px; }
531
+ .ui-icon-arrow-1-e { background-position: -32px -32px; }
532
+ .ui-icon-arrow-1-se { background-position: -48px -32px; }
533
+ .ui-icon-arrow-1-s { background-position: -64px -32px; }
534
+ .ui-icon-arrow-1-sw { background-position: -80px -32px; }
535
+ .ui-icon-arrow-1-w { background-position: -96px -32px; }
536
+ .ui-icon-arrow-1-nw { background-position: -112px -32px; }
537
+ .ui-icon-arrow-2-n-s { background-position: -128px -32px; }
538
+ .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
539
+ .ui-icon-arrow-2-e-w { background-position: -160px -32px; }
540
+ .ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
541
+ .ui-icon-arrowstop-1-n { background-position: -192px -32px; }
542
+ .ui-icon-arrowstop-1-e { background-position: -208px -32px; }
543
+ .ui-icon-arrowstop-1-s { background-position: -224px -32px; }
544
+ .ui-icon-arrowstop-1-w { background-position: -240px -32px; }
545
+ .ui-icon-arrowthick-1-n { background-position: 0 -48px; }
546
+ .ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
547
+ .ui-icon-arrowthick-1-e { background-position: -32px -48px; }
548
+ .ui-icon-arrowthick-1-se { background-position: -48px -48px; }
549
+ .ui-icon-arrowthick-1-s { background-position: -64px -48px; }
550
+ .ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
551
+ .ui-icon-arrowthick-1-w { background-position: -96px -48px; }
552
+ .ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
553
+ .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
554
+ .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
555
+ .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
556
+ .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
557
+ .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
558
+ .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
559
+ .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
560
+ .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
561
+ .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
562
+ .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
563
+ .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
564
+ .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
565
+ .ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
566
+ .ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
567
+ .ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
568
+ .ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
569
+ .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
570
+ .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
571
+ .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
572
+ .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
573
+ .ui-icon-arrow-4 { background-position: 0 -80px; }
574
+ .ui-icon-arrow-4-diag { background-position: -16px -80px; }
575
+ .ui-icon-extlink { background-position: -32px -80px; }
576
+ .ui-icon-newwin { background-position: -48px -80px; }
577
+ .ui-icon-refresh { background-position: -64px -80px; }
578
+ .ui-icon-shuffle { background-position: -80px -80px; }
579
+ .ui-icon-transfer-e-w { background-position: -96px -80px; }
580
+ .ui-icon-transferthick-e-w { background-position: -112px -80px; }
581
+ .ui-icon-folder-collapsed { background-position: 0 -96px; }
582
+ .ui-icon-folder-open { background-position: -16px -96px; }
583
+ .ui-icon-document { background-position: -32px -96px; }
584
+ .ui-icon-document-b { background-position: -48px -96px; }
585
+ .ui-icon-note { background-position: -64px -96px; }
586
+ .ui-icon-mail-closed { background-position: -80px -96px; }
587
+ .ui-icon-mail-open { background-position: -96px -96px; }
588
+ .ui-icon-suitcase { background-position: -112px -96px; }
589
+ .ui-icon-comment { background-position: -128px -96px; }
590
+ .ui-icon-person { background-position: -144px -96px; }
591
+ .ui-icon-print { background-position: -160px -96px; }
592
+ .ui-icon-trash { background-position: -176px -96px; }
593
+ .ui-icon-locked { background-position: -192px -96px; }
594
+ .ui-icon-unlocked { background-position: -208px -96px; }
595
+ .ui-icon-bookmark { background-position: -224px -96px; }
596
+ .ui-icon-tag { background-position: -240px -96px; }
597
+ .ui-icon-home { background-position: 0 -112px; }
598
+ .ui-icon-flag { background-position: -16px -112px; }
599
+ .ui-icon-calendar { background-position: -32px -112px; }
600
+ .ui-icon-cart { background-position: -48px -112px; }
601
+ .ui-icon-pencil { background-position: -64px -112px; }
602
+ .ui-icon-clock { background-position: -80px -112px; }
603
+ .ui-icon-disk { background-position: -96px -112px; }
604
+ .ui-icon-calculator { background-position: -112px -112px; }
605
+ .ui-icon-zoomin { background-position: -128px -112px; }
606
+ .ui-icon-zoomout { background-position: -144px -112px; }
607
+ .ui-icon-search { background-position: -160px -112px; }
608
+ .ui-icon-wrench { background-position: -176px -112px; }
609
+ .ui-icon-gear { background-position: -192px -112px; }
610
+ .ui-icon-heart { background-position: -208px -112px; }
611
+ .ui-icon-star { background-position: -224px -112px; }
612
+ .ui-icon-link { background-position: -240px -112px; }
613
+ .ui-icon-cancel { background-position: 0 -128px; }
614
+ .ui-icon-plus { background-position: -16px -128px; }
615
+ .ui-icon-plusthick { background-position: -32px -128px; }
616
+ .ui-icon-minus { background-position: -48px -128px; }
617
+ .ui-icon-minusthick { background-position: -64px -128px; }
618
+ .ui-icon-close { background-position: -80px -128px; }
619
+ .ui-icon-closethick { background-position: -96px -128px; }
620
+ .ui-icon-key { background-position: -112px -128px; }
621
+ .ui-icon-lightbulb { background-position: -128px -128px; }
622
+ .ui-icon-scissors { background-position: -144px -128px; }
623
+ .ui-icon-clipboard { background-position: -160px -128px; }
624
+ .ui-icon-copy { background-position: -176px -128px; }
625
+ .ui-icon-contact { background-position: -192px -128px; }
626
+ .ui-icon-image { background-position: -208px -128px; }
627
+ .ui-icon-video { background-position: -224px -128px; }
628
+ .ui-icon-script { background-position: -240px -128px; }
629
+ .ui-icon-alert { background-position: 0 -144px; }
630
+ .ui-icon-info { background-position: -16px -144px; }
631
+ .ui-icon-notice { background-position: -32px -144px; }
632
+ .ui-icon-help { background-position: -48px -144px; }
633
+ .ui-icon-check { background-position: -64px -144px; }
634
+ .ui-icon-bullet { background-position: -80px -144px; }
635
+ .ui-icon-radio-on { background-position: -96px -144px; }
636
+ .ui-icon-radio-off { background-position: -112px -144px; }
637
+ .ui-icon-pin-w { background-position: -128px -144px; }
638
+ .ui-icon-pin-s { background-position: -144px -144px; }
639
+ .ui-icon-play { background-position: 0 -160px; }
640
+ .ui-icon-pause { background-position: -16px -160px; }
641
+ .ui-icon-seek-next { background-position: -32px -160px; }
642
+ .ui-icon-seek-prev { background-position: -48px -160px; }
643
+ .ui-icon-seek-end { background-position: -64px -160px; }
644
+ .ui-icon-seek-start { background-position: -80px -160px; }
645
+ /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
646
+ .ui-icon-seek-first { background-position: -80px -160px; }
647
+ .ui-icon-stop { background-position: -96px -160px; }
648
+ .ui-icon-eject { background-position: -112px -160px; }
649
+ .ui-icon-volume-off { background-position: -128px -160px; }
650
+ .ui-icon-volume-on { background-position: -144px -160px; }
651
+ .ui-icon-power { background-position: 0 -176px; }
652
+ .ui-icon-signal-diag { background-position: -16px -176px; }
653
+ .ui-icon-signal { background-position: -32px -176px; }
654
+ .ui-icon-battery-0 { background-position: -48px -176px; }
655
+ .ui-icon-battery-1 { background-position: -64px -176px; }
656
+ .ui-icon-battery-2 { background-position: -80px -176px; }
657
+ .ui-icon-battery-3 { background-position: -96px -176px; }
658
+ .ui-icon-circle-plus { background-position: 0 -192px; }
659
+ .ui-icon-circle-minus { background-position: -16px -192px; }
660
+ .ui-icon-circle-close { background-position: -32px -192px; }
661
+ .ui-icon-circle-triangle-e { background-position: -48px -192px; }
662
+ .ui-icon-circle-triangle-s { background-position: -64px -192px; }
663
+ .ui-icon-circle-triangle-w { background-position: -80px -192px; }
664
+ .ui-icon-circle-triangle-n { background-position: -96px -192px; }
665
+ .ui-icon-circle-arrow-e { background-position: -112px -192px; }
666
+ .ui-icon-circle-arrow-s { background-position: -128px -192px; }
667
+ .ui-icon-circle-arrow-w { background-position: -144px -192px; }
668
+ .ui-icon-circle-arrow-n { background-position: -160px -192px; }
669
+ .ui-icon-circle-zoomin { background-position: -176px -192px; }
670
+ .ui-icon-circle-zoomout { background-position: -192px -192px; }
671
+ .ui-icon-circle-check { background-position: -208px -192px; }
672
+ .ui-icon-circlesmall-plus { background-position: 0 -208px; }
673
+ .ui-icon-circlesmall-minus { background-position: -16px -208px; }
674
+ .ui-icon-circlesmall-close { background-position: -32px -208px; }
675
+ .ui-icon-squaresmall-plus { background-position: -48px -208px; }
676
+ .ui-icon-squaresmall-minus { background-position: -64px -208px; }
677
+ .ui-icon-squaresmall-close { background-position: -80px -208px; }
678
+ .ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
679
+ .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
680
+ .ui-icon-grip-solid-vertical { background-position: -32px -224px; }
681
+ .ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
682
+ .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
683
+ .ui-icon-grip-diagonal-se { background-position: -80px -224px; }
684
+
685
+
686
+ /* Misc visuals
687
+ ----------------------------------*/
688
+
689
+ /* Corner radius */
690
+ .ui-corner-all,
691
+ .ui-corner-top,
692
+ .ui-corner-left,
693
+ .ui-corner-tl {
694
+ border-top-left-radius: 4px;
695
+ }
696
+ .ui-corner-all,
697
+ .ui-corner-top,
698
+ .ui-corner-right,
699
+ .ui-corner-tr {
700
+ border-top-right-radius: 4px;
701
+ }
702
+ .ui-corner-all,
703
+ .ui-corner-bottom,
704
+ .ui-corner-left,
705
+ .ui-corner-bl {
706
+ border-bottom-left-radius: 4px;
707
+ }
708
+ .ui-corner-all,
709
+ .ui-corner-bottom,
710
+ .ui-corner-right,
711
+ .ui-corner-br {
712
+ border-bottom-right-radius: 4px;
713
+ }
714
+
715
+ /* Overlays */
716
+ .overlay_back {
717
+ position:fixed;
718
+ display:none;
719
+
720
+ /* color with alpha channel */
721
+ background-color: rgba(0, 0, 0, 0.7); /* 0.7 = 70% opacity */
722
+
723
+ /* stretch to screen edges */
724
+ top: 0;
725
+ left: 0;
726
+ bottom: 0;
727
+ right: 0;
728
+ min-height:100%;
729
+ width:100%;
730
+ z-index:111;
731
+ }
732
+ .ui-widget-overlay {
733
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
734
+
735
+ }
736
+ .ui-widget-shadow {
737
+ margin: -8px 0 0 -8px;
738
+ padding: 8px;
739
+ background: #aaaaaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;
740
+ opacity: .3;
741
+ filter: Alpha(Opacity=30); /* support: IE8 */
742
+ border-radius: 8px;
743
+ }
744
+ .ui-datepicker {
745
+ width: 17em;
746
+ padding: .2em .2em 0;
747
+ display: none;
748
+ }
749
+ .ui-datepicker .ui-datepicker-header {
750
+ position: relative;
751
+ padding: .2em 0;
752
+ }
753
+ .ui-datepicker .ui-datepicker-prev,
754
+ .ui-datepicker .ui-datepicker-next {
755
+ position: absolute;
756
+ top: 2px;
757
+ width: 1.8em;
758
+ height: 1.8em;
759
+ }
760
+ .ui-datepicker .ui-datepicker-prev-hover,
761
+ .ui-datepicker .ui-datepicker-next-hover {
762
+ top: 1px;
763
+ }
764
+ .ui-datepicker .ui-datepicker-prev {
765
+ left: 2px;
766
+ }
767
+ .ui-datepicker .ui-datepicker-next {
768
+ right: 2px;
769
+ }
770
+ .ui-datepicker .ui-datepicker-prev-hover {
771
+ left: 1px;
772
+ }
773
+ .ui-datepicker .ui-datepicker-next-hover {
774
+ right: 1px;
775
+ }
776
+ .ui-datepicker .ui-datepicker-prev span,
777
+ .ui-datepicker .ui-datepicker-next span {
778
+ display: block;
779
+ position: absolute;
780
+ left: 50%;
781
+ margin-left: -8px;
782
+ top: 50%;
783
+ margin-top: -8px;
784
+ }
785
+ .ui-datepicker .ui-datepicker-title {
786
+ margin: 0 2.3em;
787
+ line-height: 1.8em;
788
+ text-align: center;
789
+ }
790
+ .ui-datepicker .ui-datepicker-title select {
791
+ font-size: 1em;
792
+ margin: 1px 0;
793
+ }
794
+ .ui-datepicker select.ui-datepicker-month,
795
+ .ui-datepicker select.ui-datepicker-year {
796
+ width: 45%;
797
+ }
798
+ .ui-datepicker table {
799
+ width: 100%;
800
+ font-size: .9em;
801
+ border-collapse: collapse;
802
+ margin: 0 0 .4em;
803
+ }
804
+ .ui-datepicker th {
805
+ padding: .7em .3em;
806
+ text-align: center;
807
+ font-weight: bold;
808
+ border: 0;
809
+ }
810
+ .ui-datepicker td {
811
+ border: 0;
812
+ padding: 1px;
813
+ }
814
+ .ui-datepicker td span,
815
+ .ui-datepicker td a {
816
+ display: block;
817
+ padding: .2em;
818
+ text-align: right;
819
+ text-decoration: none;
820
+ }
821
+ .ui-datepicker .ui-datepicker-buttonpane {
822
+ background-image: none;
823
+ margin: .7em 0 0 0;
824
+ padding: 0 .2em;
825
+ border-left: 0;
826
+ border-right: 0;
827
+ border-bottom: 0;
828
+ }
829
+ .ui-datepicker .ui-datepicker-buttonpane button {
830
+ float: right;
831
+ margin: .5em .2em .4em;
832
+ cursor: pointer;
833
+ padding: .2em .6em .3em .6em;
834
+ width: auto;
835
+ overflow: visible;
836
+ }
837
+ .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current {
838
+ float: left;
839
+ }
840
+
841
+ /* with multiple calendars */
842
+ .ui-datepicker.ui-datepicker-multi {
843
+ width: auto;
844
+ }
845
+ .ui-datepicker-multi .ui-datepicker-group {
846
+ float: left;
847
+ }
848
+ .ui-datepicker-multi .ui-datepicker-group table {
849
+ width: 95%;
850
+ margin: 0 auto .4em;
851
+ }
852
+ .ui-datepicker-multi-2 .ui-datepicker-group {
853
+ width: 50%;
854
+ }
855
+ .ui-datepicker-multi-3 .ui-datepicker-group {
856
+ width: 33.3%;
857
+ }
858
+ .ui-datepicker-multi-4 .ui-datepicker-group {
859
+ width: 25%;
860
+ }
861
+ .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header,
862
+ .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header {
863
+ border-left-width: 0;
864
+ }
865
+ .ui-datepicker-multi .ui-datepicker-buttonpane {
866
+ clear: left;
867
+ }
868
+ .ui-datepicker-row-break {
869
+ clear: both;
870
+ width: 100%;
871
+ font-size: 0;
872
+ }
873
+
874
+ /* RTL support */
875
+ .ui-datepicker-rtl {
876
+ direction: rtl;
877
+ }
878
+ .ui-datepicker-rtl .ui-datepicker-prev {
879
+ right: 2px;
880
+ left: auto;
881
+ }
882
+ .ui-datepicker-rtl .ui-datepicker-next {
883
+ left: 2px;
884
+ right: auto;
885
+ }
886
+ .ui-datepicker-rtl .ui-datepicker-prev:hover {
887
+ right: 1px;
888
+ left: auto;
889
+ }
890
+ .ui-datepicker-rtl .ui-datepicker-next:hover {
891
+ left: 1px;
892
+ right: auto;
893
+ }
894
+ .ui-datepicker-rtl .ui-datepicker-buttonpane {
895
+ clear: right;
896
+ }
897
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button {
898
+ float: left;
899
+ }
900
+ .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current,
901
+ .ui-datepicker-rtl .ui-datepicker-group {
902
+ float: right;
903
+ }
904
+ .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header,
905
+ .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header {
906
+ border-right-width: 0;
907
+ border-left-width: 1px;
908
+ }
909
+
910
+ /* Icons */
911
+ .ui-datepicker .ui-icon {
912
+ display: block;
913
+ text-indent: -99999px;
914
+ overflow: hidden;
915
+ background-repeat: no-repeat;
916
+ left: .5em;
917
+ top: .3em;
918
  }
includes/css/phone.css CHANGED
@@ -1,334 +1,334 @@
1
-
2
- .buttonInsideEmail{
3
- position:relative;
4
- margin-bottom:10px;
5
- }
6
-
7
- .buttonInsidePhone{
8
- position:relative;
9
- margin-bottom:10px;
10
- }
11
-
12
- .mo2f_send_emailotp_button {
13
- position:absolute;
14
- right: 0px;
15
- top: 0%;
16
- border:none;
17
- height:100%;
18
- width:max-content;
19
- outline:none;
20
- text-align:center;
21
- padding:2px;
22
- }
23
-
24
- .mo2ftimerEmail {
25
- position:absolute;
26
- right: 0px;
27
- top: 0%;
28
- border:none;
29
- height:100%;
30
- width:max-content;
31
- outline:none;
32
- text-align:center;
33
- padding:14px;
34
- }
35
-
36
- .mo2f_send_phoneotp_button {
37
- position:absolute;
38
- right: 0px;
39
- top: 0%;
40
- border:none;
41
- height:100%;
42
- width:max-content;
43
- outline:none;
44
- text-align:center;
45
- padding:2px;
46
- }
47
-
48
- .mo2ftimerSMS {
49
- position:absolute;
50
- right: 0px;
51
- top: 0%;
52
- border:none;
53
- height:100%;
54
- width:max-content;
55
- outline:none;
56
- text-align:center;
57
- padding:14px;
58
- }
59
-
60
- .intl-number-input { position: inherit; }
61
- .intl-number-input .hide { display: none; }
62
- .intl-number-input .flag-dropdown { position: absolute; cursor: pointer; }
63
- .intl-number-input .flag-dropdown .selected-flag { margin: 1px; padding: 8px 16px 6px 7px; }
64
- .intl-number-input .flag-dropdown .selected-flag:hover { background-color: rgba(0, 0, 0, 0.05); }
65
- .intl-number-input .flag-dropdown .selected-flag .down-arrow { top: 5px; position: relative; left: 20px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 4px solid black; }
66
- .intl-number-input .flag-dropdown .country-list {list-style: none; padding: 0; margin: 0; z-index: 1; overflow-y: scroll; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.2); background-color: white; border: 1px solid #cccccc; position: absolute; top: 33px; width: 196px; height: 200px; font-size:12px; }
67
- .intl-number-input .flag-dropdown .country-list .divider { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid #cccccc; }
68
- .intl-number-input .flag-dropdown .country-list .country { line-height: 20px; padding: 4px 10px; }
69
- .intl-number-input .flag-dropdown .country-list .country .dial-code { color: #999999; }
70
- .intl-number-input .flag-dropdown .country-list .country.highlight { background-color: rgba(0, 0, 0, 0.05); }
71
- .intl-number-input .flag-dropdown .country-list .flag { display: inline-block; vertical-align: bottom; }
72
- .intl-number-input .flag-dropdown .country-list .flag, .intl-number-input .flag-dropdown .country-list .country-name { margin-right:2px; }
73
- .intl-number-input input { box-sizing: border-box; -moz-box-sizing: border-box; height: 30px; padding-left: 40px; }
74
-
75
- /* originally from https://github.com/lafeber/world-flags-sprite */
76
- .f16 .flag { width: 16px; height: 16px; background: url("../images/flags16.png") no-repeat; }
77
- .f16 ._African_Union { background-position: 0 -16px; }
78
- .f16 ._Arab_League { background-position: 0 -32px; }
79
- .f16 ._ASEAN { background-position: 0 -48px; }
80
- .f16 ._CARICOM { background-position: 0 -64px; }
81
- .f16 ._CIS { background-position: 0 -80px; }
82
- .f16 ._Commonwealth { background-position: 0 -96px; }
83
- .f16 ._England { background-position: 0 -112px; }
84
- .f16 ._European_Union { background-position: 0 -128px; }
85
- .f16 ._Islamic_Conference { background-position: 0 -144px; }
86
- .f16 ._Kosovo { background-position: 0 -160px; }
87
- .f16 ._NATO { background-position: 0 -176px; }
88
- .f16 ._Northern_Cyprus { background-position: 0 -192px; }
89
- .f16 ._Northern_Ireland { background-position: 0 -208px; }
90
- .f16 ._Olimpic_Movement { background-position: 0 -224px; }
91
- .f16 ._OPEC { background-position: 0 -240px; }
92
- .f16 ._Red_Cross { background-position: 0 -256px; }
93
- .f16 ._Scotland { background-position: 0 -272px; }
94
- .f16 ._Somaliland { background-position: 0 -288px; }
95
- .f16 ._Tibet { background-position: 0 -304px; }
96
- .f16 ._United_Nations { background-position: 0 -320px; }
97
- .f16 ._Wales { background-position: 0 -336px; }
98
- .f16 .ad { background-position: 0 -352px; }
99
- .f16 .ae { background-position: 0 -368px; }
100
- .f16 .af { background-position: 0 -384px; }
101
- .f16 .ag { background-position: 0 -400px; }
102
- .f16 .ai { background-position: 0 -416px; }
103
- .f16 .al { background-position: 0 -432px; }
104
- .f16 .am { background-position: 0 -448px; }
105
- .f16 .an { background-position: 0 -464px; }
106
- .f16 .ao { background-position: 0 -480px; }
107
- .f16 .aq { background-position: 0 -496px; }
108
- .f16 .ar { background-position: 0 -512px; }
109
- .f16 .as { background-position: 0 -528px; }
110
- .f16 .at { background-position: 0 -544px; }
111
- .f16 .au { background-position: 0 -560px; }
112
- .f16 .aw { background-position: 0 -576px; }
113
- .f16 .az { background-position: 0 -592px; }
114
- .f16 .ba { background-position: 0 -608px; }
115
- .f16 .bb { background-position: 0 -624px; }
116
- .f16 .bd { background-position: 0 -640px; }
117
- .f16 .be { background-position: 0 -656px; }
118
- .f16 .bf { background-position: 0 -672px; }
119
- .f16 .bg { background-position: 0 -688px; }
120
- .f16 .bh { background-position: 0 -704px; }
121
- .f16 .bi { background-position: 0 -720px; }
122
- .f16 .bj { background-position: 0 -736px; }
123
- .f16 .bm { background-position: 0 -752px; }
124
- .f16 .bn { background-position: 0 -768px; }
125
- .f16 .bo { background-position: 0 -784px; }
126
- .f16 .br { background-position: 0 -800px; }
127
- .f16 .bs { background-position: 0 -816px; }
128
- .f16 .bt { background-position: 0 -832px; }
129
- .f16 .bw { background-position: 0 -848px; }
130
- .f16 .by { background-position: 0 -864px; }
131
- .f16 .bz { background-position: 0 -880px; }
132
- .f16 .ca { background-position: 0 -896px; }
133
- .f16 .cg { background-position: 0 -912px; }
134
- .f16 .cf { background-position: 0 -928px; }
135
- .f16 .cd { background-position: 0 -944px; }
136
- .f16 .ch { background-position: 0 -960px; }
137
- .f16 .ci { background-position: 0 -976px; }
138
- .f16 .ck { background-position: 0 -992px; }
139
- .f16 .cl { background-position: 0 -1008px; }
140
- .f16 .cm { background-position: 0 -1024px; }
141
- .f16 .cn { background-position: 0 -1040px; }
142
- .f16 .co { background-position: 0 -1056px; }
143
- .f16 .cr { background-position: 0 -1072px; }
144
- .f16 .cu { background-position: 0 -1088px; }
145
- .f16 .cv { background-position: 0 -1104px; }
146
- .f16 .cy { background-position: 0 -1120px; }
147
- .f16 .cz { background-position: 0 -1136px; }
148
- .f16 .de { background-position: 0 -1152px; }
149
- .f16 .dj { background-position: 0 -1168px; }
150
- .f16 .dk { background-position: 0 -1184px; }
151
- .f16 .dm { background-position: 0 -1200px; }
152
- .f16 .do { background-position: 0 -1216px; }
153
- .f16 .dz { background-position: 0 -1232px; }
154
- .f16 .ec { background-position: 0 -1248px; }
155
- .f16 .ee { background-position: 0 -1264px; }
156
- .f16 .eg { background-position: 0 -1280px; }
157
- .f16 .eh { background-position: 0 -1296px; }
158
- .f16 .er { background-position: 0 -1312px; }
159
- .f16 .es { background-position: 0 -1328px; }
160
- .f16 .et { background-position: 0 -1344px; }
161
- .f16 .fi { background-position: 0 -1360px; }
162
- .f16 .fj { background-position: 0 -1376px; }
163
- .f16 .fm { background-position: 0 -1392px; }
164
- .f16 .fo { background-position: 0 -1408px; }
165
- .f16 .fr { background-position: 0 -1424px; }
166
- .f16 .ga { background-position: 0 -1440px; }
167
- .f16 .gb { background-position: 0 -1456px; }
168
- .f16 .gd { background-position: 0 -1472px; }
169
- .f16 .ge { background-position: 0 -1488px; }
170
- .f16 .gg { background-position: 0 -1504px; }
171
- .f16 .gh { background-position: 0 -1520px; }
172
- .f16 .gi { background-position: 0 -1536px; }
173
- .f16 .gl { background-position: 0 -1552px; }
174
- .f16 .gm { background-position: 0 -1568px; }
175
- .f16 .gn { background-position: 0 -1584px; }
176
- .f16 .gp { background-position: 0 -1600px; }
177
- .f16 .gq { background-position: 0 -1616px; }
178
- .f16 .gr { background-position: 0 -1632px; }
179
- .f16 .gt { background-position: 0 -1648px; }
180
- .f16 .gu { background-position: 0 -1664px; }
181
- .f16 .gw { background-position: 0 -1680px; }
182
- .f16 .gy { background-position: 0 -1696px; }
183
- .f16 .hk { background-position: 0 -1712px; }
184
- .f16 .hn { background-position: 0 -1728px; }
185
- .f16 .hr { background-position: 0 -1744px; }
186
- .f16 .ht { background-position: 0 -1760px; }
187
- .f16 .hu { background-position: 0 -1776px; }
188
- .f16 .id { background-position: 0 -1792px; }
189
- .f16 .mc { background-position: 0 -1792px; }
190
- .f16 .ie { background-position: 0 -1808px; }
191
- .f16 .il { background-position: 0 -1824px; }
192
- .f16 .im { background-position: 0 -1840px; }
193
- .f16 .in { background-position: 0 -1856px; }
194
- .f16 .iq { background-position: 0 -1872px; }
195
- .f16 .ir { background-position: 0 -1888px; }
196
- .f16 .is { background-position: 0 -1904px; }
197
- .f16 .it { background-position: 0 -1920px; }
198
- .f16 .je { background-position: 0 -1936px; }
199
- .f16 .jm { background-position: 0 -1952px; }
200
- .f16 .jo { background-position: 0 -1968px; }
201
- .f16 .jp { background-position: 0 -1984px; }
202
- .f16 .ke { background-position: 0 -2000px; }
203
- .f16 .kg { background-position: 0 -2016px; }
204
- .f16 .kh { background-position: 0 -2032px; }
205
- .f16 .ki { background-position: 0 -2048px; }
206
- .f16 .km { background-position: 0 -2064px; }
207
- .f16 .kn { background-position: 0 -2080px; }
208
- .f16 .kp { background-position: 0 -2096px; }
209
- .f16 .kr { background-position: 0 -2112px; }
210
- .f16 .kw { background-position: 0 -2128px; }
211
- .f16 .ky { background-position: 0 -2144px; }
212
- .f16 .kz { background-position: 0 -2160px; }
213
- .f16 .la { background-position: 0 -2176px; }
214
- .f16 .lb { background-position: 0 -2192px; }
215
- .f16 .lc { background-position: 0 -2208px; }
216
- .f16 .li { background-position: 0 -2224px; }
217
- .f16 .lk { background-position: 0 -2240px; }
218
- .f16 .lr { background-position: 0 -2256px; }
219
- .f16 .ls { background-position: 0 -2272px; }
220
- .f16 .lt { background-position: 0 -2288px; }
221
- .f16 .lu { background-position: 0 -2304px; }
222
- .f16 .lv { background-position: 0 -2320px; }
223
- .f16 .ly { background-position: 0 -2336px; }
224
- .f16 .ma { background-position: 0 -2352px; }
225
- .f16 .md { background-position: 0 -2368px; }
226
- .f16 .me { background-position: 0 -2384px; }
227
- .f16 .mg { background-position: 0 -2400px; }
228
- .f16 .mh { background-position: 0 -2416px; }
229
- .f16 .mk { background-position: 0 -2432px; }
230
- .f16 .ml { background-position: 0 -2448px; }
231
- .f16 .mm { background-position: 0 -2464px; }
232
- .f16 .mn { background-position: 0 -2480px; }
233
- .f16 .mo { background-position: 0 -2496px; }
234
- .f16 .mq { background-position: 0 -2512px; }
235
- .f16 .mr { background-position: 0 -2528px; }
236
- .f16 .ms { background-position: 0 -2544px; }
237
- .f16 .mt { background-position: 0 -2560px; }
238
- .f16 .mu { background-position: 0 -2576px; }
239
- .f16 .mv { background-position: 0 -2592px; }
240
- .f16 .mw { background-position: 0 -2608px; }
241
- .f16 .mx { background-position: 0 -2624px; }
242
- .f16 .my { background-position: 0 -2640px; }
243
- .f16 .mz { background-position: 0 -2656px; }
244
- .f16 .na { background-position: 0 -2672px; }
245
- .f16 .nc { background-position: 0 -2688px; }
246
- .f16 .ne { background-position: 0 -2704px; }
247
- .f16 .ng { background-position: 0 -2720px; }
248
- .f16 .ni { background-position: 0 -2736px; }
249
- .f16 .nl { background-position: 0 -2752px; }
250
- .f16 .no { background-position: 0 -2768px; }
251
- .f16 .np { background-position: 0 -2784px; }
252
- .f16 .nr { background-position: 0 -2800px; }
253
- .f16 .nz { background-position: 0 -2816px; }
254
- .f16 .om { background-position: 0 -2832px; }
255
- .f16 .pa { background-position: 0 -2848px; }
256
- .f16 .pe { background-position: 0 -2864px; }
257
- .f16 .pf { background-position: 0 -2880px; }
258
- .f16 .pg { background-position: 0 -2896px; }
259
- .f16 .ph { background-position: 0 -2912px; }
260
- .f16 .pk { background-position: 0 -2928px; }
261
- .f16 .pl { background-position: 0 -2944px; }
262
- .f16 .pr { background-position: 0 -2960px; }
263
- .f16 .ps { background-position: 0 -2976px; }
264
- .f16 .pt { background-position: 0 -2992px; }
265
- .f16 .pw { background-position: 0 -3008px; }
266
- .f16 .py { background-position: 0 -3024px; }
267
- .f16 .qa { background-position: 0 -3040px; }
268
- .f16 .re { background-position: 0 -3056px; }
269
- .f16 .ro { background-position: 0 -3072px; }
270
- .f16 .rs { background-position: 0 -3088px; }
271
- .f16 .ru { background-position: 0 -3104px; }
272
- .f16 .rw { background-position: 0 -3120px; }
273
- .f16 .sa { background-position: 0 -3136px; }
274
- .f16 .sb { background-position: 0 -3152px; }
275
- .f16 .sc { background-position: 0 -3168px; }
276
- .f16 .sd { background-position: 0 -3184px; }
277
- .f16 .se { background-position: 0 -3200px; }
278
- .f16 .sg { background-position: 0 -3216px; }
279
- .f16 .si { background-position: 0 -3232px; }
280
- .f16 .sk { background-position: 0 -3248px; }
281
- .f16 .sl { background-position: 0 -3264px; }
282
- .f16 .sm { background-position: 0 -3280px; }
283
- .f16 .sn { background-position: 0 -3296px; }
284
- .f16 .so { background-position: 0 -3312px; }
285
- .f16 .sr { background-position: 0 -3328px; }
286
- .f16 .st { background-position: 0 -3344px; }
287
- .f16 .sv { background-position: 0 -3360px; }
288
- .f16 .sy { background-position: 0 -3376px; }
289
- .f16 .sz { background-position: 0 -3392px; }
290
- .f16 .tc { background-position: 0 -3408px; }
291
- .f16 .td { background-position: 0 -3424px; }
292
- .f16 .tg { background-position: 0 -3440px; }
293
- .f16 .th { background-position: 0 -3456px; }
294
- .f16 .tj { background-position: 0 -3472px; }
295
- .f16 .tl { background-position: 0 -3488px; }
296
- .f16 .tm { background-position: 0 -3504px; }
297
- .f16 .tn { background-position: 0 -3520px; }
298
- .f16 .to { background-position: 0 -3536px; }
299
- .f16 .tr { background-position: 0 -3552px; }
300
- .f16 .tt { background-position: 0 -3568px; }
301
- .f16 .tv { background-position: 0 -3584px; }
302
- .f16 .tw { background-position: 0 -3600px; }
303
- .f16 .tz { background-position: 0 -3616px; }
304
- .f16 .ua { background-position: 0 -3632px; }
305
- .f16 .ug { background-position: 0