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

Version Description

Download this release

Release Info

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

Version 4.3.4

Files changed (60) hide show
  1. class-customer-setup.php +406 -0
  2. class-miniorange-2-factor-login.php +852 -0
  3. class-miniorange-2-factor-pass2fa-login.php +1912 -0
  4. class-miniorange-2-factor-user-registration.php +270 -0
  5. class-rba-attributes.php +328 -0
  6. class-two-factor-setup.php +432 -0
  7. class-utility.php +92 -0
  8. includes/css/bootstrap.min.css +509 -0
  9. includes/css/front_end_login.css +206 -0
  10. includes/css/hide-login-form.css +41 -0
  11. includes/css/hide-login.css +293 -0
  12. includes/css/phone.css +270 -0
  13. includes/css/show-login.css +64 -0
  14. includes/css/style_settings.css +298 -0
  15. includes/images/Smartphone-24.png +0 -0
  16. includes/images/ajax-loader-login.gif +0 -0
  17. includes/images/ajax-loader.gif +0 -0
  18. includes/images/appstore.png +0 -0
  19. includes/images/feat_smart.png +0 -0
  20. includes/images/flags16.png +0 -0
  21. includes/images/help/step1.png +0 -0
  22. includes/images/help/step2.png +0 -0
  23. includes/images/help/step3.png +0 -0
  24. includes/images/help/step4.png +0 -0
  25. includes/images/help/step5.png +0 -0
  26. includes/images/help/step6.png +0 -0
  27. includes/images/landline_sprite.png +0 -0
  28. includes/images/laptop-24.png +0 -0
  29. includes/images/miniOrange2.png +0 -0
  30. includes/images/miniorange_icon.png +0 -0
  31. includes/images/miniorange_logo.png +0 -0
  32. includes/images/mo_white_logo.png +0 -0
  33. includes/images/playStore.png +0 -0
  34. includes/images/right.png +0 -0
  35. includes/images/vertical_line.png +0 -0
  36. includes/images/wrong.png +0 -0
  37. includes/js/bootstrap.min.js +7 -0
  38. includes/js/phone.js +9 -0
  39. includes/js/rba/js/client.js +12 -0
  40. includes/js/rba/js/device_attributes.js +10 -0
  41. includes/js/rba/js/fontdetect.js +1 -0
  42. includes/js/rba/js/fonts.swf +0 -0
  43. includes/js/rba/js/jquery-1.9.1.js +182 -0
  44. includes/js/rba/js/jquery.flash.js +6 -0
  45. includes/js/rba/js/miniorange-fp.js +21 -0
  46. includes/js/rba/js/murmurhash3.js +2 -0
  47. includes/js/rba/js/swfobject.js +19 -0
  48. includes/js/rba/js/ua-parser.js +17 -0
  49. miniorange_2_factor_common_login.php +760 -0
  50. miniorange_2_factor_configuration.php +617 -0
  51. miniorange_2_factor_demo.php +523 -0
  52. miniorange_2_factor_frontend_shortcode.php +543 -0
  53. miniorange_2_factor_mobile_configuration.php +1893 -0
  54. miniorange_2_factor_settings.php +1760 -0
  55. miniorange_2_factor_support.php +44 -0
  56. miniorange_2_factor_troubleshooting.php +176 -0
  57. miniorange_2_factor_user_inline_registration.php +964 -0
  58. miniorange_2_factor_woocommerce_login.php +1817 -0
  59. readme.txt +610 -0
  60. uninstall.php +131 -0
class-customer-setup.php ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Customer_Setup{
26
+
27
+ public $email;
28
+ public $phone;
29
+ public $customerKey;
30
+ public $transactionId;
31
+
32
+ function check_customer() {
33
+ if(!MO2f_Utility::is_curl_installed()) {
34
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
35
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
36
+ }
37
+
38
+ $url = get_option('mo2f_host_name') . "/moas/rest/customer/check-if-exists";
39
+ $ch = curl_init( $url );
40
+ $email = get_option("mo2f_email");
41
+
42
+ $fields = array(
43
+ 'email' => $email,
44
+ );
45
+ $field_string = json_encode( $fields );
46
+
47
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
48
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
49
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
50
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
51
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
52
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
53
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
54
+ curl_setopt( $ch, CURLOPT_POST, true);
55
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
56
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
57
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
58
+ $content = curl_exec( $ch );
59
+ if( curl_errno( $ch ) ){
60
+ return null;
61
+ }
62
+ curl_close( $ch );
63
+
64
+ return $content;
65
+ }
66
+
67
+
68
+ function create_customer(){
69
+ if(!MO2f_Utility::is_curl_installed()) {
70
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
71
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
72
+ }
73
+
74
+ $url = get_option('mo2f_host_name') . '/moas/rest/customer/add';
75
+ $ch = curl_init($url);
76
+ global $current_user;
77
+ $current_user = wp_get_current_user();
78
+ $this->email = get_option('mo2f_email');
79
+ $this->phone = get_user_meta($current_user->ID,'mo2f_user_phone',true);
80
+ $password = get_option('mo2f_password');
81
+ $company = get_option('mo2f_admin_company') != '' ? get_option('mo2f_admin_company') : $_SERVER['SERVER_NAME'];
82
+ $firstName = get_option('mo2f_admin_first_name');
83
+ $lastName = get_option('mo2_admin_last_name');
84
+
85
+ $fields = array(
86
+ 'companyName' => $company,
87
+ 'areaOfInterest' => 'WordPress 2 Factor Authentication Plugin',
88
+ 'productInterest' => 'API_2FA',
89
+ 'firstname' => $firstName,
90
+ 'lastname' => $lastName,
91
+ 'email' => $this->email,
92
+ 'phone' => $this->phone,
93
+ 'password' => $password
94
+ );
95
+ $field_string = json_encode($fields);
96
+
97
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
98
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
99
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
100
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
101
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
102
+
103
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
104
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
105
+ 'Content-Type: application/json',
106
+ 'charset: UTF - 8',
107
+ 'Authorization: Basic'
108
+ ));
109
+ curl_setopt( $ch, CURLOPT_POST, true);
110
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
111
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
112
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
113
+ $content = curl_exec($ch);
114
+
115
+ if(curl_errno($ch)){
116
+ return null;
117
+ }
118
+
119
+
120
+ curl_close($ch);
121
+ return $content;
122
+ }
123
+
124
+ function get_customer_key() {
125
+ if(!MO2f_Utility::is_curl_installed()) {
126
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
127
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
128
+ }
129
+
130
+ $url = get_option('mo2f_host_name') . "/moas/rest/customer/key";
131
+ $ch = curl_init($url);
132
+ $email = get_option("mo2f_email");
133
+ $password = get_option("mo2f_password");
134
+
135
+ $fields = array(
136
+ 'email' => $email,
137
+ 'password' => $password
138
+ );
139
+ $field_string = json_encode($fields);
140
+
141
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
142
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
143
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
144
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
145
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
146
+
147
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
148
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
149
+ 'Content-Type: application/json',
150
+ 'charset: UTF - 8',
151
+ 'Authorization: Basic'
152
+ ));
153
+ curl_setopt( $ch, CURLOPT_POST, true);
154
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
155
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
156
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
157
+ $content = curl_exec($ch);
158
+ if(curl_errno($ch)){
159
+ return null;
160
+ }
161
+ curl_close($ch);
162
+
163
+ return $content;
164
+ }
165
+
166
+ function send_otp_token($uKey,$authType,$cKey,$apiKey){
167
+ if(!MO2f_Utility::is_curl_installed()) {
168
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
169
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
170
+ }
171
+
172
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/challenge';
173
+ $ch = curl_init($url);
174
+
175
+ /* The customer Key provided to you */
176
+ $customerKey = $cKey;
177
+
178
+ /* The customer API Key provided to you */
179
+ $apiKey = $apiKey;
180
+
181
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
182
+ $currentTimeInMillis = round(microtime(true) * 1000);
183
+
184
+ /* Creating the Hash using SHA-512 algorithm */
185
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
186
+ $hashValue = hash("sha512", $stringToHash);
187
+
188
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
189
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
190
+ $authorizationHeader = "Authorization: " . $hashValue;
191
+
192
+
193
+ $fields = '';
194
+ if( $authType == 'EMAIL' ) {
195
+ $fields = array(
196
+ 'customerKey' => $customerKey,
197
+ 'email' => $uKey,
198
+ 'authType' => $authType,
199
+ 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
200
+ );
201
+ }else if($authType == 'OTP_OVER_SMS' || $authType == 'PHONE_VERIFICATION'){
202
+ if($authType == 'OTP_OVER_SMS'){
203
+ $authType ="SMS";
204
+ }else if($authType == 'PHONE_VERIFICATION'){
205
+ $authType ="PHONE VERIFICATION";
206
+ }
207
+
208
+ $fields = array(
209
+ 'customerKey' => $customerKey,
210
+ 'phone' => $uKey,
211
+ 'authType' => $authType
212
+ );
213
+ }else{
214
+ $fields = array(
215
+ 'customerKey' => $customerKey,
216
+ 'username' => $uKey,
217
+ 'authType' => $authType,
218
+ 'transactionName' => 'WordPress 2 Factor Authentication Plugin'
219
+ );
220
+ }
221
+
222
+ $field_string = json_encode($fields);
223
+
224
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
225
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
226
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
227
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
228
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
229
+
230
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
231
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
232
+ $timestampHeader, $authorizationHeader));
233
+ curl_setopt( $ch, CURLOPT_POST, true);
234
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
235
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
236
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
237
+ $content = curl_exec($ch);
238
+
239
+ if(curl_errno($ch)){
240
+ return null;
241
+ }
242
+ curl_close($ch);
243
+ return $content;
244
+ }
245
+
246
+ function validate_otp_token($authType,$username,$transactionId,$otpToken,$cKey,$customerApiKey){
247
+ if(!MO2f_Utility::is_curl_installed()) {
248
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
249
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
250
+ }
251
+
252
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/validate';
253
+ $ch = curl_init($url);
254
+
255
+ /* The customer Key provided to you */
256
+ $customerKey = $cKey;
257
+
258
+ /* The customer API Key provided to you */
259
+ $apiKey = $customerApiKey;
260
+
261
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
262
+ $currentTimeInMillis = round(microtime(true) * 1000);
263
+
264
+ /* Creating the Hash using SHA-512 algorithm */
265
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
266
+ $hashValue = hash("sha512", $stringToHash);
267
+
268
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
269
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
270
+ $authorizationHeader = "Authorization: " . $hashValue;
271
+
272
+ $fields = '';
273
+ if( $authType == 'SOFT TOKEN' || $authType == 'GOOGLE AUTHENTICATOR') {
274
+ /*check for soft token*/
275
+ $fields = array(
276
+ 'customerKey' => $customerKey,
277
+ 'username' => $username,
278
+ 'token' => $otpToken,
279
+ 'authType' => $authType
280
+ );
281
+ }else if($authType == 'KBA'){
282
+ $fields = array(
283
+ 'txId' => $transactionId,
284
+ 'answers' => array(
285
+ array(
286
+ 'question' => $otpToken[0],
287
+ 'answer' => $otpToken[1]
288
+ ),
289
+ array(
290
+ 'question' => $otpToken[2],
291
+ 'answer' => $otpToken[3]
292
+ )
293
+ )
294
+ );
295
+ }else{
296
+ //*check for otp over sms/email
297
+ $fields = array(
298
+ 'txId' => $transactionId,
299
+ 'token' => $otpToken
300
+ );
301
+ }
302
+ $field_string = json_encode($fields);
303
+
304
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
305
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
306
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
307
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
308
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
309
+
310
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
311
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
312
+ $timestampHeader, $authorizationHeader));
313
+ curl_setopt( $ch, CURLOPT_POST, true);
314
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
315
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
316
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
317
+ $content = curl_exec($ch);
318
+
319
+ if(curl_errno($ch)){
320
+ return null;
321
+ }
322
+ curl_close($ch);
323
+ return $content;
324
+ }
325
+
326
+ function submit_contact_us( $q_email, $q_phone, $query ) {
327
+ if(!MO2f_Utility::is_curl_installed()) {
328
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
329
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
330
+ }
331
+
332
+ $url = get_option('mo2f_host_name') . "/moas/rest/customer/contact-us";
333
+ $ch = curl_init($url);
334
+ global $current_user;
335
+ $current_user = wp_get_current_user();
336
+ $query = '[WordPress 2 Factor Authentication Plugin]: ' . $query;
337
+ $fields = array(
338
+ 'firstName' => $current_user->user_firstname,
339
+ 'lastName' => $current_user->user_lastname,
340
+ 'company' => $_SERVER['SERVER_NAME'],
341
+ 'email' => $q_email,
342
+ 'phone' => $q_phone,
343
+ 'query' => $query
344
+ );
345
+ $field_string = json_encode( $fields );
346
+
347
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
348
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
349
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
350
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
351
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
352
+
353
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
354
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF-8', 'Authorization: Basic' ) );
355
+ curl_setopt( $ch, CURLOPT_POST, true);
356
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
357
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
358
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
359
+ $content = curl_exec( $ch );
360
+
361
+ if(curl_errno($ch)){
362
+ return null;
363
+ }
364
+ curl_close($ch);
365
+
366
+ return true;
367
+ }
368
+
369
+ function forgot_password($email){
370
+ if(!MO2f_Utility::is_curl_installed()) {
371
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
372
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
373
+ }
374
+
375
+ $url = get_option('mo2f_host_name') . '/moas/rest/customer/password-reset';
376
+ $ch = curl_init($url);
377
+
378
+ $fields = array(
379
+ 'email' => $email
380
+ );
381
+
382
+ $field_string = json_encode($fields);
383
+
384
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
385
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
386
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
387
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
388
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
389
+
390
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
391
+ curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'charset: UTF - 8', 'Authorization: Basic' ) );
392
+ curl_setopt( $ch, CURLOPT_POST, true);
393
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
394
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
395
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
396
+ $content = curl_exec($ch);
397
+
398
+ if(curl_errno($ch)){
399
+ return null;
400
+ }
401
+ curl_close($ch);
402
+ return $content;
403
+ }
404
+
405
+
406
+ }?>
class-miniorange-2-factor-login.php ADDED
@@ -0,0 +1,852 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_once dirname( __FILE__ ) . '/miniorange_2_factor_common_login.php';
26
+ class Miniorange_Mobile_Login{
27
+
28
+ public function miniorange_login_start_session(){
29
+ if( ! session_id() || session_id() == '' || !isset($_SESSION) ) {
30
+ session_start();
31
+ }
32
+ }
33
+
34
+ public function my_login_redirect() {
35
+
36
+ if (isset($_POST['miniorange_login_nonce'])){
37
+ $nonce = $_POST['miniorange_login_nonce'];
38
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' ) ) {
39
+ $_SESSION['mo2f-login-message'] = 'Invalid request';
40
+ $this->mo_auth_show_error_message();
41
+ } else {
42
+ $this->miniorange_login_start_session();
43
+ //validation and sanitization
44
+ $username = '';
45
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2fa_username'] ) ) {
46
+ $_SESSION['mo2f-login-message'] = 'Please enter username to proceed';
47
+ $this->mo_auth_show_error_message();
48
+ return;
49
+ } else{
50
+ $username = sanitize_text_field( $_POST['mo2fa_username'] );
51
+ }
52
+
53
+ if ( username_exists( $username ) ){ /*if username exists in wp site */
54
+ $user = new WP_User( $username );
55
+ if( ! session_id() || session_id() == '' || !isset($_SESSION) ) {
56
+ session_start();
57
+ }
58
+ $_SESSION[ 'mo2f_current_user' ] = serialize($user);
59
+ $roles = $user->roles;
60
+ $current_role = array_shift($roles);
61
+ if(get_option('mo2fa_'.$current_role)){
62
+ if(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true) && get_user_meta($user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
63
+ if(MO2f_Utility::check_if_request_is_from_mobile_device($_SERVER['HTTP_USER_AGENT']) && get_user_meta($user->ID,'mo2f_kba_registration_status',true) && get_option('mo2f_enable_mobile_support')){
64
+ $this->mo2f_login_kba_verification($user);
65
+ }else{
66
+ $mo2f_second_factor = mo2f_get_user_2ndfactor($user);
67
+ if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
68
+ $this->mo2f_login_mobile_verification($user);
69
+ }else if($mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL'){
70
+ $this->mo2f_login_push_oobemail_verification($user,$mo2f_second_factor);
71
+ }else if($mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
72
+ $this->mo2f_login_otp_verification($user,$mo2f_second_factor);
73
+ }else if($mo2f_second_factor == 'KBA'){
74
+ $this->mo2f_login_kba_verification($user);
75
+ }else{
76
+ $this->remove_current_activity();
77
+ $_SESSION['mo2f-login-message'] = 'Please try again or contact your admin.';
78
+ $this->mo_auth_show_success_message();
79
+ }
80
+ }
81
+ }else{
82
+ $_SESSION['mo2f-login-message'] = 'Please login into your account using password.';
83
+ $this->mo_auth_show_success_message();
84
+ $this->mo2f_redirectto_wp_login();
85
+ }
86
+ }else{
87
+ $_SESSION['mo2f-login-message'] = 'Please login into your account using password.';
88
+ $this->mo_auth_show_success_message();
89
+ $this->mo2f_redirectto_wp_login();
90
+ }
91
+ }else{
92
+ $this->remove_current_activity();
93
+ $_SESSION['mo2f-login-message'] = 'Invalid Username.';
94
+ $this->mo_auth_show_error_message();
95
+ }
96
+ }
97
+ }
98
+
99
+ if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){ /*check kba validation*/
100
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
101
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
102
+ $error = new WP_Error();
103
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
104
+ return $error;
105
+ }else {
106
+ $this->miniorange_login_start_session();
107
+ $second_factor = isset($_POST[ 'mo2f_selected_2factor_method' ]) ? $_POST[ 'mo2f_selected_2factor_method' ] : 'KBA';
108
+ if($second_factor == 'OTP OVER EMAIL'){
109
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
110
+ $id = $current_user->ID;
111
+ $customer = new Customer_Setup();
112
+ $content = json_decode($customer->send_otp_token(get_user_meta($id,'mo_2factor_map_id_with_email',true),'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
113
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
114
+ $_SESSION['mo2f-login-message'] = 'A one time passcode has been sent to <b>' . MO2f_Utility::mo2f_get_hiden_email(get_user_meta($id,'mo_2factor_map_id_with_email',true) ) . '</b>. Please enter the OTP to verify your identity.';
115
+ $_SESSION[ 'mo2f-login-transactionId' ] = $content['txId'];
116
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ;
117
+ }else{
118
+ $_SESSION['mo2f-login-message'] = 'Error occured while sending OTP over your regsitered email. Please try again or select Security Questions (KBA) to login.';
119
+ }
120
+ }else{
121
+ $current_user = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
122
+ $this->mo2f_login_kba_verification($current_user);
123
+ }
124
+ }
125
+ }
126
+
127
+ if(isset($_POST['miniorange_alternate_login_kba_nonce'])){ /*check kba validation*/
128
+ $nonce = $_POST['miniorange_alternate_login_kba_nonce'];
129
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' ) ) {
130
+ $error = new WP_Error();
131
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
132
+ return $error;
133
+ }else {
134
+ $this->miniorange_login_start_session();
135
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
136
+ $this->mo2f_login_kba_verification($currentuser);
137
+ }
138
+ }
139
+
140
+ if(isset($_POST['miniorange_kba_nonce'])){ /*check kba validation*/
141
+ $nonce = $_POST['miniorange_kba_nonce'];
142
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' ) ) {
143
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
144
+ $this->mo_auth_show_error_message();
145
+ } else {
146
+ $this->miniorange_login_start_session();
147
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
148
+ if(isset($_SESSION[ 'mo2f_current_user' ])){
149
+ if(MO2f_Utility::mo2f_check_empty_or_null($_POST[ 'mo2f_answer_1' ]) || MO2f_Utility::mo2f_check_empty_or_null($_POST[ 'mo2f_answer_2' ])){
150
+ return;
151
+ }
152
+ $otpToken = array();
153
+ $otpToken[0] = $_SESSION['mo_2_factor_kba_questions'][0];
154
+ $otpToken[1] = sanitize_text_field( $_POST[ 'mo2f_answer_1' ] );
155
+ $otpToken[2] = $_SESSION['mo_2_factor_kba_questions'][1];
156
+ $otpToken[3] = sanitize_text_field( $_POST[ 'mo2f_answer_2' ] );
157
+ $check_trust_device = sanitize_text_field( $_POST[ 'mo2f_trust_device' ] );
158
+
159
+ $kba_validate = new Customer_Setup();
160
+ $kba_validate_response = json_decode($kba_validate->validate_otp_token( 'KBA', null, $_SESSION[ 'mo2f-login-transactionId' ], $otpToken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
161
+
162
+
163
+ if( username_exists( $currentuser->user_login )) { // user is a member
164
+ if(strcasecmp($kba_validate_response['status'], 'SUCCESS') == 0) {
165
+ remove_filter('authenticate', 'wp_authenticate_username_password', 10, 3);
166
+ add_filter('authenticate', array($this, 'mo2fa_login'), 10, 3);
167
+ }else{
168
+ $_SESSION[ 'mo2f-login-message' ] = 'The answers you have provided are incorrect.';
169
+ }
170
+ }else{
171
+ $this->remove_current_activity();
172
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
173
+ $this->mo_auth_show_error_message();
174
+ }
175
+ }else{
176
+ $this->remove_current_activity();
177
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
178
+ $this->mo_auth_show_error_message();
179
+ }
180
+ }
181
+ }
182
+
183
+ if(isset($_POST['miniorange_mobile_validation_nonce'])){ /*check mobile validation */
184
+ $nonce = $_POST['miniorange_mobile_validation_nonce'];
185
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-nonce' ) ) {
186
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
187
+ $this->mo_auth_show_error_message();
188
+ } else {
189
+ $this->miniorange_login_start_session();
190
+ $currentuser = unserialize($_SESSION[ 'mo2f_current_user' ]);
191
+ $username = $currentuser->user_login;
192
+ if( username_exists( $username )) { // user is a member
193
+ $checkMobileStatus = new Two_Factor_Setup();
194
+ $content = $checkMobileStatus->check_mobile_status($_SESSION[ 'mo2f-login-transactionId' ]);
195
+ $response = json_decode($content, true);
196
+ if(json_last_error() == JSON_ERROR_NONE) {
197
+ if($response['status'] == 'SUCCESS'){
198
+ remove_filter('authenticate', 'wp_authenticate_username_password', 10, 3);
199
+ add_filter('authenticate', array($this, 'mo2fa_login'), 10, 3);
200
+ }else{
201
+ $this->remove_current_activity();
202
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
203
+ $this->mo_auth_show_error_message();
204
+ }
205
+ }else{
206
+ $this->remove_current_activity();
207
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
208
+ $this->mo_auth_show_error_message();
209
+ }
210
+ } else{
211
+ $this->remove_current_activity();
212
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
213
+ $this->mo_auth_show_error_message();
214
+ }
215
+ }
216
+ }
217
+
218
+ if (isset($_POST['miniorange_mobile_validation_failed_nonce'])){ /*Back to miniOrange Login Page if mobile validation failed and from back button of mobile challenge, soft token and default login*/
219
+ $nonce = $_POST['miniorange_mobile_validation_failed_nonce'];
220
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-failed-nonce' ) ) {
221
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
222
+ $this->mo_auth_show_error_message();
223
+ } else {
224
+ $this->miniorange_login_start_session();
225
+ $this->remove_current_activity();
226
+ }
227
+ }
228
+
229
+ if(isset($_POST['miniorange_forgotphone'])){ /*Click on the link of forgotphone */
230
+ $nonce = $_POST['miniorange_forgotphone'];
231
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
232
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
233
+ $this->mo_auth_show_error_message();
234
+ } else{
235
+ $this->miniorange_login_start_session();
236
+ $customer = new Customer_Setup();
237
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
238
+ $id = $current_user->ID;
239
+ if(get_user_meta($id,'mo2f_kba_registration_status',true)){
240
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
241
+ unset($_SESSION['mo2f-login-message']);
242
+ }else{
243
+ $content = json_decode($customer->send_otp_token(get_user_meta($id,'mo_2factor_map_id_with_email',true),'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
244
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
245
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
246
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
247
+ $_SESSION['mo2f-login-message'] = 'A one time passcode has been sent to <b>' . MO2f_Utility::mo2f_get_hiden_email(get_user_meta($id,'mo_2factor_map_id_with_email',true) ) . '</b>. Please enter the OTP to verify your identity.';
248
+ $_SESSION[ 'mo2f-login-transactionId' ] = $content['txId'];
249
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
250
+ $this->mo_auth_show_success_message();
251
+ }else{
252
+ $_SESSION['mo2f-login-message'] = 'Error:OTP over Email';
253
+ $this->mo_auth_show_success_message();
254
+ }
255
+ }
256
+ }
257
+ }
258
+
259
+ if(isset($_POST['miniorange_softtoken'])){ /*Click on the link of phone is offline */
260
+ $nonce = $_POST['miniorange_softtoken'];
261
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-softtoken' ) ) {
262
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
263
+ $this->mo_auth_show_error_message();
264
+ } else{
265
+ $this->miniorange_login_start_session();
266
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
267
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
268
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the miniOrange authenticator app.';
269
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
270
+ }
271
+ }
272
+
273
+ if (isset($_POST['miniorange_soft_token_nonce'])){ /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
274
+ $nonce = $_POST['miniorange_soft_token_nonce'];
275
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-soft-token-nonce' ) ) {
276
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
277
+ $this->mo_auth_show_error_message();
278
+ } else {
279
+ $this->miniorange_login_start_session();
280
+ $softtoken = '';
281
+ if( MO2f_utility::mo2f_check_empty_or_null( $_POST[ 'mo2fa_softtoken' ] ) ) {
282
+ $_SESSION['mo2f-login-message'] = 'Please enter OTP to proceed';
283
+ $this->mo_auth_show_error_message();
284
+ return;
285
+ } else{
286
+ $softtoken = sanitize_text_field( $_POST[ 'mo2fa_softtoken' ] );
287
+ if(!MO2f_utility::mo2f_check_number_length($softtoken)){
288
+ $_SESSION['mo2f-login-message'] = 'Invalid OTP. Only digits within range 4-8 are allowed. Please try again.';
289
+ return;
290
+ }
291
+ }
292
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
293
+ if(isset($_SESSION[ 'mo2f_current_user' ])){
294
+ $customer = new Customer_Setup();
295
+ $content ='';
296
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL'){
297
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
298
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS'){
299
+ $content = json_decode($customer->validate_otp_token( 'SMS', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
300
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION'){
301
+ $content = json_decode($customer->validate_otp_token( 'PHONE VERIFICATION', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
302
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN'){
303
+ $content = json_decode($customer->validate_otp_token( 'SOFT TOKEN', get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true), null, $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
304
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION'){
305
+ $content = json_decode($customer->validate_otp_token( 'GOOGLE AUTHENTICATOR', get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true), null, $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
306
+ }else{
307
+ $this->remove_current_activity();
308
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again.';
309
+ $this->mo_auth_show_error_message();
310
+ }
311
+
312
+ if( username_exists( $currentuser->user_login )) { // user is a member
313
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
314
+ remove_filter('authenticate', 'wp_authenticate_username_password', 10, 3);
315
+ add_filter('authenticate', array($this, 'mo2fa_login'), 10, 3);
316
+ }else{
317
+ $message = $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ? 'Invalid OTP ...Possible causes <br />1. You mis-typed the OTP, find the OTP again and type it. <br /> 2. Your phone time is not in sync with miniOrange servers. <br /><b>How to sync?</b> In the app,tap on Settings icon and then press Sync button.' : 'Invalid OTP. Please try again';
318
+ $_SESSION['mo2f-login-message'] = $message;
319
+ $this->mo_auth_show_error_message();
320
+ }
321
+ }else{
322
+ $this->remove_current_activity();
323
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
324
+ $this->mo_auth_show_error_message();
325
+ }
326
+ }else{
327
+ $this->remove_current_activity();
328
+ $_SESSION['mo2f-login-message'] = 'Invalid request.';
329
+ $this->mo_auth_show_error_message();
330
+ }
331
+ }
332
+ }
333
+ }
334
+
335
+ function remove_current_activity(){
336
+ unset($_SESSION[ 'mo2f_current_user' ]);
337
+ unset($_SESSION[ 'mo_2factor_login_status' ]);
338
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
339
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
340
+ unset($_SESSION[ 'mo2f-login-message' ]);
341
+ unset($_SESSION[ 'mo_2_factor_kba_questions' ]);
342
+ }
343
+
344
+ function mo2fa_login(){
345
+ if(isset($_SESSION[ 'mo2f_current_user' ])){
346
+ $currentuser = unserialize($_SESSION[ 'mo2f_current_user' ]);
347
+ $user_id = $currentuser->ID;
348
+ wp_set_current_user($user_id, $currentuser->user_login);
349
+ $this->remove_current_activity();
350
+ do_action( 'wp_login', $currentuser->user_login, $currentuser );
351
+ wp_set_auth_cookie( $user_id, true );
352
+ redirect_user_to($currentuser);
353
+ exit;
354
+ }else{
355
+ $this->remove_current_activity();
356
+ }
357
+ }
358
+
359
+
360
+
361
+ function mo2fa_default_login($user,$username,$password){
362
+ $currentuser = wp_authenticate_username_password($user, $username, $password);
363
+ if (is_wp_error($currentuser)) {
364
+ return $currentuser;
365
+ }else{
366
+ $this->miniorange_login_start_session();
367
+ $roles = $currentuser->roles;
368
+ $current_role = array_shift($roles);
369
+
370
+ if(get_option('mo2fa_'.$current_role)){
371
+ if(get_user_meta($currentuser->ID,'mo_2factor_mobile_registration_status',true) == 'MO_2_FACTOR_SUCCESS'){ // for existing users
372
+ $error = new WP_Error();
373
+ $error->add('empty_username', __('<strong>ERROR</strong>: Login with password is disabled for you.Please Login using your phone'));
374
+ return $error;
375
+ }else if(get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true) && get_user_meta($currentuser->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ //checking if user has configured any 2nd factor method
376
+ $error = new WP_Error();
377
+ $error->add('empty_username', __('<strong>ERROR</strong>: Login with password is disabled for you.Please Login using your phone'));
378
+ return $error;
379
+ }else{ //if user has not configured any 2nd factor method then logged him in without asking 2nd factor
380
+ $this->mo2f_verify_and_authenticate_userlogin($currentuser);
381
+ }
382
+ }else{ //plugin is not activated for non-admin then logged him in
383
+ $this->mo2f_verify_and_authenticate_userlogin($currentuser);
384
+ }
385
+ }
386
+ }
387
+
388
+ function mo2f_verify_and_authenticate_userlogin($user){
389
+
390
+ $user_id = $user->ID;
391
+ $this->remove_current_activity();
392
+ do_action( 'wp_login', $user->user_login, $user );
393
+ wp_set_auth_cookie( $user_id, true );
394
+ redirect_user_to($user);
395
+ exit;
396
+
397
+ }
398
+
399
+ function mo2f_login_push_oobemail_verification($user,$mo2f_second_factor){
400
+ $challengeMobile = new Customer_Setup();
401
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true),$mo2f_second_factor ,get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
402
+ $response = json_decode($content, true);
403
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
404
+ if($response['status'] == 'SUCCESS'){
405
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
406
+ $_SESSION['mo2f-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_hiden_email(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true)) . '. We are waiting for your approval.';
407
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
408
+ }else if($response['status'] == 'ERROR' || $response['status'] == 'FAILED' ){
409
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
410
+ $_SESSION['mo2f-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.';
411
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
412
+ }
413
+ }else{
414
+ $this->remove_current_activity();
415
+ $error = new WP_Error();
416
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
417
+ return $error;
418
+ }
419
+ }
420
+
421
+ function mo2f_login_otp_verification($user,$mo2f_second_factor){
422
+ if($mo2f_second_factor == 'SOFT TOKEN'){
423
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the <b>miniOrange Authenticator</b> app.';
424
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
425
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
426
+ $_SESSION['mo2f-login-message'] = get_user_meta($user->ID,'mo2f_external_app_type',true) == 'AUTHY 2-FACTOR AUTHENTICATION' ? 'Please enter the one time passcode shown in the <b>Authy 2-Factor Authentication</b> app.' : 'Please enter the one time passcode shown in the <b>Google Authenticator</b> app.';
427
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION';
428
+ }else{
429
+ $challengeMobile = new Customer_Setup();
430
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), $mo2f_second_factor,get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
431
+ $response = json_decode($content, true);
432
+ if(json_last_error() == JSON_ERROR_NONE) {
433
+ if($response['status'] == 'SUCCESS'){
434
+ $message = $mo2f_second_factor == 'SMS' ? 'The OTP has been sent to '. MO2f_Utility::get_hidden_phone($response['phoneDelivery']['contact']) . '. Please enter the OTP you received to Validate.' : 'You will receive phone call on ' . MO2f_Utility::get_hidden_phone($response['phoneDelivery']['contact']) . ' with OTP. Please enter the OTP to Validate.';
435
+ $_SESSION['mo2f-login-message'] = $message;
436
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response[ 'txId' ];
437
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'SMS' ? 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' : 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION';
438
+ }else{
439
+ $message = $mo2f_second_factor == 'SMS' ? $response['message'] . ' You can click on <b>Forgot your phone</b> link to login via alternate method.' : 'We are unable to send the OTP via phone call on your regsitared phone. You can click on <b>Forgot your phone</b> link to receive OTP to your registered email.';
440
+ $_SESSION['mo2f-login-message'] = $message;
441
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response[ 'txId' ];
442
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'SMS' ? 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' : 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION';
443
+ }
444
+ }else{
445
+ $this->remove_current_activity();
446
+ $error = new WP_Error();
447
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
448
+ $this->mo_auth_show_error_message();
449
+ }
450
+ }
451
+ }
452
+
453
+ function mo2f_login_kba_verification($user){
454
+ $challengeKba = new Customer_Setup();
455
+ $content = $challengeKba->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), 'KBA',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
456
+ $response = json_decode($content, true);
457
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
458
+ if($response['status'] == 'SUCCESS'){
459
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
460
+ $questions = array();
461
+ $questions[0] = $response['questions'][0]['question'];
462
+ $questions[1] = $response['questions'][1]['question'];
463
+ $_SESSION[ 'mo_2_factor_kba_questions' ] = $questions;
464
+ $_SESSION['mo2f-login-message'] = 'Please answer the following questions:';
465
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
466
+ }else if($response['status'] == 'ERROR'){
467
+ $this->remove_current_activity();
468
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
469
+ $this->mo_auth_show_error_message();
470
+ }
471
+ }else{
472
+ $this->remove_current_activity();
473
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
474
+ $this->mo_auth_show_error_message();
475
+ }
476
+ }
477
+
478
+ function mo2f_login_mobile_verification($user){
479
+
480
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
481
+ if(MO2f_Utility::check_if_request_is_from_mobile_device($useragent)){
482
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
483
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
484
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the miniOrange Authenticator app.';
485
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
486
+ }else{
487
+ $challengeMobile = new Customer_Setup();
488
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), 'MOBILE AUTHENTICATION',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
489
+ $response = json_decode($content, true);
490
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
491
+ if($response['status'] == 'SUCCESS'){
492
+
493
+ $_SESSION[ 'mo2f-login-qrCode' ] = $response['qrCode'];
494
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
495
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
496
+ }else if($response['status'] == 'ERROR'){
497
+ $this->remove_current_activity();
498
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
499
+ $this->mo_auth_show_error_message();
500
+ }
501
+ }else{
502
+ $this->remove_current_activity();
503
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
504
+ $this->mo_auth_show_error_message();
505
+ }
506
+ }
507
+
508
+ }
509
+
510
+ function mo2f_redirectto_wp_login(){
511
+ remove_action('login_enqueue_scripts', array( $this, 'mo_2_factor_hide_login'));
512
+ add_action('login_dequeue_scripts', array( $this, 'mo_2_factor_show_login'));
513
+ if(get_option('mo2f_show_loginwith_phone')){
514
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_LOGIN_WHEN_PHONELOGIN_ENABLED';
515
+ }else{
516
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SHOW_USERPASS_LOGIN_FORM';
517
+ }
518
+ }
519
+
520
+ public function custom_login_enqueue_scripts(){
521
+ wp_enqueue_script('jquery');
522
+ wp_enqueue_script( 'bootstrap_script', plugins_url('includes/js/bootstrap.min.js', __FILE__ ));
523
+ }
524
+
525
+ public function mo_2_factor_hide_login() {
526
+ wp_register_style( 'hide-login', plugins_url( 'includes/css/hide-login.css?version=4.1.3', __FILE__ ) );
527
+ wp_register_style( 'bootstrap', plugins_url( 'includes/css/bootstrap.min.css?version=4.1.3', __FILE__ ) );
528
+
529
+ wp_enqueue_style( 'hide-login' );
530
+ wp_enqueue_style( 'bootstrap' );
531
+
532
+ }
533
+
534
+ function mo_2_factor_show_login() {
535
+ if(get_option('mo2f_show_loginwith_phone')){
536
+ wp_register_style( 'show-login', plugins_url( 'includes/css/hide-login-form.css?version=4.1.3', __FILE__ ) );
537
+ }else{
538
+ wp_register_style( 'show-login', plugins_url( 'includes/css/show-login.css?version=4.1.3', __FILE__ ) );
539
+ }
540
+ wp_enqueue_style( 'show-login' );
541
+ }
542
+
543
+ function mo_2_factor_show_login_with_password_when_phonelogin_enabled(){
544
+ wp_register_style( 'show-login', plugins_url( 'includes/css/show-login.css?version=4.1.3', __FILE__ ) );
545
+ wp_enqueue_style( 'show-login' );
546
+ }
547
+
548
+ function mo_auth_success_message() {
549
+ $message = $_SESSION['mo2f-login-message'];
550
+ return "<div> <p class='message'>" . $message . "</p></div>";
551
+ }
552
+
553
+ function mo_auth_error_message() {
554
+ $id = "login_error1";
555
+ $message = $_SESSION['mo2f-login-message'];
556
+ return "<div id='" . $id . "'> <p>" . $message . "</p></div>";
557
+ }
558
+
559
+ private function mo_auth_show_error_message() {
560
+ remove_filter( 'login_message', array( $this, 'mo_auth_success_message') );
561
+ add_filter( 'login_message', array( $this, 'mo_auth_error_message') );
562
+ }
563
+
564
+ private function mo_auth_show_success_message() {
565
+ remove_filter( 'login_message', array( $this, 'mo_auth_error_message') );
566
+ add_filter( 'login_message', array( $this, 'mo_auth_success_message') );
567
+ }
568
+
569
+
570
+
571
+
572
+ // login form fields
573
+ public function miniorange_login_form_fields() {
574
+ //$this->miniorange_login_start_session();
575
+ $current_user = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
576
+ $id = isset($current_user) ? $current_user->ID : null;
577
+ if(!get_option('mo2f_show_loginwith_phone')){ //Login with phone is alogin with default login form
578
+ $login_status = isset($_SESSION[ 'mo_2factor_login_status' ]) ? $_SESSION[ 'mo_2factor_login_status' ] : null;
579
+ if($this->miniorange_check_mobile_status($login_status)){
580
+ $this->mo_2_factor_show_qr_code();
581
+ }else if($this->miniorange_check_otp_status($login_status)){
582
+ $this->mo_2_factor_show_otp_token();
583
+ }else if($this->miniorange_check_forgotphone_status($login_status)){ // forgot phone page if both KBA and Email are configured.
584
+ $this->mo_2_factor_show_forgotphone();
585
+ }else if($this->miniorange_check_push_oobemail_status($login_status)){ //for push and out of band email.
586
+ $this->mo_2_factor_show_push_oobemail($id);
587
+ }else if($this->miniorange_login_check_kba_status($login_status)){ // for Kba
588
+ $this->mo_2_factor_login_show_kba();
589
+ }else if($login_status == 'MO_2_FACTOR_SHOW_USERPASS_LOGIN_FORM'){
590
+ $this->mo_2_factor_show_login();
591
+ $this->mo_2_factor_show_wp_login_form();
592
+ }else{
593
+ $this->mo_2_factor_show_login();
594
+ $this->mo_2_factor_show_wp_login_form();
595
+ }
596
+ }else{ //login with phone overwrite default login form
597
+
598
+ $login_status_phone_enable = isset($_SESSION[ 'mo_2factor_login_status' ]) ? $_SESSION[ 'mo_2factor_login_status' ] : '';
599
+ if($this->miniorange_check_mobile_status($login_status_phone_enable)){
600
+ $this->mo_2_factor_show_qr_code();
601
+ }else if($this->miniorange_check_otp_status($login_status_phone_enable)){
602
+ $this->mo_2_factor_show_otp_token();
603
+ }else if($this->miniorange_check_forgotphone_status($login_status_phone_enable)){ // forgot phone page if both KBA and Email are configured.
604
+ $this->mo_2_factor_show_forgotphone();
605
+ }else if($this->miniorange_login_check_kba_status($login_status_phone_enable)){ // for Kba
606
+ $this->mo_2_factor_login_show_kba();
607
+ }else if($this->miniorange_check_push_oobemail_status($login_status_phone_enable)){ //for push and out of band email.
608
+ $this->mo_2_factor_show_push_oobemail($id);
609
+ }else if($login_status_phone_enable == 'MO_2_FACTOR_LOGIN_WHEN_PHONELOGIN_ENABLED' && isset($_POST['miniorange_login_nonce']) && wp_verify_nonce( $_POST['miniorange_login_nonce'], 'miniorange-2-factor-login-nonce' )){
610
+ $this->mo_2_factor_show_login_with_password_when_phonelogin_enabled();
611
+ $this->mo_2_factor_show_wp_login_form_when_phonelogin_enabled();
612
+ $current_user = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
613
+ ?><script>
614
+ jQuery('#user_login').val(<?php echo "'" . $current_user->user_login . "'"; ?>);
615
+ </script><?php
616
+ }else{
617
+ $this->mo_2_factor_show_login();
618
+ $this->mo_2_factor_show_wp_login_form();
619
+ }
620
+ }
621
+ }
622
+
623
+ function miniorange_check_forgotphone_status($login_status){ // after clicking on forgotphone link when both kba and email are configured
624
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL'){
625
+ $nonce = '';
626
+ if(isset($_POST['miniorange_forgotphone'])){
627
+ $nonce = $_POST['miniorange_forgotphone'];
628
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
629
+ return true;
630
+ }
631
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
632
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
633
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
634
+ return true;
635
+ }
636
+ }
637
+ }
638
+ return false;
639
+ }
640
+
641
+ function miniorange_check_push_oobemail_status($login_status){
642
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL'){
643
+ $nonce = '';
644
+
645
+ if(isset($_POST['miniorange_login_nonce']) ){
646
+ $nonce = $_POST['miniorange_login_nonce'];
647
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
648
+ return true;
649
+ }
650
+ }else if(isset($_POST['miniorange_forgotphone'])){
651
+ $nonce = $_POST['miniorange_forgotphone'];
652
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
653
+ return true;
654
+ }
655
+ }
656
+ }
657
+ return false;
658
+ }
659
+
660
+ function miniorange_check_mobile_status($login_status){
661
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION'){
662
+ $nonce = '';
663
+ if(isset($_POST['miniorange_login_nonce']) ){
664
+ $nonce = $_POST['miniorange_login_nonce'];
665
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
666
+ return true;
667
+ }
668
+ }else if(isset($_POST['miniorange_forgotphone'])){
669
+ $nonce = $_POST['miniorange_forgotphone'];
670
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
671
+ return true;
672
+ }
673
+ }
674
+ }
675
+ return false;
676
+ }
677
+
678
+ function miniorange_check_otp_status($login_status){
679
+ 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'){
680
+ $nonce = '';
681
+
682
+ if(isset($_POST['miniorange_login_nonce']) ){
683
+ $nonce = $_POST['miniorange_login_nonce'];
684
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
685
+ return true;
686
+ }
687
+ }
688
+ if(isset($_POST['miniorange_softtoken'])){
689
+ $nonce = $_POST['miniorange_softtoken'];
690
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-softtoken')){
691
+ return true;
692
+ }
693
+ }else if(isset($_POST['miniorange_forgotphone'])){
694
+ $nonce = $_POST['miniorange_forgotphone'];
695
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
696
+ return true;
697
+ }
698
+ }else if(isset($_POST['miniorange_soft_token_nonce'])){
699
+ $nonce = $_POST['miniorange_soft_token_nonce'];
700
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-soft-token-nonce')){
701
+ return true;
702
+ }
703
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
704
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
705
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
706
+ return true;
707
+ }
708
+ }
709
+ }
710
+ return false;
711
+ }
712
+
713
+ function miniorange_login_check_kba_status($login_status){
714
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION'){
715
+ $nonce = '';
716
+ if(isset($_POST['miniorange_login_nonce']) ){
717
+ $nonce = $_POST['miniorange_login_nonce'];
718
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
719
+ return true;
720
+ }
721
+ }else if(isset($_POST['miniorange_kba_nonce']) ){
722
+ $nonce = $_POST['miniorange_kba_nonce'];
723
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' )){
724
+ return true;
725
+ }
726
+ }else if(isset($_POST['miniorange_alternate_login_kba_nonce'])){
727
+ $nonce = $_POST['miniorange_alternate_login_kba_nonce'];
728
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' )){
729
+ return true;
730
+ }
731
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
732
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
733
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
734
+ return true;
735
+ }
736
+ }
737
+ }
738
+ return false;
739
+ }
740
+
741
+ function miniorange_login_footer_form(){
742
+
743
+ ?>
744
+ <form name="f" id="mo2f_show_softtoken_loginform" method="post" action="" hidden>
745
+ <input type="hidden" name="miniorange_softtoken" value="<?php echo wp_create_nonce('miniorange-2-factor-softtoken'); ?>" />
746
+ </form>
747
+ <form name="f" id="mo2f_show_forgotphone_loginform" method="post" action="" hidden>
748
+ <input type="hidden" name="miniorange_forgotphone" value="<?php echo wp_create_nonce('miniorange-2-factor-forgotphone'); ?>" />
749
+ </form>
750
+ <form name="f" id="mo2f_backto_mo_loginform" method="post" action="<?php echo wp_login_url(); ?>" hidden>
751
+ <input type="hidden" name="miniorange_mobile_validation_failed_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-mobile-validation-failed-nonce'); ?>" />
752
+ </form>
753
+ <form name="f" id="mo2f_alternate_login_kbaform" method="post" action="" style="display:none;">
754
+ <input type="hidden" name="miniorange_alternate_login_kba_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-alternate-login-kba-nonce'); ?>" />
755
+ </form>
756
+ <form name="f" id="mo2f_challenge_forgotphone_form" method="post" action="" style="display:none;">
757
+ <input type="hidden" name="mo2f_selected_2factor_method" />
758
+ <input type="hidden" name="miniorange_challenge_forgotphone_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-challenge-forgotphone-nonce'); ?>" />
759
+ </form>
760
+ <form name="f" id="mo2f_mobile_validation_form" method="post" action="" hidden>
761
+ <input type="hidden" name="miniorange_mobile_validation_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-mobile-validation-nonce'); ?>" />
762
+ </form>
763
+ <form name="f" id="mo2f_show_qrcode_loginform" method="post" action="" hidden>
764
+ <input type="text" name="mo2fa_username" id="mo2fa_username" hidden/>
765
+ <input type="hidden" name="miniorange_login_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-login-nonce'); ?>" />
766
+ </form>
767
+ <form name="f" id="mo2f_submitotp_loginform" method="post" action="" hidden>
768
+ <input type="text" name="mo2fa_softtoken" id="mo2fa_softtoken" hidden/>
769
+ <input type="hidden" name="miniorange_soft_token_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-soft-token-nonce'); ?>" />
770
+ </form>
771
+ <form name="f" id="mo2f_submitkba_loginform" method="post" action="" style="display:none;">
772
+ <input type="text" name="mo2f_answer_1" id="mo2f_answer_1" hidden />
773
+ <input type="text" name="mo2f_answer_2" id="mo2f_answer_1" hidden />
774
+ <input type="text" name="mo2f_trust_device" id="mo2f_trust_device" hidden />
775
+ <input type="hidden" name="miniorange_kba_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-kba-nonce'); ?>" />
776
+ </form>
777
+
778
+ <?php
779
+ }
780
+
781
+ function mo_2_factor_show_wp_login_form_when_phonelogin_enabled(){
782
+ ?>
783
+ <script>
784
+ var content = '<a href="javascript:void(0)" id="backto_mo" onClick="mo2fa_backtomologin()" style="float:right">← Back</a>';
785
+ jQuery('#login').append(content);
786
+ function mo2fa_backtomologin(){
787
+ jQuery('#mo2f_backto_mo_loginform').submit();
788
+ }
789
+ </script>
790
+ <?php
791
+ }
792
+
793
+ function mo_2_factor_show_wp_login_form(){
794
+ ?>
795
+ <div class="mo2f-login-container">
796
+ <?php if(!get_option('mo2f_show_loginwith_phone')){ ?>
797
+ <div style="position: relative" class="or-container">
798
+ <div style="border-bottom: 1px solid #EEE; width: 90%; margin: 0 5%; z-index: 1; top: 50%; position: absolute;"></div>
799
+ <h2 style="color: #666; margin: 0 auto 20px auto; padding: 3px 0; text-align:center; background: white; width: 20%; position:relative; z-index: 2;">or</h2>
800
+ </div>
801
+ <?php } ?>
802
+ <div class="mo2f-button-container" id="mo2f_button_container">
803
+ <input type="text" name="mo2fa_usernamekey" id="mo2fa_usernamekey" autofocus="true" placeholder="Username"/>
804
+ <p>
805
+ <input type="button" name="miniorange_login_submit" style="width:100% !important;" onclick="mouserloginsubmit();" id="miniorange_login_submit" class="miniorange-button button-add" value="Login with your phone" />
806
+ </p>
807
+ <?php if(!get_option('mo2f_show_loginwith_phone')){ ?><br /><br /><?php } ?>
808
+ </div>
809
+ </div>
810
+
811
+ <script>
812
+ jQuery(window).scrollTop(jQuery('#mo2f_button_container').offset().top);
813
+ function mouserloginsubmit(){
814
+ var username = jQuery('#mo2fa_usernamekey').val();
815
+ document.getElementById("mo2f_show_qrcode_loginform").elements[0].value = username;
816
+ jQuery('#mo2f_show_qrcode_loginform').submit();
817
+
818
+ }
819
+
820
+ jQuery('#mo2fa_usernamekey').keypress(function(e){
821
+ if(e.which == 13){//Enter key pressed
822
+ e.preventDefault();
823
+ var username = jQuery('#mo2fa_usernamekey').val();
824
+ document.getElementById("mo2f_show_qrcode_loginform").elements[0].value = username;
825
+ jQuery('#mo2f_show_qrcode_loginform').submit();
826
+ }
827
+
828
+ });
829
+ </script>
830
+ <?php
831
+ }
832
+ public function mo_2_factor_show_push_oobemail($id){
833
+ mo2f_getpush_oobemail_response($id);
834
+ }
835
+
836
+ public function mo_2_factor_show_otp_token(){
837
+ mo2f_getotp_form();
838
+ }
839
+
840
+ public function mo_2_factor_show_qr_code(){
841
+ mo2f_getqrcode();
842
+ }
843
+
844
+ function mo_2_factor_login_show_kba(){
845
+ mo2f_getkba_form();
846
+ }
847
+
848
+ function mo_2_factor_show_forgotphone(){
849
+ mo2f_get_forgotphone_form();
850
+ }
851
+ }
852
+ ?>
class-miniorange-2-factor-pass2fa-login.php ADDED
@@ -0,0 +1,1912 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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_once dirname( __FILE__ ) . '/miniorange_2_factor_common_login.php';
26
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_user_inline_registration.php';
27
+ include_once dirname( __FILE__ ) . '/class-rba-attributes.php';
28
+
29
+ class Miniorange_Password_2Factor_Login{
30
+
31
+ function remove_current_activity(){
32
+ unset($_SESSION[ 'mo2f_current_user' ]);
33
+ unset($_SESSION[ 'mo2f_1stfactor_status' ]);
34
+ unset($_SESSION[ 'mo_2factor_login_status' ]);
35
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
36
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
37
+ unset($_SESSION[ 'mo2f-login-message' ]);
38
+ unset($_SESSION[ 'mo2f_rba_status' ]);
39
+ unset($_SESSION[ 'mo_2_factor_kba_questions' ]);
40
+ unset($_SESSION[ 'mo2f_show_qr_code']);
41
+ unset($_SESSION['mo2f_google_auth']);
42
+ unset($_SESSION['mo2f_authy_keys']);
43
+
44
+ }
45
+
46
+ function mo2fa_pass2login(){
47
+ if(isset($_SESSION[ 'mo2f_current_user' ]) && isset($_SESSION[ 'mo2f_1stfactor_status' ]) && $_SESSION[ 'mo2f_1stfactor_status' ] = 'VALIDATE_SUCCESS'){
48
+ $currentuser = unserialize($_SESSION[ 'mo2f_current_user' ]);
49
+ $user_id = $currentuser->ID;
50
+ wp_set_current_user($user_id, $currentuser->user_login);
51
+ $this->remove_current_activity();
52
+ wp_set_auth_cookie( $user_id, true );
53
+ do_action( 'wp_login', $currentuser->user_login, $currentuser );
54
+ redirect_user_to($currentuser);
55
+ exit;
56
+ }else{
57
+ $this->remove_current_activity();
58
+ }
59
+ }
60
+
61
+ public function miniorange_pass2login_start_session(){
62
+ if( ! session_id() || session_id() == '' || !isset($_SESSION) ) {
63
+ session_start();
64
+ }
65
+ }
66
+
67
+ public function miniorange_pass2login_redirect() {
68
+
69
+ if(isset($_POST['mo2f_trust_device_confirm_nonce'])){ /*register device as rba profile */
70
+ $nonce = $_POST['mo2f_trust_device_confirm_nonce'];
71
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-confirm-nonce' ) ) {
72
+ $this->remove_current_activity();
73
+ $error = new WP_Error();
74
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
75
+ return $error;
76
+ } else {
77
+ $this->miniorange_pass2login_start_session();
78
+ try{
79
+ $currentuser = unserialize($_SESSION[ 'mo2f_current_user' ]);
80
+ mo2f_register_profile(get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true),'true',$_SESSION[ 'mo2f_rba_status' ]);
81
+ }catch(Exception $e){
82
+ echo $e->getMessage();
83
+ }
84
+ $this->mo2fa_pass2login();
85
+ }
86
+ }
87
+
88
+ if(isset($_POST['mo2f_trust_device_cancel_nonce'])){ /*do not register device as rba profile */
89
+ $nonce = $_POST['mo2f_trust_device_cancel_nonce'];
90
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-trust-device-cancel-nonce' ) ) {
91
+ $error = new WP_Error();
92
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
93
+ return $error;
94
+ } else {
95
+ $this->miniorange_pass2login_start_session();
96
+ $this->mo2fa_pass2login();
97
+ }
98
+ }
99
+
100
+ if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){ /*check kba validation*/
101
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
102
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
103
+ $error = new WP_Error();
104
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
105
+ return $error;
106
+ }else {
107
+ $this->miniorange_pass2login_start_session();
108
+ $second_factor = isset($_POST[ 'mo2f_selected_2factor_method' ]) ? $_POST[ 'mo2f_selected_2factor_method' ] : 'KBA';
109
+ if($second_factor == 'OTP OVER EMAIL'){
110
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
111
+ $id = $current_user->ID;
112
+ $customer = new Customer_Setup();
113
+ $content = json_decode($customer->send_otp_token(get_user_meta($id,'mo_2factor_map_id_with_email',true),'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
114
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
115
+ $_SESSION['mo2f-login-message'] = 'A one time passcode has been sent to <b>' . MO2f_Utility::mo2f_get_hiden_email(get_user_meta($id,'mo_2factor_map_id_with_email',true) ) . '</b>. Please enter the OTP to verify your identity.';
116
+ $_SESSION[ 'mo2f-login-transactionId' ] = $content['txId'];
117
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' ;
118
+ }else{
119
+ $_SESSION['mo2f-login-message'] = 'Error occured while sending OTP over your regsitered email. Please try again or select Security Questions (KBA) to login.';
120
+ }
121
+ }else{
122
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
123
+ $this->mo2f_pass2login_kba_verification($current_user);
124
+ }
125
+ }
126
+ }
127
+
128
+ if(isset($_POST['miniorange_alternate_login_kba_nonce'])){ /*check kba validation*/
129
+ $nonce = $_POST['miniorange_alternate_login_kba_nonce'];
130
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' ) ) {
131
+ $error = new WP_Error();
132
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
133
+ return $error;
134
+ }else {
135
+ $this->miniorange_pass2login_start_session();
136
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
137
+ $this->mo2f_pass2login_kba_verification($currentuser);
138
+ }
139
+ }
140
+
141
+ if(isset($_POST['miniorange_kba_nonce'])){ /*check kba validation*/
142
+ $nonce = $_POST['miniorange_kba_nonce'];
143
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' ) ) {
144
+ $error = new WP_Error();
145
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
146
+ return $error;
147
+ } else {
148
+ $this->miniorange_pass2login_start_session();
149
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
150
+ if(isset($_SESSION[ 'mo2f_current_user' ])){
151
+ if(MO2f_Utility::mo2f_check_empty_or_null($_POST[ 'mo2f_answer_1' ]) || MO2f_Utility::mo2f_check_empty_or_null($_POST[ 'mo2f_answer_2' ])){
152
+ return;
153
+ }
154
+ $otpToken = array();
155
+ $otpToken[0] = $_SESSION['mo_2_factor_kba_questions'][0];
156
+ $otpToken[1] = sanitize_text_field( $_POST[ 'mo2f_answer_1' ] );
157
+ $otpToken[2] = $_SESSION['mo_2_factor_kba_questions'][1];
158
+ $otpToken[3] = sanitize_text_field( $_POST[ 'mo2f_answer_2' ] );
159
+ $check_trust_device = sanitize_text_field( $_POST[ 'mo2f_trust_device' ] );
160
+
161
+ $kba_validate = new Customer_Setup();
162
+ $kba_validate_response = json_decode($kba_validate->validate_otp_token( 'KBA', null, $_SESSION[ 'mo2f-login-transactionId' ], $otpToken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
163
+
164
+ if(strcasecmp($kba_validate_response['status'], 'SUCCESS') == 0) {
165
+ if(get_option('mo2f_deviceid_enabled') && $check_trust_device == 'true'){
166
+ try{
167
+ mo2f_register_profile(get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true),'true',$_SESSION[ 'mo2f_rba_status' ]);
168
+ }catch(Exception $e){
169
+ echo $e->getMessage();
170
+ }
171
+ $this->mo2fa_pass2login();
172
+ }else{
173
+ $this->mo2fa_pass2login();
174
+ }
175
+ }else{
176
+
177
+ $_SESSION[ 'mo2f-login-message' ] = 'The answers you have provided are incorrect.';
178
+ }
179
+ }else{
180
+ $this->remove_current_activity();
181
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Please try again..'));
182
+ }
183
+ }
184
+ }
185
+
186
+ if(isset($_POST['miniorange_mobile_validation_nonce'])){ /*check mobile validation */
187
+
188
+ $nonce = $_POST['miniorange_mobile_validation_nonce'];
189
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-nonce' ) ) {
190
+ $error = new WP_Error();
191
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
192
+ return $error;
193
+ } else {
194
+ $this->miniorange_pass2login_start_session();
195
+ $currentuser = unserialize($_SESSION[ 'mo2f_current_user' ]);
196
+ $checkMobileStatus = new Two_Factor_Setup();
197
+ $content = $checkMobileStatus->check_mobile_status($_SESSION[ 'mo2f-login-transactionId' ]);
198
+ $response = json_decode($content, true);
199
+ if(json_last_error() == JSON_ERROR_NONE) {
200
+ if($response['status'] == 'SUCCESS'){
201
+ if(get_option('mo2f_deviceid_enabled')){
202
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
203
+ }else{
204
+ $this->mo2fa_pass2login();
205
+ }
206
+ }else{
207
+ $this->remove_current_activity();
208
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Please try again.'));
209
+ }
210
+ }else{
211
+ $this->remove_current_activity();
212
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Please try again.'));
213
+ }
214
+ }
215
+ }
216
+
217
+ if (isset($_POST['miniorange_mobile_validation_failed_nonce'])){ /*Back to miniOrange Login Page if mobile validation failed and from back button of mobile challenge, soft token and default login*/
218
+ $nonce = $_POST['miniorange_mobile_validation_failed_nonce'];
219
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-mobile-validation-failed-nonce' ) ) {
220
+ $error = new WP_Error();
221
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
222
+ return $error;
223
+ } else {
224
+ $this->miniorange_pass2login_start_session();
225
+ $this->remove_current_activity();
226
+ }
227
+ }
228
+
229
+ if(isset($_POST['miniorange_forgotphone'])){ /*Click on the link of forgotphone */
230
+ $nonce = $_POST['miniorange_forgotphone'];
231
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-forgotphone' ) ) {
232
+ $error = new WP_Error();
233
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
234
+ return $error;
235
+ } else{
236
+ $this->miniorange_pass2login_start_session();
237
+ $customer = new Customer_Setup();
238
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
239
+ $id = $current_user->ID;
240
+ if(get_user_meta($id,'mo2f_kba_registration_status',true)){
241
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL';
242
+ unset($_SESSION['mo2f-login-message']);
243
+ }else{
244
+ $content = json_decode($customer->send_otp_token(get_user_meta($id,'mo_2factor_map_id_with_email',true),'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
245
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
246
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
247
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
248
+ $_SESSION['mo2f-login-message'] = 'A one time passcode has been sent to <b>' . MO2f_Utility::mo2f_get_hiden_email(get_user_meta($id,'mo_2factor_map_id_with_email',true) ) . '</b>. Please enter the OTP to verify your identity.';
249
+ $_SESSION[ 'mo2f-login-transactionId' ] = $content['txId'];
250
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL';
251
+ }else{
252
+ $_SESSION['mo2f-login-message'] = 'Error:OTP over Email';
253
+ }
254
+ }
255
+ }
256
+ }
257
+
258
+ if ( isset($_POST['miniorange_inline_user_reg_nonce'])){
259
+
260
+ $nonce = $_POST['miniorange_inline_user_reg_nonce'];
261
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-user-reg-nonce' ) ) {
262
+ $error = new WP_Error();
263
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
264
+ return $error;
265
+ } else {
266
+ $this->miniorange_pass2login_start_session();
267
+ $email = '';
268
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo_useremail'] )){
269
+ $_SESSION['mo2f-login-message'] = 'Please enter email-id to register.';
270
+ return;
271
+ }else{
272
+ $email = sanitize_email( $_POST['mo_useremail'] );
273
+ }
274
+
275
+ if(!MO2f_Utility::check_if_email_is_already_registered($email)){
276
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
277
+ $currentUserId = $current_user->ID;
278
+ update_user_meta($currentUserId,'mo_2factor_user_email',$email);
279
+
280
+ $enduser = new Two_Factor_Setup();
281
+ $check_user = json_decode($enduser->mo_check_user_already_exist($email),true);
282
+ if(json_last_error() == JSON_ERROR_NONE){
283
+ if($check_user['status'] == 'ERROR'){
284
+ $_SESSION['mo2f-login-message'] = $check_user['message'];
285
+
286
+ return;
287
+ }else if(strcasecmp($check_user['status'], 'USER_FOUND_UNDER_DIFFERENT_CUSTOMER') == 0){
288
+ $_SESSION['mo2f-login-message'] = 'The email you entered is already registered. Please register with another email to set up Two-Factor.';
289
+
290
+ return;
291
+ }
292
+ else if(strcasecmp($check_user['status'], 'USER_FOUND') == 0 || strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
293
+
294
+ $enduser = new Customer_Setup();
295
+ $content = json_decode($enduser->send_otp_token($email,'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
296
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
297
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_PROMPT_FOR_USER_REG_OTP';
298
+ $_SESSION['mo2f-login-message'] = 'An OTP has been sent to <b>' . ( $email ) . '</b>. Please enter the OTP below to verify your email. If you didn\'t get the email, please check your <b>SPAM</b> folder.';
299
+ update_user_meta($currentUserId,'mo_2fa_verify_otp_create_account',$content['txId']);
300
+ update_user_meta($currentUserId, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
301
+
302
+ }else{
303
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_PROMPT_FOR_USER_REG_OTP';
304
+ $_SESSION['mo2f-login-message'] = 'There was an error in sending OTP over email. Please click on Resend OTP to try again.';
305
+ update_user_meta($currentUserId, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
306
+ }
307
+ }
308
+ }
309
+ }else{
310
+ $_SESSION['mo2f-login-message'] = 'The email is already used by other user. Please register with other email.';
311
+
312
+ }
313
+ }
314
+ }
315
+
316
+ if( isset($_POST['miniorange_inline_two_factor_setup'])){ /* return back to choose second factor screen */
317
+ $nonce = $_POST['miniorange_inline_two_factor_setup'];
318
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-setup-nonce' ) ) {
319
+ $error = new WP_Error();
320
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
321
+ return $error;
322
+ } else {
323
+ $this->miniorange_pass2login_start_session();
324
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
325
+ unset($_SESSION['mo2f_google_auth']);
326
+ unset($_SESSION['mo2f_authy_keys']);
327
+ $_SESSION['mo2f-login-message'] = '';
328
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
329
+ delete_user_meta($current_user->ID,'mo2f_selected_2factor_method');
330
+ }
331
+ }
332
+
333
+ if ( isset($_POST['miniorange_inline_resend_otp_nonce'])){ //resend otp during user inline registration
334
+
335
+ $nonce = $_POST['miniorange_inline_resend_otp_nonce'];
336
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-resend-otp-nonce' ) ) {
337
+ $error = new WP_Error();
338
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
339
+ return $error;
340
+ } else {
341
+ $this->miniorange_pass2login_start_session();
342
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
343
+ $currentUserId = $current_user->ID;
344
+
345
+ $userkey = '';
346
+ if(get_user_meta( $currentUserId,'mo2f_selected_2factor_method',true) == 'SMS'){
347
+ $currentMethod = "OTP_OVER_SMS";
348
+ $userkey = isset($_SESSION['mo2f_phone']) ? $_SESSION['mo2f_phone'] : null;
349
+ $_SESSION['mo2f-login-message'] = isset($_SESSION['mo2f_phone']) ? 'The One Time Passcode has been sent to ' . $userkey . '. Please enter the one time passcode below to verify your number.' : 'Please click on Verifiy button to receive OTP over your phone number.';
350
+ }else if(get_user_meta( $currentUserId,'mo2f_selected_2factor_method',true) == 'PHONE VERIFICATION'){
351
+ $currentMethod = "PHONE_VERIFICATION";
352
+ $userkey = isset($_SESSION['mo2f_phone']) ? $_SESSION['mo2f_phone'] : null;
353
+ $_SESSION['mo2f-login-message'] = isset($_SESSION['mo2f_phone']) ? 'You will receive a phone call on this number ' . $userkey . '. Please enter the one time passcode below to verify your number.' : 'Please click on Verifiy button to receive phone call.';
354
+ }else{
355
+ $currentMethod = 'EMAIL';
356
+ $userkey = get_user_meta($currentUserId,'mo_2factor_user_email',true);
357
+ $_SESSION['mo2f-login-message'] = 'An OTP has been sent to <b>' . ( $userkey ) . '</b>. Please enter the OTP below to verify your email.';
358
+ }
359
+
360
+ $customer = new Customer_Setup();
361
+ $content = json_decode($customer->send_otp_token($userkey,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
362
+
363
+
364
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
365
+ update_user_meta($currentUserId,'mo_2fa_verify_otp_create_account',$content['txId']);
366
+ if($currentMethod == 'EMAIL'){
367
+ update_user_meta($currentUserId, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
368
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_PROMPT_FOR_USER_REG_OTP';
369
+ }
370
+
371
+ }else{
372
+ $_SESSION['mo2f-login-message'] = 'There was an error in sending one time passcode. Please click on Resend OTP to try again.';
373
+ if($currentMethod == 'EMAIL'){
374
+ update_user_meta($currentUserId, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
375
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_PROMPT_FOR_USER_REG_OTP';
376
+ }
377
+ }
378
+
379
+ }
380
+ }
381
+
382
+ if ( isset($_POST['mo2f_inline_ga_phone_type_nonce'])){ //select google phone type during user inline registration when google authenticator is selected
383
+
384
+ $nonce = $_POST['mo2f_inline_ga_phone_type_nonce'];
385
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-ga-phone-type-nonce' ) ) {
386
+ $error = new WP_Error();
387
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
388
+ return $error;
389
+ } else {
390
+ $this->miniorange_pass2login_start_session();
391
+ $phone_type = $_POST['google_phone_type'];
392
+
393
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
394
+ $google_auth = new Miniorange_Rba_Attributes();
395
+ $google_response = json_decode($google_auth->mo2f_google_auth_service(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
396
+ if(json_last_error() == JSON_ERROR_NONE) {
397
+ if($google_response['status'] == 'SUCCESS'){
398
+ $mo2f_google_auth = array();
399
+ $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
400
+ $mo2f_google_auth['ga_secret'] = $google_response['secret'];
401
+ $mo2f_google_auth['ga_phone'] = $phone_type;
402
+ $_SESSION['mo2f_google_auth'] = $mo2f_google_auth;
403
+ $_SESSION['mo2f-login-message'] = '';
404
+
405
+ }else{
406
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user for google authenticator. Please try again.';
407
+ }
408
+ }else{
409
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again.';
410
+ }
411
+ }
412
+ }
413
+
414
+ if(isset($_POST['mo2f_inline_validate_ga_nonce'])){
415
+ $nonce = $_POST['mo2f_inline_validate_ga_nonce'];
416
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-google-auth-nonce' ) ) {
417
+ $error = new WP_Error();
418
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
419
+ return $error;
420
+ } else {
421
+ $this->miniorange_pass2login_start_session();
422
+ $otpToken = $_POST['google_auth_code'];
423
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
424
+ $mo2f_google_auth = isset($_SESSION['mo2f_google_auth']) ? $_SESSION['mo2f_google_auth'] : null;
425
+ $ga_secret = $mo2f_google_auth != null ? $mo2f_google_auth['ga_secret'] : null;
426
+ if(MO2f_Utility::mo2f_check_number_length($otpToken)){
427
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
428
+ $google_auth = new Miniorange_Rba_Attributes();
429
+ $google_response = json_decode($google_auth->mo2f_validate_google_auth($email,$otpToken,$ga_secret),true);
430
+ if(json_last_error() == JSON_ERROR_NONE) {
431
+ if($google_response['status'] == 'SUCCESS'){
432
+ $enduser = new Two_Factor_Setup();
433
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true),null,null,null),true);
434
+ if(json_last_error() == JSON_ERROR_NONE) {
435
+
436
+ if($response['status'] == 'SUCCESS'){
437
+
438
+ update_user_meta($current_user->ID,'mo2f_google_authentication_status',true);
439
+ update_user_meta($current_user->ID,'mo2f_authy_authentication_status',false);
440
+ update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
441
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
442
+ unset($_SESSION['mo2f-login-message']);
443
+
444
+ }else{
445
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
446
+ }
447
+ }else{
448
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
449
+ }
450
+ }else{
451
+ $_SESSION['mo2f-login-message'] = 'Error occurred while validating the OTP. Please try again. Possible causes: <br />1. You have enter invalid OTP.<br />2. You App Time is not sync.Go to seetings and tap on Time correction for codes and tap on Sync now .';
452
+ }
453
+ }else{
454
+ $_SESSION['mo2f-login-message'] = 'Error occurred while validating the user. Please try again.';
455
+
456
+ }
457
+ }else{
458
+ $_SESSION['mo2f-login-message'] = 'Only digits are allowed. Please enter again.';
459
+
460
+ }
461
+ }
462
+ }
463
+
464
+ if ( isset($_POST['mo2f_inline_authy_configure_nonce'])){ //select google phone type during user inline registration when google authenticator is selected
465
+
466
+ $nonce = $_POST['mo2f_inline_authy_configure_nonce'];
467
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-authy-configuration-nonce' ) ) {
468
+ $error = new WP_Error();
469
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
470
+ return $error;
471
+ } else {
472
+ $this->miniorange_pass2login_start_session();
473
+ $authy = new Miniorange_Rba_Attributes();
474
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
475
+ $authy_response = json_decode($authy->mo2f_google_auth_service(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
476
+ if(json_last_error() == JSON_ERROR_NONE) {
477
+ if($authy_response['status'] == 'SUCCESS'){
478
+ $mo2f_authy_keys = array();
479
+ $mo2f_authy_keys['authy_qrCode'] = $authy_response['qrCodeData'];
480
+ $mo2f_authy_keys['authy_secret'] = $authy_response['secret'];
481
+ $_SESSION['mo2f_authy_keys'] = $mo2f_authy_keys;
482
+ $_SESSION['mo2f-login-message'] = '';
483
+ }else{
484
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user for authy 2-factor authentication. Please try again.';
485
+ }
486
+ }else{
487
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again.';
488
+ }
489
+ }
490
+ }
491
+
492
+ if(isset($_POST['mo2f_inline_validate_authy_authentication_nonce'])){
493
+ $nonce = $_POST['mo2f_inline_validate_authy_authentication_nonce'];
494
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-authy-authentication-nonce' ) ) {
495
+ $error = new WP_Error();
496
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
497
+ return $error;
498
+ } else {
499
+ $this->miniorange_pass2login_start_session();
500
+ $otpToken = isset($_POST['authy_auth_code']) ? $_POST['authy_auth_code'] : null;
501
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
502
+ $mo2f_google_auth = isset($_SESSION['mo2f_authy_keys']) ? $_SESSION['mo2f_authy_keys'] : null;
503
+ $authy_secret = $mo2f_google_auth != null ? $mo2f_google_auth['authy_secret'] : null;
504
+ if(MO2f_Utility::mo2f_check_number_length($otpToken)){
505
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
506
+ $google_auth = new Miniorange_Rba_Attributes();
507
+ $google_response = json_decode($google_auth->mo2f_validate_google_auth($email,$otpToken,$authy_secret),true);
508
+ if(json_last_error() == JSON_ERROR_NONE) {
509
+ if($google_response['status'] == 'SUCCESS'){
510
+ $enduser = new Two_Factor_Setup();
511
+ $response = json_decode($enduser->mo2f_update_userinfo($email,'GOOGLE AUTHENTICATOR',null,null,null),true);
512
+ if(json_last_error() == JSON_ERROR_NONE) {
513
+
514
+ if($response['status'] == 'SUCCESS'){
515
+
516
+ update_user_meta($current_user->ID,'mo2f_authy_authentication_status',true);
517
+ update_user_meta($current_user->ID,'mo2f_google_authentication_status',false);
518
+ update_user_meta($current_user->ID,'mo2f_external_app_type','AUTHY 2-FACTOR AUTHENTICATION');
519
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
520
+ unset($_SESSION['mo2f-login-message']);
521
+
522
+ }else{
523
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
524
+ }
525
+ }else{
526
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
527
+ }
528
+ }else{
529
+ $_SESSION['mo2f-login-message'] = 'Error occurred while validating the OTP. Please try again. Possible causes: <br />1. You have enter invalid OTP.<br />2. You App Time is not sync.Go to seetings and tap on Time correction for codes and tap on Sync now .';
530
+ }
531
+ }else{
532
+ $_SESSION['mo2f-login-message'] = 'Error occurred while validating the user. Please try again.';
533
+
534
+ }
535
+ }else{
536
+ $_SESSION['mo2f-login-message'] = 'Only digits are allowed. Please enter again.';
537
+
538
+ }
539
+ }
540
+ }
541
+
542
+ if(isset($_POST['miniorange_inline_validate_user_otp_nonce'])){
543
+ $nonce = $_POST['miniorange_inline_validate_user_otp_nonce'];
544
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-user-otp-nonce' ) ) {
545
+ $error = new WP_Error();
546
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
547
+ return $error;
548
+ } else {
549
+ $this->miniorange_pass2login_start_session();
550
+ $otp_token = '';
551
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
552
+ $_SESSION['mo2f-login-message'] = 'All the fields are required. Please enter valid entries.';
553
+ return;
554
+ } else{
555
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
556
+ }
557
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
558
+ $id = $current_user->ID;
559
+ if(!MO2f_Utility::check_if_email_is_already_registered(get_user_meta($id,'mo_2factor_user_email',true))){
560
+ $customer = new Customer_Setup();
561
+ $transactionId = get_user_meta($id,'mo_2fa_verify_otp_create_account',true);
562
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null, $transactionId, $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
563
+ if($content['status'] == 'ERROR'){
564
+ $_SESSION['mo2f-login-message'] = $content['message'];
565
+ }else{
566
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated and generate QRCode
567
+ $this->mo2f_register_user_inline(get_user_meta($id,'mo_2factor_user_email',true));
568
+ delete_user_meta($id,'mo_2fa_verify_otp_create_account');
569
+ }else{ // OTP Validation failed.
570
+ $_SESSION['mo2f-login-message'] = 'Invalid OTP. Please try again.';
571
+ update_user_meta($id,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
572
+
573
+ }
574
+ }
575
+
576
+ }else{
577
+ $_SESSION['mo2f-login-message'] = 'The email is already used by other user. Please register with other email by clicking on Back button.';
578
+
579
+ }
580
+ }
581
+ }
582
+
583
+ if(isset($_POST['miniorange_inline_save_2factor_method_nonce'])){
584
+ $nonce = $_POST['miniorange_inline_save_2factor_method_nonce'];
585
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-2factor-method-nonce' ) ) {
586
+ $error = new WP_Error();
587
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
588
+ return $error;
589
+ } else {
590
+ $this->miniorange_pass2login_start_session();
591
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
592
+ $currentUserId = $current_user->ID;
593
+ if(get_user_meta($currentUserId,'mo_2factor_user_registration_with_miniorange',true) == 'SUCCESS'){
594
+ $selected_method = isset($_POST['mo2f_selected_2factor_method']) ? $_POST['mo2f_selected_2factor_method'] : 'NONE';
595
+ update_user_meta( $currentUserId,'mo2f_selected_2factor_method', $selected_method); //status for second factor selected by user
596
+ if($selected_method == 'OUT OF BAND EMAIL'){
597
+ $enduser = new Two_Factor_Setup();
598
+ $enduser->mo2f_update_userinfo(get_user_meta($currentUserId,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,null,null);
599
+ update_user_meta($currentUserId,'mo2f_email_verification_status',true);
600
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
601
+ }
602
+ $_SESSION['mo2f-login-message'] = '';
603
+ }else{
604
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please register with miniOrange to configure 2 Factor plugin.';
605
+
606
+ }
607
+ }
608
+ }
609
+
610
+ if(isset($_POST['miniorange_inline_verify_phone_nonce'])){
611
+ $nonce = $_POST['miniorange_inline_verify_phone_nonce'];
612
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-verify-phone-nonce' ) ) {
613
+ $error = new WP_Error();
614
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
615
+ return $error;
616
+ } else {
617
+ $this->miniorange_pass2login_start_session();
618
+ $phone = sanitize_text_field( $_POST['verify_phone'] );
619
+
620
+ if( MO2f_Utility::mo2f_check_empty_or_null( $phone ) ){
621
+ $_SESSION['mo2f-login-message'] = 'All the fields are required. Please enter valid entries.';
622
+ return;
623
+ }
624
+ $phone = str_replace(' ', '', $phone);
625
+ $_SESSION['mo2f_phone'] = $phone;
626
+ $user = unserialize($_SESSION[ 'mo2f_current_user' ]);
627
+ $current_user = $user->ID;
628
+ $customer = new Customer_Setup();
629
+
630
+ if(get_user_meta( $current_user,'mo2f_selected_2factor_method',true) == 'SMS'){
631
+ $currentMethod = "OTP_OVER_SMS";
632
+ }else if(get_user_meta( $current_user,'mo2f_selected_2factor_method',true) == 'PHONE VERIFICATION'){
633
+ $currentMethod = "PHONE_VERIFICATION";
634
+ }
635
+
636
+ $content = json_decode($customer->send_otp_token($phone,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
637
+
638
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate otp token */
639
+ if($content['status'] == 'ERROR'){
640
+ $_SESSION['mo2f-login-message'] = $response['message'];
641
+
642
+ }else if($content['status'] == 'SUCCESS'){
643
+ $_SESSION[ 'mo2f_transactionId' ] = $content['txId'];
644
+
645
+ if(get_user_meta( $current_user,'mo2f_selected_2factor_method',true) == 'SMS'){
646
+ $_SESSION['mo2f-login-message'] = 'The One Time Passcode has been sent to ' . $phone . '. Please enter the one time passcode below to verify your number.';
647
+ }else if(get_user_meta( $current_user,'mo2f_selected_2factor_method',true)== 'PHONE VERIFICATION'){
648
+ $_SESSION['mo2f-login-message'] = 'You will receive a phone call on this number ' . $phone . '. Please enter the one time passcode below to verify your number.';
649
+ }
650
+
651
+ }else{
652
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
653
+
654
+ }
655
+
656
+ }else{
657
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again';
658
+
659
+ }
660
+ }
661
+ }
662
+
663
+ if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
664
+ $nonce = $_POST['miniorange_inline_validate_otp_nonce'];
665
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-otp-nonce' ) ) {
666
+ $error = new WP_Error();
667
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
668
+ return $error;
669
+ } else {
670
+ $this->miniorange_pass2login_start_session();
671
+ $otp_token = '';
672
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
673
+ $_SESSION['mo2f-login-message'] = 'All the fields are required. Please enter valid entries.';
674
+ return;
675
+ } else{
676
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
677
+ }
678
+ $user = unserialize($_SESSION[ 'mo2f_current_user' ]);
679
+ $current_user = $user->ID;
680
+ $customer = new Customer_Setup();
681
+ $content = json_decode($customer->validate_otp_token( get_user_meta( $current_user,'mo2f_selected_2factor_method',true), null, $_SESSION[ 'mo2f_transactionId' ], $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
682
+ if($content['status'] == 'ERROR'){
683
+ $_SESSION['mo2f-login-message'] = $content['message'];
684
+
685
+ }else if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated
686
+ if(get_user_meta($current_user,'mo2f_user_phone',true) && strlen(get_user_meta($current_user,'mo2f_user_phone',true)) >= 4){
687
+ if($_SESSION['mo2f_phone'] != get_user_meta($current_user,'mo2f_user_phone',true) ){
688
+ update_user_meta($current_user,'mo2f_mobile_registration_status',false);
689
+ }
690
+ }
691
+ $email = get_user_meta($current_user,'mo_2factor_map_id_with_email',true);
692
+ $phone = $_SESSION['mo2f_phone'];
693
+
694
+ $enduser = new Two_Factor_Setup();
695
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user,'mo2f_selected_2factor_method',true),$phone,null,null),true);
696
+ if(json_last_error() == JSON_ERROR_NONE) {
697
+
698
+ if($response['status'] == 'ERROR'){
699
+ unset($_SESSION[ 'mo2f_phone']);
700
+ $_SESSION['mo2f-login-message'] = $response['message'];
701
+ $this->mo_auth_show_error_message();
702
+ }else if($response['status'] == 'SUCCESS'){
703
+ update_user_meta($current_user,'mo2f_otp_registration_status',true);
704
+ update_user_meta($current_user,'mo2f_user_phone',$_SESSION[ 'mo2f_phone']);
705
+ unset($_SESSION[ 'mo2f_phone']);
706
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
707
+ unset($_SESSION['mo2f-login-message']);
708
+
709
+ }else{
710
+ unset($_SESSION[ 'mo2f_phone']);
711
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
712
+
713
+ }
714
+ }else{
715
+ unset($_SESSION[ 'mo2f_phone']);
716
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again';
717
+
718
+ }
719
+
720
+ }else{ // OTP Validation failed.
721
+ $_SESSION['mo2f-login-message'] = 'Invalid OTP. Please try again.';
722
+
723
+ }
724
+ }
725
+ }
726
+
727
+ if(isset($_POST['miniorange_inline_show_qrcode_nonce'])){
728
+ $nonce = $_POST['miniorange_inline_show_qrcode_nonce'];
729
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-show-qrcode-nonce' ) ) {
730
+ $error = new WP_Error();
731
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
732
+ return $error;
733
+ } else {
734
+ $this->miniorange_pass2login_start_session();
735
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
736
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') {
737
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
738
+ $this->mo2f_inline_get_qr_code_for_mobile($email,$current_user->ID);
739
+ }else{
740
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please register with miniOrange before configuring your mobile.';
741
+
742
+ }
743
+ }
744
+ }
745
+
746
+
747
+ if(isset($_POST['mo_auth_inline_mobile_registration_complete_nonce'])){
748
+ $nonce = $_POST['mo_auth_inline_mobile_registration_complete_nonce'];
749
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-mobile-registration-complete-nonce' ) ) {
750
+ $error = new WP_Error();
751
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
752
+ return $error;
753
+ } else {
754
+ $this->miniorange_pass2login_start_session();
755
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
756
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
757
+ unset($_SESSION[ 'mo2f_show_qr_code'] );
758
+ $user = unserialize($_SESSION[ 'mo2f_current_user' ]);
759
+ $current_user = $user->ID;
760
+ $email = get_user_meta($current_user,'mo_2factor_map_id_with_email',true);
761
+
762
+ $enduser = new Two_Factor_Setup();
763
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user,'mo2f_selected_2factor_method',true),null,null,null),true);
764
+
765
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
766
+ if($response['status'] == 'ERROR'){
767
+ $_SESSION['mo2f-login-message'] = $response['message'];
768
+ }else if($response['status'] == 'SUCCESS'){
769
+ update_user_meta($current_user,'mo2f_mobile_registration_status',true);
770
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
771
+ unset($_SESSION['mo2f-login-message']);
772
+ }else{
773
+ $_SESSION['mo2f-login-message'] = 'An error occured while processing your request. Please Try again.';
774
+ }
775
+ }else{
776
+ $_SESSION['mo2f-login-message'] = 'Invalid request. Please try again';
777
+ }
778
+ }
779
+ }
780
+
781
+ if(isset($_POST['mo2f_inline_save_kba_nonce'])){
782
+ $nonce = $_POST['mo2f_inline_save_kba_nonce'];
783
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-kba-nonce' ) ) {
784
+ $error = new WP_Error();
785
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
786
+ return $error;
787
+ } else {
788
+ $this->miniorange_pass2login_start_session();
789
+ if(MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_2'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans2'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_3'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans3'] ) ){
790
+ $_SESSION['mo2f-login-message'] = 'All the fields are required. Please enter valid entries.';
791
+ return;
792
+ }
793
+ $kba_q1 = $_POST[ 'mo2f_kbaquestion_1' ];
794
+ $kba_a1 = sanitize_text_field( $_POST[ 'mo2f_kba_ans1' ] );
795
+ $kba_q2 = $_POST[ 'mo2f_kbaquestion_2' ];
796
+ $kba_a2 = sanitize_text_field( $_POST[ 'mo2f_kba_ans2' ] );
797
+ $kba_q3 = sanitize_text_field( $_POST[ 'mo2f_kbaquestion_3' ] );
798
+ $kba_a3 = sanitize_text_field( $_POST[ 'mo2f_kba_ans3' ] );
799
+
800
+ if (strcasecmp($kba_q1, $kba_q2) == 0 || strcasecmp($kba_q2, $kba_q3) == 0 || strcasecmp($kba_q3, $kba_q1) == 0) {
801
+ $_SESSION['mo2f-login-message'] = 'The questions you select must be unique.';
802
+ return;
803
+ }
804
+
805
+ $kba_q1 = addcslashes(stripslashes($kba_q1), '"\\');
806
+ $kba_a1 = addcslashes(stripslashes($kba_a1), '"\\');
807
+ $kba_q2 = addcslashes(stripslashes($kba_q2), '"\\');
808
+ $kba_a2 = addcslashes(stripslashes($kba_a2), '"\\');
809
+ $kba_q3 = addcslashes(stripslashes($kba_q3), '"\\');
810
+ $kba_a3 = addcslashes(stripslashes($kba_a3), '"\\');
811
+
812
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
813
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
814
+ $kba_registration = new Two_Factor_Setup();
815
+ $kba_reg_reponse = json_decode($kba_registration->register_kba_details($email, $kba_q1,$kba_a1,$kba_q2,$kba_a2,$kba_q3,$kba_a3),true);
816
+ if(json_last_error() == JSON_ERROR_NONE) {
817
+ if($kba_reg_reponse['status'] == 'SUCCESS'){
818
+ if(isset($_POST['mo2f_inline_kba_option']) && $_POST['mo2f_inline_kba_option'] == 'mo2f_inline_kba_registration'){
819
+ update_user_meta($current_user->ID,'mo2f_kba_registration_status',true);
820
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
821
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
822
+ unset($_SESSION['mo2f-login-message']);
823
+ }else{
824
+ $enduser = new Two_Factor_Setup();
825
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true),null,null,null),true);
826
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
827
+ if($response['status'] == 'ERROR'){
828
+ $_SESSION['mo2f-login-message'] = $response['message'];
829
+
830
+ }else if($response['status'] == 'SUCCESS'){
831
+ update_user_meta($current_user->ID,'mo2f_kba_registration_status',true);
832
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
833
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_SETUP_SUCCESS';
834
+ unset($_SESSION['mo2f-login-message']);
835
+ }
836
+ }else{
837
+ $_SESSION['mo2f-login-message'] = 'Error occured while saving your kba details. Please try again.';
838
+ }
839
+ }
840
+ }else{
841
+ $_SESSION['mo2f-login-message'] = 'Error occured while saving your kba details. Please try again.';
842
+ }
843
+ }else{
844
+ $_SESSION['mo2f-login-message'] = 'Error occured while saving your kba details. Please try again.';
845
+ }
846
+
847
+ }
848
+ }
849
+
850
+ if(isset($_POST['miniorange_softtoken'])){ /*Click on the link of phone is offline */
851
+ $nonce = $_POST['miniorange_softtoken'];
852
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-softtoken' ) ) {
853
+ $error = new WP_Error();
854
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
855
+ return $error;
856
+ } else{
857
+ $this->miniorange_pass2login_start_session();
858
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
859
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
860
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the miniOrange authenticator app.';
861
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
862
+ }
863
+ }
864
+
865
+ if (isset($_POST['miniorange_soft_token_nonce'])){ /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
866
+ $nonce = $_POST['miniorange_soft_token_nonce'];
867
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-soft-token-nonce' ) ) {
868
+ $error = new WP_Error();
869
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
870
+ return $error;
871
+ } else {
872
+ $this->miniorange_pass2login_start_session();
873
+ $softtoken = '';
874
+ if( MO2f_utility::mo2f_check_empty_or_null( $_POST[ 'mo2fa_softtoken' ] ) ) {
875
+ $_SESSION['mo2f-login-message'] = 'Please enter OTP to proceed.';
876
+ return;
877
+ } else{
878
+ $softtoken = sanitize_text_field( $_POST[ 'mo2fa_softtoken' ] );
879
+ if(!MO2f_utility::mo2f_check_number_length($softtoken)){
880
+ $_SESSION['mo2f-login-message'] = 'Invalid OTP. Only digits within range 4-8 are allowed. Please try again.';
881
+ return;
882
+ }
883
+ }
884
+ $currentuser = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
885
+ if(isset($_SESSION[ 'mo2f_current_user' ])){
886
+ $customer = new Customer_Setup();
887
+ $content ='';
888
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL'){
889
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
890
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS'){
891
+ $content = json_decode($customer->validate_otp_token( 'SMS', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
892
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION'){
893
+ $content = json_decode($customer->validate_otp_token( 'PHONE VERIFICATION', null, $_SESSION[ 'mo2f-login-transactionId' ], $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
894
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN'){
895
+ $content = json_decode($customer->validate_otp_token( 'SOFT TOKEN', get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true), null, $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
896
+ }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION'){
897
+ $content = json_decode($customer->validate_otp_token( 'GOOGLE AUTHENTICATOR', get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true), null, $softtoken, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
898
+ }else{
899
+ $this->remove_current_activity();
900
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Invalid Request. Please try again.'));
901
+ }
902
+
903
+
904
+
905
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
906
+ if(get_option('mo2f_deviceid_enabled')){
907
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE';
908
+ }else{
909
+ $this->mo2fa_pass2login();
910
+ }
911
+ }else{
912
+
913
+ $message = $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' ? 'Invalid OTP ...Possible causes <br />1. You mis-typed the OTP, find the OTP again and type it. <br /> 2. Your phone time is not in sync with miniOrange servers. <br /><b>How to sync?</b> In the app,tap on Settings icon and then press Sync button.' : 'Invalid OTP. Please try again';
914
+ $_SESSION['mo2f-login-message'] = $message;
915
+ }
916
+
917
+ }else{
918
+ $this->remove_current_activity();
919
+ return new WP_Error('invalid_username', __('<strong>ERROR</strong>: Please try again..'));
920
+ }
921
+ }
922
+ }
923
+
924
+ if (isset($_POST['miniorange_inline_skip_registration_nonce'])){ /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
925
+ $nonce = $_POST['miniorange_inline_skip_registration_nonce'];
926
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-skip-registration-nonce' ) ) {
927
+ $error = new WP_Error();
928
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
929
+ return $error;
930
+ } else {
931
+ $this->miniorange_pass2login_start_session();
932
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
933
+ delete_user_meta($current_user->ID,'mo2f_selected_2factor_method');
934
+ $this->mo2fa_pass2login();
935
+ }
936
+ }
937
+
938
+ if (isset($_POST['miniorange_inline_goto_user_registration_nonce'])){ /*Validate Soft Token,OTP over SMS,OTP over EMAIL,Phone verification */
939
+ $nonce = $_POST['miniorange_inline_goto_user_registration_nonce'];
940
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-goto-user-registration-nonce' ) ) {
941
+ $error = new WP_Error();
942
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
943
+ return $error;
944
+ } else {
945
+ $this->miniorange_pass2login_start_session();
946
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
947
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
948
+ delete_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account');
949
+ delete_user_meta($current_user->ID, 'mo_2factor_user_registration_status');
950
+ $_SESSION['mo2f-login-message'] = '';
951
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_FOR_USER_REGISTRATION';
952
+ }
953
+ }
954
+ }
955
+
956
+
957
+
958
+ function mo2f_check_username_password($user, $username, $password){
959
+
960
+ if (isset($_POST['miniorange_login_nonce'])){
961
+ $nonce = $_POST['miniorange_login_nonce'];
962
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' ) ) {
963
+ wp_logout();
964
+ $error = new WP_Error();
965
+ $error->add('empty_username', __('<strong>ERROR</strong>: Invalid Request.'));
966
+ return $error;
967
+ }
968
+ else {
969
+ $currentuser = wp_authenticate_username_password($user, $username, $password);
970
+ if (is_wp_error($currentuser)) {
971
+ return $currentuser;
972
+ }else{
973
+ $this->miniorange_pass2login_start_session();
974
+ $_SESSION[ 'mo2f_current_user' ] = serialize($currentuser);
975
+ $_SESSION[ 'mo2f_1stfactor_status' ] = 'VALIDATE_SUCCESS';
976
+ $roles = $currentuser->roles;
977
+ $current_role = array_shift($roles);
978
+ if(get_option('mo2fa_'.$current_role)){
979
+ $email = get_user_meta($currentuser->ID,'mo_2factor_map_id_with_email',true);
980
+ $attributes = isset($_POST[ 'miniorange_rba_attribures' ]) ? $_POST[ 'miniorange_rba_attribures' ] : null;
981
+ if( $email && get_user_meta($currentuser->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ //checking if user has configured any 2nd factor method
982
+ try{
983
+ $mo2f_rba_status = mo2f_collect_attributes($email,stripslashes($attributes)); // Rba flow
984
+ $_SESSION[ 'mo2f_rba_status' ] = $mo2f_rba_status;
985
+ }catch(Exception $e){
986
+ echo $e->getMessage();
987
+ }
988
+ if($mo2f_rba_status['status'] == 'SUCCESS' && $mo2f_rba_status['decision_flag']){
989
+ $this->mo2fa_pass2login();
990
+ }else{
991
+ if(MO2f_Utility::check_if_request_is_from_mobile_device($_SERVER['HTTP_USER_AGENT']) && get_user_meta($currentuser->ID,'mo2f_kba_registration_status',true) && get_option('mo2f_enable_mobile_support')){
992
+ $this->mo2f_pass2login_kba_verification($currentuser);
993
+ }else{
994
+ $mo2f_second_factor = mo2f_get_user_2ndfactor($currentuser);
995
+ if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
996
+ $this->mo2f_pass2login_mobile_verification($currentuser);
997
+ }else if($mo2f_second_factor == 'PUSH NOTIFICATIONS' || $mo2f_second_factor == 'OUT OF BAND EMAIL'){
998
+ $this->mo2f_pass2login_push_oobemail_verification($currentuser,$mo2f_second_factor);
999
+ }else if($mo2f_second_factor == 'SOFT TOKEN' || $mo2f_second_factor == 'SMS' || $mo2f_second_factor == 'PHONE VERIFICATION' || $mo2f_second_factor == 'GOOGLE AUTHENTICATOR' ){
1000
+ $this->mo2f_pass2login_otp_verification($currentuser,$mo2f_second_factor);
1001
+ }else if($mo2f_second_factor == 'KBA'){
1002
+ $this->mo2f_pass2login_kba_verification($currentuser);
1003
+ }else{
1004
+ $this->remove_current_activity();
1005
+ $error = new WP_Error();
1006
+ $error->add('empty_username', __('<strong>ERROR</strong>: Please try again or contact your admin.'));
1007
+ return $error;
1008
+ }
1009
+ }
1010
+ }
1011
+ }else{ //if user has not configured any 2nd factor method then logged him in without asking 2nd factor
1012
+ if(!get_option('mo2f_inline_registration')){
1013
+ $this->mo2fa_pass2login();
1014
+ }else{
1015
+ delete_user_meta($currentuser->ID,'mo2f_selected_2factor_method');
1016
+ $_SESSION['mo2f-login-message'] = '';
1017
+ if( get_user_meta($currentuser->ID,'mo_2factor_user_registration_status',true) =='MO_2_FACTOR_INITIALIZE_TWO_FACTOR'){
1018
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1019
+ }else{
1020
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_FOR_USER_REGISTRATION';
1021
+ }
1022
+ }
1023
+ }
1024
+ }else{ //plugin is not activated for current role then logged him in without asking 2 factor
1025
+ $this->mo2fa_pass2login();
1026
+ }
1027
+ }
1028
+ }
1029
+ }else{
1030
+ //xmlrpc handle
1031
+ if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST && get_option('mo2f_enable_xmlrpc')){
1032
+ $currentuser = wp_authenticate_username_password($user, $username, $password);
1033
+ if (is_wp_error($currentuser)) {
1034
+ $this->error = new IXR_Error(403, __('Bad login/pass combination.'));
1035
+ return false;
1036
+ }else{
1037
+ return $currentuser;
1038
+ }
1039
+ }else{
1040
+ $error = new WP_Error();
1041
+ return $error;
1042
+ }
1043
+ }
1044
+ }
1045
+
1046
+ function mo_2_factor_enable_jquery_default_login(){
1047
+ wp_enqueue_script('jquery');
1048
+ wp_enqueue_script( 'bootstrap_script', plugins_url('includes/js/bootstrap.min.js', __FILE__ ));
1049
+ wp_enqueue_script( 'mo_2_factor_admin_settings_phone_script', plugins_url('includes/js/phone.js', __FILE__ ));
1050
+
1051
+ }
1052
+
1053
+ function mo_2_factor_enable_jquery() {
1054
+ wp_enqueue_script('jquery');
1055
+ global $post;
1056
+ $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
1057
+ $id = ( isset( $post->ID ) ? get_the_ID() : NULL );
1058
+ if ( $myaccount_page_id == $id) {
1059
+ wp_enqueue_script( 'bootstrap_script', plugins_url('includes/js/bootstrap.min.js', __FILE__ ));
1060
+ }
1061
+ wp_enqueue_script( 'mo_2_factor_admin_settings_phone_script', plugins_url('includes/js/phone.js', __FILE__ ));
1062
+
1063
+ }
1064
+
1065
+
1066
+ function mo_2_factor_pass2login_hide_login() {
1067
+ wp_register_style( 'hide-login', plugins_url( 'includes/css/hide-login.css?version=4.1.3', __FILE__ ) );
1068
+ wp_enqueue_style( 'hide-login' );
1069
+ wp_register_style( 'bootstrap', plugins_url( 'includes/css/bootstrap.min.css?version=4.1.3', __FILE__ ) );
1070
+ wp_enqueue_style( 'bootstrap' );
1071
+ wp_register_style( 'mo-country-code', plugins_url('includes/css/phone.css', __FILE__));
1072
+ wp_enqueue_style( 'mo-country-code' );
1073
+ }
1074
+
1075
+ function mo_2_factor_pass2login_show_login(){
1076
+ wp_register_style( 'show-login', plugins_url( 'includes/css/show-login.css?version=4.1.3', __FILE__ ) );
1077
+ wp_enqueue_style( 'show-login' );
1078
+ }
1079
+
1080
+ function miniorange_pass2login_form_fields(){
1081
+ //$this->miniorange_pass2login_start_session();
1082
+ $login_status = isset($_SESSION[ 'mo_2factor_login_status' ]) ? $_SESSION[ 'mo_2factor_login_status' ] : null;
1083
+ $user = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
1084
+ $current_user = isset($user) ? $user->ID : null;
1085
+ if($this->miniorange_pass2login_check_mobile_status($login_status)){ //for mobile
1086
+ $this->mo_2_factor_pass2login_hide_login();
1087
+ $this->mo_2_factor_pass2login_show_qr_code();
1088
+ }else if($this->miniorange_pass2login_check_otp_status($login_status)){ //for soft-token,otp over email,sms,phone verification
1089
+ $this->mo_2_factor_pass2login_hide_login();
1090
+ $this->mo_2_factor_pass2login_show_otp_token();
1091
+ }else if($this->miniorange_pass2login_check_forgotphone_status($login_status)){ // forgot phone page if both KBA and Email are configured.
1092
+ $this->mo_2_factor_pass2login_hide_login();
1093
+ $this->mo_2_factor_pass2login_show_forgotphone();
1094
+ }else if($this->miniorange_pass2login_check_push_oobemail_status($login_status)){ //for push and out of band email.
1095
+ $this->mo_2_factor_pass2login_hide_login();
1096
+ $this->mo_2_factor_pass2login_show_push_oobemail($current_user);
1097
+ }else if($this->miniorange_pass2login_check_kba_status($login_status)){ // for Kba
1098
+ $this->mo_2_factor_pass2login_hide_login();
1099
+ $this->mo_2_factor_pass2login_show_kba();
1100
+ }else if($this->miniorange_pass2login_check_trusted_device_status($login_status)){ // trusted device
1101
+ $this->mo_2_factor_pass2login_hide_login();
1102
+ $this->mo_2_factor_pass2login_show_device_page();
1103
+ }else if($this->miniorange_pass2login_check_inline_user_registration($login_status)){ // inline registration started
1104
+ $this->mo_2_factor_pass2login_hide_login();
1105
+ prompt_user_to_register();
1106
+ }else if($this->miniorange_pass2login_check_inline_user_otp($login_status)){ //otp verification after user enter email during inline registration
1107
+ $this->mo_2_factor_pass2login_hide_login();
1108
+ prompt_user_for_validate_otp();
1109
+ }else if($this->miniorange_pass2login_inline_setup_success($login_status)){ //MO_2_FACTOR_SETUP_SUCCESS
1110
+ $this->mo_2_factor_pass2login_hide_login();
1111
+ prompt_user_for_setup_success($current_user);
1112
+ }else if($this->miniorange_pass2login_check_inline_user_2fa_methods($login_status)){ // two-factor methods
1113
+ $this->mo_2_factor_pass2login_hide_login();
1114
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1115
+ if (sizeof($opt) > 1) {
1116
+
1117
+ prompt_user_to_select_2factor_method($current_user);
1118
+
1119
+ }else if( in_array("SMS", $opt) || in_array("PHONE VERIFICATION", $opt) ){
1120
+ $authtype = array_shift($opt);
1121
+ update_user_meta($current_user,'mo2f_selected_2factor_method',$authtype);
1122
+ prompt_user_for_phone_setup($current_user);
1123
+
1124
+ }else if( in_array("SOFT TOKEN", $opt) || in_array("PUSH NOTIFICATIONS", $opt) || in_array("MOBILE AUTHENTICATION", $opt) ){
1125
+ $authtype = array_shift($opt);
1126
+ update_user_meta($current_user,'mo2f_selected_2factor_method',$authtype);
1127
+ prompt_user_for_miniorange_app_setup($current_user);
1128
+
1129
+ }else if( in_array("GOOGLE AUTHENTICATOR", $opt) ){
1130
+ update_user_meta($current_user,'mo2f_selected_2factor_method','GOOGLE AUTHENTICATOR');
1131
+ prompt_user_for_google_authenticator_setup($current_user);
1132
+
1133
+ }else if( in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt) ){
1134
+ update_user_meta($current_user,'mo2f_selected_2factor_method','AUTHY 2-FACTOR AUTHENTICATION');
1135
+ prompt_user_for_authy_authenticator_setup($current_user);
1136
+
1137
+ }else if( in_array("KBA", $opt) ){
1138
+ update_user_meta($current_user,'mo2f_selected_2factor_method','KBA');
1139
+ prompt_user_for_kba_setup($current_user);
1140
+
1141
+ }else{
1142
+ update_user_meta($current_user,'mo2f_selected_2factor_method','OUT OF BAND EMAIL');
1143
+ prompt_user_for_setup_success($current_user);
1144
+ }
1145
+
1146
+ }else{ //show login screen
1147
+ $this->mo_2_factor_pass2login_show_login();
1148
+ $this->mo_2_factor_pass2login_show_wp_login_form();
1149
+ }
1150
+ }
1151
+
1152
+ //woocommerce front end login
1153
+ function miniorange_pass2login_form_fields_frontend(){
1154
+ //$this->miniorange_pass2login_start_session();
1155
+ $login_status = isset($_SESSION[ 'mo_2factor_login_status' ]) ? $_SESSION[ 'mo_2factor_login_status' ] : null;
1156
+ $user = isset($_SESSION[ 'mo2f_current_user' ]) ? unserialize($_SESSION[ 'mo2f_current_user' ]) : null;
1157
+ $current_user = isset($user) ? $user->ID : null;
1158
+ if($this->miniorange_pass2login_check_mobile_status($login_status)){ //for mobile
1159
+ mo2f_frontend_getqrcode();
1160
+ }else if($this->miniorange_pass2login_check_otp_status($login_status)){ //for soft-token,otp over email,sms,phone verification
1161
+ mo2f_frontend_getotp_form();
1162
+ }else if($this->miniorange_pass2login_check_forgotphone_status($login_status)){ // forgot phone page if both KBA and Email are configured.
1163
+ mo2f_frontend_get_forgotphone_form();
1164
+ }else if($this->miniorange_pass2login_check_push_oobemail_status($login_status)){ //for push and out of band email.
1165
+ mo2f_frontend_getpush_oobemail_response($current_user);
1166
+ }else if($this->miniorange_pass2login_check_kba_status($login_status)){ // for Kba
1167
+ mo2f_frontend_get_kba_form();
1168
+ }else if($this->miniorange_pass2login_check_trusted_device_status($login_status)){
1169
+ mo2f_frontend_get_trusted_device_form();
1170
+ }else if($this->miniorange_pass2login_check_inline_user_registration($login_status)){
1171
+ prompt_user_to_register_frontend();
1172
+ }else if($this->miniorange_pass2login_check_inline_user_otp($login_status)){
1173
+ prompt_user_for_validate_otp_frontend();
1174
+ }else if($this->miniorange_pass2login_inline_setup_success($login_status)){ //MO_2_FACTOR_SETUP_SUCCESS
1175
+ prompt_user_for_setup_success_frontend($current_user);
1176
+ }else if($this->miniorange_pass2login_check_inline_user_2fa_methods($login_status)){
1177
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1178
+ if (sizeof($opt) > 1) {
1179
+
1180
+ prompt_user_to_select_2factor_method_frontend($current_user);
1181
+
1182
+ }else if( in_array("SMS", $opt) || in_array("PHONE VERIFICATION", $opt) ){
1183
+ $authtype = array_shift($opt);
1184
+ update_user_meta($current_user,'mo2f_selected_2factor_method',$authtype);
1185
+ prompt_user_for_phone_setup_frontend($current_user);
1186
+
1187
+ }else if( in_array("SOFT TOKEN", $opt) || in_array("PUSH NOTIFICATIONS", $opt) || in_array("MOBILE AUTHENTICATION", $opt) ){
1188
+ $authtype = array_shift($opt);
1189
+ update_user_meta($current_user,'mo2f_selected_2factor_method',$authtype);
1190
+ prompt_user_for_miniorange_app_setup_frontend($current_user);
1191
+
1192
+ }else if( in_array("GOOGLE AUTHENTICATOR", $opt) ){
1193
+ update_user_meta($current_user,'mo2f_selected_2factor_method','GOOGLE AUTHENTICATOR');
1194
+ prompt_user_for_google_authenticator_setup_frontend($current_user);
1195
+
1196
+ }else if( in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt) ){
1197
+ update_user_meta($current_user,'mo2f_selected_2factor_method','AUTHY 2-FACTOR AUTHENTICATION');
1198
+ prompt_user_for_authy_authenticator_setup_frontend($current_user);
1199
+
1200
+ }else if( in_array("KBA", $opt) ){
1201
+ update_user_meta($current_user,'mo2f_selected_2factor_method','KBA');
1202
+ prompt_user_for_kba_setup_frontend($current_user);
1203
+
1204
+ }else{
1205
+ update_user_meta($current_user,'mo2f_selected_2factor_method','OUT OF BAND EMAIL');
1206
+ prompt_user_for_setup_success_frontend($current_user);
1207
+ }
1208
+ }
1209
+ }
1210
+
1211
+ function miniorange_pass2login_inline_setup_success($login_status){
1212
+ if($login_status == 'MO_2_FACTOR_SETUP_SUCCESS'){
1213
+ $nonce = '';
1214
+ if(isset($_POST['miniorange_inline_validate_otp_nonce']) ){ //After OTP over SMS and Phone Call Setup
1215
+ $nonce = $_POST['miniorange_inline_validate_otp_nonce'];
1216
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-otp-nonce' )){
1217
+ return true;
1218
+ }
1219
+ }else if(isset($_POST['mo2f_inline_validate_ga_nonce'])){ // After Google Authenticator Setup
1220
+ $nonce = $_POST['mo2f_inline_validate_ga_nonce'];
1221
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-inline-google-auth-nonce')){
1222
+ return true;
1223
+ }
1224
+ }else if(isset($_POST['mo2f_inline_validate_authy_authentication_nonce'])){
1225
+ $nonce = $_POST['mo2f_inline_validate_authy_authentication_nonce'];
1226
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-authy-authentication-nonce' )){
1227
+ return true;
1228
+ }
1229
+ }else if(isset($_POST['mo_auth_inline_mobile_registration_complete_nonce']) ){ // After Soft Token, Push And QR Code Setup
1230
+ $nonce = $_POST['mo_auth_inline_mobile_registration_complete_nonce'];
1231
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-mobile-registration-complete-nonce' )){
1232
+ return true;
1233
+ }
1234
+ }else if(isset($_POST['mo2f_inline_save_kba_nonce']) ){ // After KBA Setup
1235
+ $nonce = $_POST['mo2f_inline_save_kba_nonce'];
1236
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-kba-nonce' )){
1237
+ return true;
1238
+ }
1239
+ }else if(isset($_POST['miniorange_inline_save_2factor_method_nonce']) ){ // After Email Verification Radio button Click
1240
+ $nonce = $_POST['miniorange_inline_save_2factor_method_nonce'];
1241
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-2factor-method-nonce' )){
1242
+ return true;
1243
+ }
1244
+ }if(isset($_POST['miniorange_inline_validate_user_otp_nonce']) ){ // After user email is verified by entering OTP if there is only signle method
1245
+ $nonce = $_POST['miniorange_inline_validate_user_otp_nonce'];
1246
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-user-otp-nonce' )){
1247
+ return true;
1248
+ }
1249
+ }
1250
+ }
1251
+ return false;
1252
+ }
1253
+
1254
+ function miniorange_pass2login_check_inline_user_2fa_methods($login_status){
1255
+
1256
+ if($login_status == 'MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS'){
1257
+ $nonce = '';
1258
+ if(isset($_POST['miniorange_inline_validate_user_otp_nonce']) ){ // After email is verified during inline
1259
+ $nonce = $_POST['miniorange_inline_validate_user_otp_nonce'];
1260
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-user-otp-nonce' )){
1261
+ return true;
1262
+ }
1263
+ }else if(isset($_POST['miniorange_inline_two_factor_setup'])){
1264
+ $nonce = $_POST['miniorange_inline_two_factor_setup'];
1265
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-inline-setup-nonce')){
1266
+ return true;
1267
+ }
1268
+ }else if(isset($_POST['miniorange_login_nonce']) ){ // after username + password when only email is verified earlier but 2nd factor is not setup
1269
+ $nonce = $_POST['miniorange_login_nonce'];
1270
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1271
+ return true;
1272
+ }
1273
+ }else if(isset($_POST['miniorange_inline_save_2factor_method_nonce']) ){
1274
+ $nonce = $_POST['miniorange_inline_save_2factor_method_nonce'];
1275
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-save-2factor-method-nonce' )){
1276
+ return true;
1277
+ }
1278
+ }else if(isset($_POST['miniorange_inline_verify_phone_nonce'])){
1279
+ $nonce = $_POST['miniorange_inline_verify_phone_nonce'];
1280
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-verify-phone-nonce' )){
1281
+ return true;
1282
+ }
1283
+ }else if(isset($_POST['miniorange_inline_resend_otp_nonce'])){
1284
+ $nonce = $_POST['miniorange_inline_resend_otp_nonce'];
1285
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-resend-otp-nonce' )){
1286
+ return true;
1287
+ }
1288
+ }else if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
1289
+ $nonce = $_POST['miniorange_inline_validate_otp_nonce'];
1290
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-otp-nonce' )){
1291
+ return true;
1292
+ }
1293
+ }else if(isset($_POST['miniorange_inline_show_qrcode_nonce'])){
1294
+ $nonce = $_POST['miniorange_inline_show_qrcode_nonce'];
1295
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-show-qrcode-nonce' )){
1296
+ return true;
1297
+ }
1298
+ }else if(isset($_POST['mo2f_inline_ga_phone_type_nonce'])){
1299
+ $nonce = $_POST['mo2f_inline_ga_phone_type_nonce'];
1300
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-ga-phone-type-nonce' )){
1301
+ return true;
1302
+ }
1303
+ }else if(isset($_POST['mo2f_inline_validate_ga_nonce'])){
1304
+ $nonce = $_POST['mo2f_inline_validate_ga_nonce'];
1305
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-google-auth-nonce' )){
1306
+ return true;
1307
+ }
1308
+ }else if(isset($_POST['mo2f_inline_authy_configure_nonce'])){
1309
+ $nonce = $_POST['mo2f_inline_authy_configure_nonce'];
1310
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-authy-configuration-nonce' )){
1311
+ return true;
1312
+ }
1313
+ }else if(isset($_POST['mo2f_inline_validate_authy_authentication_nonce'])){
1314
+ $nonce = $_POST['mo2f_inline_validate_authy_authentication_nonce'];
1315
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-authy-authentication-nonce' )){
1316
+ return true;
1317
+ }
1318
+ }
1319
+ }
1320
+ return false;
1321
+ }
1322
+
1323
+ function miniorange_pass2login_check_inline_user_otp($login_status){
1324
+
1325
+ if($login_status == 'MO_2_FACTOR_PROMPT_FOR_USER_REG_OTP'){
1326
+ $nonce = '';
1327
+ if(isset($_POST['miniorange_inline_user_reg_nonce']) ){
1328
+ $nonce = $_POST['miniorange_inline_user_reg_nonce'];
1329
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-user-reg-nonce' )){
1330
+ return true;
1331
+ }
1332
+ }else if(isset($_POST['miniorange_inline_validate_user_otp_nonce']) ){
1333
+ $nonce = $_POST['miniorange_inline_validate_user_otp_nonce'];
1334
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-validate-user-otp-nonce' )){
1335
+ return true;
1336
+ }
1337
+ }else if(isset($_POST['miniorange_inline_resend_otp_nonce']) ){
1338
+ $nonce = $_POST['miniorange_inline_resend_otp_nonce'];
1339
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-resend-otp-nonce' )){
1340
+ return true;
1341
+ }
1342
+ }
1343
+ }
1344
+ return false;
1345
+ }
1346
+
1347
+ function miniorange_pass2login_check_inline_user_registration($login_status){
1348
+ if($login_status == 'MO_2_FACTOR_PROMPT_FOR_USER_REGISTRATION'){
1349
+ $nonce = '';
1350
+
1351
+ if(isset($_POST['miniorange_login_nonce']) ){
1352
+ $nonce = $_POST['miniorange_login_nonce'];
1353
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1354
+ return true;
1355
+ }
1356
+ }else if(isset($_POST['miniorange_inline_goto_user_registration_nonce'])){
1357
+ $nonce = $_POST['miniorange_inline_goto_user_registration_nonce'];
1358
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-inline-goto-user-registration-nonce')){
1359
+ return true;
1360
+ }
1361
+ }else if(isset($_POST['miniorange_inline_user_reg_nonce']) ){
1362
+ $nonce = $_POST['miniorange_inline_user_reg_nonce'];
1363
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-inline-user-reg-nonce' )){
1364
+ return true;
1365
+ }
1366
+ }
1367
+ }
1368
+ return false;
1369
+ }
1370
+
1371
+ function miniorange_pass2login_check_forgotphone_status($login_status){ // after clicking on forgotphone link when both kba and email are configured
1372
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AND_OTP_OVER_EMAIL'){
1373
+ $nonce = '';
1374
+ if(isset($_POST['miniorange_forgotphone'])){
1375
+ $nonce = $_POST['miniorange_forgotphone'];
1376
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
1377
+ return true;
1378
+ }
1379
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
1380
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
1381
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
1382
+ return true;
1383
+ }
1384
+ }
1385
+ }
1386
+ return false;
1387
+ }
1388
+
1389
+ function miniorange_pass2login_check_trusted_device_status($login_status){
1390
+
1391
+ if($login_status == 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE'){
1392
+ $nonce = '';
1393
+ if(isset($_POST['miniorange_soft_token_nonce'])){
1394
+ $nonce = $_POST['miniorange_soft_token_nonce'];
1395
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-soft-token-nonce')){
1396
+ return true;
1397
+ }
1398
+ }else if(isset($_POST['miniorange_mobile_validation_nonce'])){
1399
+ $nonce = $_POST['miniorange_mobile_validation_nonce'];
1400
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-mobile-validation-nonce')){
1401
+ return true;
1402
+ }
1403
+ }else if(isset($_POST['miniorange_kba_nonce'])){
1404
+ $nonce = $_POST['miniorange_kba_nonce'];
1405
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-kba-nonce')){
1406
+ return true;
1407
+ }
1408
+ }
1409
+ }
1410
+ return false;
1411
+ }
1412
+
1413
+ function miniorange_pass2login_check_push_oobemail_status($login_status){ // for push and out of and email
1414
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL'){
1415
+ $nonce = '';
1416
+
1417
+ if(isset($_POST['miniorange_login_nonce']) ){
1418
+ $nonce = $_POST['miniorange_login_nonce'];
1419
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1420
+ return true;
1421
+ }
1422
+ }else if(isset($_POST['miniorange_forgotphone'])){
1423
+ $nonce = $_POST['miniorange_forgotphone'];
1424
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
1425
+ return true;
1426
+ }
1427
+ }
1428
+ }
1429
+ return false;
1430
+ }
1431
+
1432
+ function miniorange_pass2login_check_otp_status($login_status){
1433
+ 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'){
1434
+ $nonce = '';
1435
+
1436
+ if(isset($_POST['miniorange_login_nonce']) ){
1437
+ $nonce = $_POST['miniorange_login_nonce'];
1438
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1439
+ return true;
1440
+ }
1441
+ }
1442
+ if(isset($_POST['miniorange_softtoken'])){
1443
+ $nonce = $_POST['miniorange_softtoken'];
1444
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-softtoken')){
1445
+ return true;
1446
+ }
1447
+ }else if(isset($_POST['miniorange_forgotphone'])){
1448
+ $nonce = $_POST['miniorange_forgotphone'];
1449
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
1450
+ return true;
1451
+ }
1452
+ }else if(isset($_POST['miniorange_soft_token_nonce'])){
1453
+ $nonce = $_POST['miniorange_soft_token_nonce'];
1454
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-soft-token-nonce')){
1455
+ return true;
1456
+ }
1457
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
1458
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
1459
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
1460
+ return true;
1461
+ }
1462
+ }
1463
+ }
1464
+ return false;
1465
+ }
1466
+
1467
+ function miniorange_pass2login_check_mobile_status($login_status){ //mobile authentication
1468
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION'){
1469
+ $nonce = '';
1470
+ if(isset($_POST['miniorange_login_nonce']) ){
1471
+ $nonce = $_POST['miniorange_login_nonce'];
1472
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1473
+ return true;
1474
+ }
1475
+ }else if(isset($_POST['miniorange_forgotphone'])){
1476
+ $nonce = $_POST['miniorange_forgotphone'];
1477
+ if(wp_verify_nonce($nonce,'miniorange-2-factor-forgotphone')){
1478
+ return true;
1479
+ }
1480
+ }
1481
+ }
1482
+ return false;
1483
+ }
1484
+
1485
+ function miniorange_pass2login_check_kba_status($login_status){
1486
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION'){
1487
+ $nonce = '';
1488
+ if(isset($_POST['miniorange_login_nonce']) ){
1489
+ $nonce = $_POST['miniorange_login_nonce'];
1490
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-login-nonce' )){
1491
+ return true;
1492
+ }
1493
+ }else if(isset($_POST['miniorange_kba_nonce']) ){
1494
+ $nonce = $_POST['miniorange_kba_nonce'];
1495
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-kba-nonce' )){
1496
+ return true;
1497
+ }
1498
+ }else if(isset($_POST['miniorange_alternate_login_kba_nonce'])){
1499
+ $nonce = $_POST['miniorange_alternate_login_kba_nonce'];
1500
+ if(wp_verify_nonce( $nonce, 'miniorange-2-factor-alternate-login-kba-nonce' )){
1501
+ return true;
1502
+ }
1503
+ }else if(isset($_POST['miniorange_challenge_forgotphone_nonce'])){
1504
+ $nonce = $_POST['miniorange_challenge_forgotphone_nonce'];
1505
+ if ( wp_verify_nonce( $nonce, 'miniorange-2-factor-challenge-forgotphone-nonce' ) ) {
1506
+ return true;
1507
+ }
1508
+ }
1509
+ }
1510
+ return false;
1511
+ }
1512
+
1513
+ function miniorange_pass2login_footer_form(){
1514
+
1515
+ if(isset($_SESSION[ 'mo_2factor_login_status' ])){ //show these forms after default login form
1516
+ ?>
1517
+ <form name="f" id="mo2f_show_softtoken_loginform" method="post" action="" style="display:none;">
1518
+ <input type="hidden" name="miniorange_softtoken" value="<?php echo wp_create_nonce('miniorange-2-factor-softtoken'); ?>" />
1519
+ </form>
1520
+ <form name="f" id="mo2f_show_forgotphone_loginform" method="post" action="" style="display:none;">
1521
+ <input type="hidden" name="miniorange_forgotphone" value="<?php echo wp_create_nonce('miniorange-2-factor-forgotphone'); ?>" />
1522
+ </form>
1523
+ <form name="f" id="mo2f_backto_mo_loginform" method="post" action="<?php echo wp_login_url(); ?>" style="display:none;">
1524
+ <input type="hidden" name="miniorange_mobile_validation_failed_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-mobile-validation-failed-nonce'); ?>" />
1525
+ </form>
1526
+ <form name="f" id="mo2f_alternate_login_kbaform" method="post" action="" style="display:none;">
1527
+ <input type="hidden" name="miniorange_alternate_login_kba_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-alternate-login-kba-nonce'); ?>" />
1528
+ </form>
1529
+ <form name="f" id="mo2f_challenge_forgotphone_form" method="post" action="" style="display:none;">
1530
+ <input type="hidden" name="mo2f_selected_2factor_method" />
1531
+ <input type="hidden" name="miniorange_challenge_forgotphone_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-challenge-forgotphone-nonce'); ?>" />
1532
+ </form>
1533
+ <?php if(get_option('mo2f_enable_2fa_for_woocommerce') == 1) { ?>
1534
+ <form name="f" id="mo2f_2fa_form_close" method="post" style="display:none;">
1535
+ <input type="hidden" name="miniorange_mobile_validation_failed_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-mobile-validation-failed-nonce'); ?>" />
1536
+ </form>
1537
+ <?php }
1538
+ }
1539
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && ($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' )){ //show this form when 2nd factor is mobile,email verification,push
1540
+ ?>
1541
+ <form name="f" id="mo2f_mobile_validation_form" method="post" action="" style="display:none;">
1542
+ <input type="hidden" name="miniorange_mobile_validation_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-mobile-validation-nonce'); ?>" />
1543
+ </form>
1544
+ <?php
1545
+ }
1546
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && ($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN' || $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION')){ //show this form when 2nd factor is otp over email(forgot phone),otp over sms,phone verification,soft token,google authenticator
1547
+ ?>
1548
+ <form name="f" id="mo2f_submitotp_loginform" method="post" action="" style="display:none;">
1549
+ <input type="text" name="mo2fa_softtoken" id="mo2fa_softtoken" hidden/>
1550
+ <input type="hidden" name="miniorange_soft_token_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-soft-token-nonce'); ?>" />
1551
+ </form>
1552
+ <?php
1553
+ }
1554
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && ($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION')){ //show this form only when 2nd factor is KBA
1555
+ ?>
1556
+ <form name="f" id="mo2f_submitkba_loginform" method="post" action="" style="display:none;">
1557
+ <input type="text" name="mo2f_answer_1" id="mo2f_answer_1" hidden />
1558
+ <input type="text" name="mo2f_answer_2" id="mo2f_answer_1" hidden />
1559
+ <input type="text" name="mo2f_trust_device" id="mo2f_trust_device" hidden />
1560
+ <input type="hidden" name="miniorange_kba_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-kba-nonce'); ?>" />
1561
+ </form>
1562
+ <?php
1563
+ }
1564
+ if(get_option('mo2f_deviceid_enabled') && get_option('mo2f_login_policy')){ //show this form and script only rba is on
1565
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_REMEMBER_TRUSTED_DEVICE' ){ //show this form only when rba is on and device is not trusted.
1566
+ ?>
1567
+
1568
+ <form name="f" id="mo2f_trust_device_confirm_form" method="post" action="" style="display:none;">
1569
+ <input type="hidden" name="mo2f_trust_device_confirm_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-trust-device-confirm-nonce'); ?>" />
1570
+ </form>
1571
+ <form name="f" id="mo2f_trust_device_cancel_form" method="post" action="" style="display:none;">
1572
+ <input type="hidden" name="mo2f_trust_device_cancel_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-trust-device-cancel-nonce'); ?>" />
1573
+ </form>
1574
+ <?php
1575
+ }
1576
+ ?>
1577
+
1578
+ <script>
1579
+ jQuery(document).ready(function(){
1580
+ if(document.getElementById('loginform') != null){
1581
+ jQuery('#loginform').on('submit', function(e){
1582
+ jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
1583
+ });
1584
+ }else{
1585
+ if(document.getElementsByClassName('login') != null){
1586
+ jQuery('.login').on('submit', function(e){
1587
+ jQuery('#miniorange_rba_attribures').val(JSON.stringify(rbaAttributes.attributes));
1588
+ });
1589
+ }
1590
+ }
1591
+ });
1592
+ </script>
1593
+ <?php }
1594
+ ?>
1595
+ <form name="f" id="mo2f_inline_register_user_form" method="post" action="" style="display:none;">
1596
+ <input type="text" name="mo_useremail" id="mo2fa_user_email" hidden/>
1597
+ <input type="hidden" name="miniorange_inline_user_reg_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-user-reg-nonce'); ?>" />
1598
+ </form>
1599
+ <form name="f" id="mo2f_inline_register_skip_form" method="post" style="display:none;">
1600
+ <input type="hidden" name="miniorange_inline_skip_registration_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-skip-registration-nonce'); ?>" />
1601
+ </form>
1602
+ <form name="f" id="mo2f_goto_user_registration_form" method="post" action="" style="display:none;">
1603
+ <input type="hidden" name="miniorange_inline_goto_user_registration_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-goto-user-registration-nonce'); ?>" />
1604
+ </form>
1605
+ <form name="f" id="mo2f_inline_user_validate_otp_form" method="post" action="" style="display:none;">
1606
+ <input type="hidden" name="otp_token" />
1607
+ <input type="hidden" name="miniorange_inline_validate_user_otp_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-validate-user-otp-nonce'); ?>" />
1608
+
1609
+ </form>
1610
+ <form name="f" method="post" action="" id="mo2fa_inline_resend_otp_form" style="display:none;">
1611
+ <input type="hidden" name="miniorange_inline_resend_otp_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-resend-otp-nonce'); ?>" />
1612
+ </form>
1613
+ <form name="f" method="post" action="" id="mo2f_select_2fa_methods_form" style="display:none;">
1614
+ <input type="hidden" name="mo2f_selected_2factor_method" />
1615
+ <input type="hidden" name="miniorange_inline_save_2factor_method_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-save-2factor-method-nonce'); ?>" />
1616
+ </form>
1617
+ <form name="f" method="post" action="" id="mo2f_inline_verifyphone_form" style="display:none;">
1618
+ <input type="hidden" name="verify_phone" />
1619
+ <input type="hidden" name="miniorange_inline_verify_phone_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-verify-phone-nonce'); ?>" />
1620
+ </form>
1621
+ <form name="f" method="post" action="" id="mo2f_inline_validateotp_form" style="display:none;">
1622
+ <input type="hidden" name="otp_token" />
1623
+ <input type="hidden" name="miniorange_inline_validate_otp_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-validate-otp-nonce'); ?>" />
1624
+ </form>
1625
+ <form name="f" method="post" action="" id="mo2f_inline_configureapp_form" style="display:none;">
1626
+ <input type="hidden" name="miniorange_inline_show_qrcode_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-show-qrcode-nonce'); ?>" />
1627
+ </form>
1628
+ <form name="f" method="post" id="mo2f_inline_mobile_register_form" action="" style="display:none;">
1629
+ <input type="hidden" name="mo_auth_inline_mobile_registration_complete_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-mobile-registration-complete-nonce'); ?>" />
1630
+ </form>
1631
+ <form name="f" method="post" id="mo2f_inline_save_kba_form" action="" style="display:none;">
1632
+ <input type="text" name="mo2f_kbaquestion_1" id="mo2f_kbaquestion_1" hidden />
1633
+ <input type="text" name="mo2f_kba_ans1" id="mo2f_kba_ans1" hidden />
1634
+ <input type="text" name="mo2f_kbaquestion_2" id="mo2f_kbaquestion_2" hidden />
1635
+ <input type="text" name="mo2f_kba_ans2" id="mo2f_kba_ans2" hidden />
1636
+ <input type="text" name="mo2f_kbaquestion_3" id="mo2f_kbaquestion_3" hidden />
1637
+ <input type="text" name="mo2f_kba_ans3" id="mo2f_kba_ans3" hidden />
1638
+ <input type="hidden" name="mo2f_inline_kba_option" />
1639
+ <input type="hidden" name="mo2f_inline_save_kba_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-save-kba-nonce'); ?>" />
1640
+ </form>
1641
+ <form name="f" method="post" action="" id="mo2f_goto_two_factor_form" style="display:none;">
1642
+ <input type="hidden" name="miniorange_inline_two_factor_setup" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-setup-nonce'); ?>" />
1643
+ </form>
1644
+ <form name="f" method="post" id="mo2f_inline_app_type_ga_form" action="" style="display:none;">
1645
+ <input type="hidden" name="google_phone_type" />
1646
+ <input type="hidden" name="mo2f_inline_ga_phone_type_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-ga-phone-type-nonce'); ?>" />
1647
+ </form>
1648
+ <form name="" method="post" id="mo2f_inline_verify_ga_code_form" style="display:none;">
1649
+ <input type="hidden" name="google_auth_code" />
1650
+ <input type="hidden" name="mo2f_inline_validate_ga_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-google-auth-nonce'); ?>" />
1651
+ </form>
1652
+ <form name="f" method="post" id="mo2f_inline_authy_configure_form" action="" style="display:none;">
1653
+ <input type="hidden" name="mo2f_inline_authy_configure_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-authy-configuration-nonce'); ?>" />
1654
+ </form>
1655
+ <form name="" method="post" id="mo2f_inline_validate_authy_authentication_form" style="display:none;">
1656
+ <input type="hidden" name="authy_auth_code" />
1657
+ <input type="hidden" name="mo2f_inline_validate_authy_authentication_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-inline-authy-authentication-nonce'); ?>" />
1658
+ </form>
1659
+
1660
+ <?php
1661
+ }
1662
+
1663
+ function mo2f_pass2login_otp_verification($user,$mo2f_second_factor){
1664
+ if($mo2f_second_factor == 'SOFT TOKEN'){
1665
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the <b>miniOrange Authenticator</b> app.';
1666
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
1667
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
1668
+ $_SESSION['mo2f-login-message'] = get_user_meta($user->ID,'mo2f_external_app_type',true) == 'AUTHY 2-FACTOR AUTHENTICATION' ? 'Please enter the one time passcode shown in the <b>Authy 2-Factor Authentication</b> app.' : 'Please enter the one time passcode shown in the <b>Google Authenticator</b> app.';
1669
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION';
1670
+ }else{
1671
+ $challengeMobile = new Customer_Setup();
1672
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), $mo2f_second_factor,get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1673
+ $response = json_decode($content, true);
1674
+ if(json_last_error() == JSON_ERROR_NONE) {
1675
+ if($response['status'] == 'SUCCESS'){
1676
+ $message = $mo2f_second_factor == 'SMS' ? 'The OTP has been sent to '. MO2f_Utility::get_hidden_phone($response['phoneDelivery']['contact']) . '. Please enter the OTP you received to Validate.' : 'You will receive phone call on ' . MO2f_Utility::get_hidden_phone($response['phoneDelivery']['contact']) . ' with OTP. Please enter the OTP to Validate.';
1677
+ $_SESSION['mo2f-login-message'] = $message;
1678
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response[ 'txId' ];
1679
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'SMS' ? 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' : 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION';
1680
+ }else{
1681
+ $message = $mo2f_second_factor == 'SMS' ? $response['message'] . ' You can click on <b>Forgot your phone</b> link to login via alternate method.' : 'We are unable to send the OTP via phone call on your regsitared phone. You can click on <b>Forgot your phone</b> link to receive OTP to your registered email.';
1682
+ $_SESSION['mo2f-login-message'] = $message;
1683
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response[ 'txId' ];
1684
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'SMS' ? 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS' : 'MO_2_FACTOR_CHALLENGE_PHONE_VERIFICATION';
1685
+ }
1686
+ }else{
1687
+ $this->remove_current_activity();
1688
+ $error = new WP_Error();
1689
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1690
+ return $error;
1691
+ }
1692
+ }
1693
+ }
1694
+
1695
+ function mo2f_pass2login_push_oobemail_verification($user,$mo2f_second_factor){
1696
+ $challengeMobile = new Customer_Setup();
1697
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true),$mo2f_second_factor ,get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1698
+ $response = json_decode($content, true);
1699
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
1700
+ if($response['status'] == 'SUCCESS'){
1701
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
1702
+ $_SESSION['mo2f-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_hiden_email(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true)) . '. We are waiting for your approval.';
1703
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
1704
+ }else if($response['status'] == 'ERROR' || $response['status'] == 'FAILED' ){
1705
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
1706
+ $_SESSION['mo2f-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.';
1707
+ $_SESSION[ 'mo_2factor_login_status' ] = $mo2f_second_factor == 'PUSH NOTIFICATIONS' ? 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' : 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL';
1708
+ }
1709
+ }else{
1710
+ $this->remove_current_activity();
1711
+ $error = new WP_Error();
1712
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1713
+ return $error;
1714
+ }
1715
+ }
1716
+
1717
+ function mo2f_pass2login_kba_verification($user){
1718
+ $challengeKba = new Customer_Setup();
1719
+ $content = $challengeKba->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), 'KBA',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1720
+ $response = json_decode($content, true);
1721
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
1722
+ if($response['status'] == 'SUCCESS'){
1723
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
1724
+ $questions = array();
1725
+ $questions[0] = $response['questions'][0]['question'];
1726
+ $questions[1] = $response['questions'][1]['question'];
1727
+ $_SESSION[ 'mo_2_factor_kba_questions' ] = $questions;
1728
+ $_SESSION['mo2f-login-message'] = 'Please answer the following questions:';
1729
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_KBA_AUTHENTICATION';
1730
+ }else if($response['status'] == 'ERROR'){
1731
+ $this->remove_current_activity();
1732
+ $error = new WP_Error();
1733
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1734
+ return $error;
1735
+ }
1736
+ }else{
1737
+ $this->remove_current_activity();
1738
+ $error = new WP_Error();
1739
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1740
+ return $error;
1741
+ }
1742
+ }
1743
+
1744
+ function mo2f_pass2login_mobile_verification($user){
1745
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
1746
+ if(MO2f_Utility::check_if_request_is_from_mobile_device($useragent)){
1747
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
1748
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
1749
+ $_SESSION['mo2f-login-message'] = 'Please enter the one time passcode shown in the miniOrange Authenticator app.';
1750
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN';
1751
+ }else{
1752
+ $challengeMobile = new Customer_Setup();
1753
+ $content = $challengeMobile->send_otp_token(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true), 'MOBILE AUTHENTICATION',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1754
+ $response = json_decode($content, true);
1755
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
1756
+ if($response['status'] == 'SUCCESS'){
1757
+ $_SESSION[ 'mo2f-login-qrCode' ] = $response['qrCode'];
1758
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
1759
+ $_SESSION[ 'mo_2factor_login_status' ] = 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION';
1760
+ }else if($response['status'] == 'ERROR'){
1761
+ $this->remove_current_activity();
1762
+ $error = new WP_Error();
1763
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1764
+ return $error;
1765
+ }
1766
+ }else{
1767
+ $this->remove_current_activity();
1768
+ $error = new WP_Error();
1769
+ $error->add('empty_username', __('<strong>ERROR</strong>: An error occured while processing your request. Please Try again.'));
1770
+ return $error;
1771
+ }
1772
+ }
1773
+
1774
+ }
1775
+
1776
+ function mo_2_factor_pass2login_show_wp_login_form(){
1777
+ ?>
1778
+ <p><input type="hidden" name="miniorange_login_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-login-nonce'); ?>" />
1779
+ <a href="http://miniorange.com/cloud-identity-broker-service" style="display:none;"></a>
1780
+ <a href="http://miniorange.com/strong_auth" style="display:none;"></a>
1781
+ <a href="http://miniorange.com/single-sign-on-sso" style="display:none;"></a>
1782
+ <a href="http://miniorange.com/fraud" style="display:none;"></a>
1783
+ </p>
1784
+ <?php
1785
+ if(get_option('mo2f_deviceid_enabled')){
1786
+ ?>
1787
+ <p><input type="hidden" id="miniorange_rba_attribures" name="miniorange_rba_attribures" value="" /></p>
1788
+ <?php
1789
+ wp_enqueue_script( 'jquery_script', plugins_url('includes/js/rba/js/jquery-1.9.1.js', __FILE__ ));
1790
+ wp_enqueue_script( 'flash_script', plugins_url('includes/js/rba/js/jquery.flash.js', __FILE__ ));
1791
+ wp_enqueue_script( 'uaparser_script', plugins_url('includes/js/rba/js/ua-parser.js', __FILE__ ));
1792
+ wp_enqueue_script( 'client_script', plugins_url('includes/js/rba/js/client.js', __FILE__ ));
1793
+ wp_enqueue_script( 'device_script', plugins_url('includes/js/rba/js/device_attributes.js', __FILE__ ));
1794
+ wp_enqueue_script( 'swf_script', plugins_url('includes/js/rba/js/swfobject.js', __FILE__ ));
1795
+ wp_enqueue_script( 'font_script', plugins_url('includes/js/rba/js/fontdetect.js', __FILE__ ));
1796
+ wp_enqueue_script( 'murmur_script', plugins_url('includes/js/rba/js/murmurhash3.js', __FILE__ ));
1797
+ wp_enqueue_script( 'miniorange_script', plugins_url('includes/js/rba/js/miniorange-fp.js', __FILE__ ));
1798
+ }
1799
+ }
1800
+
1801
+ function mo2f_register_user_inline($email){
1802
+
1803
+ $enduser = new Two_Factor_Setup();
1804
+ $check_user = json_decode($enduser->mo_check_user_already_exist($email),true);
1805
+ $current_user = unserialize($_SESSION[ 'mo2f_current_user' ]);
1806
+ $currentUserId = $current_user->ID;
1807
+
1808
+ if(json_last_error() == JSON_ERROR_NONE){
1809
+ if($check_user['status'] == 'ERROR'){
1810
+ $_SESSION['mo2f-login-message'] = $check_user['message'];
1811
+
1812
+ }else{
1813
+ if(strcasecmp($check_user['status'], 'USER_FOUND') == 0){
1814
+
1815
+ delete_user_meta($currentUserId,'mo_2factor_user_email');
1816
+ update_user_meta($currentUserId,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1817
+ update_user_meta($currentUserId,'mo_2factor_map_id_with_email',$email);
1818
+ update_user_meta($currentUserId,'mo_2factor_user_registration_status','MO_2_FACTOR_INITIALIZE_TWO_FACTOR');
1819
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1820
+ $message = '';
1821
+ $_SESSION['mo2f-login-message'] = $message;
1822
+
1823
+
1824
+ }else if(strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
1825
+ $content = json_decode($enduser->mo_create_user($current_user,$email), true);
1826
+ if(json_last_error() == JSON_ERROR_NONE) {
1827
+ if($content['status'] == 'ERROR'){
1828
+ $_SESSION['mo2f-login-message'] = $content['message'];
1829
+ }else{
1830
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1831
+ delete_user_meta($currentUserId,'mo_2factor_user_email');
1832
+ update_user_meta($currentUserId,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1833
+ update_user_meta($currentUserId,'mo_2factor_map_id_with_email',$email);
1834
+ update_user_meta($currentUserId,'mo_2factor_user_registration_status','MO_2_FACTOR_INITIALIZE_TWO_FACTOR');
1835
+ $enduser->mo2f_update_userinfo(get_user_meta($currentUserId,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,null,null);
1836
+ $message = '';
1837
+ $_SESSION['mo2f-login-message'] = $message;
1838
+
1839
+ $_SESSION[ 'mo_2factor_login_status' ] ='MO_2_FACTOR_PROMPT_USER_FOR_2FA_METHODS';
1840
+
1841
+ }else{
1842
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user. Please try again.';
1843
+
1844
+ }
1845
+ }
1846
+ }else{
1847
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user. Please try again or contact your admin.';
1848
+
1849
+ }
1850
+ }else{
1851
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user. Please try again.';
1852
+
1853
+ }
1854
+ }
1855
+ }else{
1856
+ $_SESSION['mo2f-login-message'] = 'Error occurred while registering the user. Please try again.';
1857
+
1858
+ }
1859
+
1860
+ }
1861
+
1862
+ function mo2f_inline_get_qr_code_for_mobile($email,$id){
1863
+ $registerMobile = new Two_Factor_Setup();
1864
+ $content = $registerMobile->register_mobile($email);
1865
+ $response = json_decode($content, true);
1866
+ if(json_last_error() == JSON_ERROR_NONE) {
1867
+ if($response['status'] == 'ERROR'){
1868
+ $_SESSION['mo2f-login-message'] = $response['message'];
1869
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
1870
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
1871
+ unset($_SESSION[ 'mo2f_show_qr_code']);
1872
+ }else{
1873
+ if($response['status'] == 'IN_PROGRESS'){
1874
+
1875
+ $_SESSION[ 'mo2f-login-qrCode' ] = $response['qrCode'];
1876
+ $_SESSION[ 'mo2f-login-transactionId' ] = $response['txId'];
1877
+ $_SESSION[ 'mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
1878
+ }else{
1879
+ $_SESSION['mo2f-login-message'] = "An error occured while processing your request. Please Try again.";
1880
+ unset($_SESSION[ 'mo2f-login-qrCode' ]);
1881
+ unset($_SESSION[ 'mo2f-login-transactionId' ]);
1882
+ unset($_SESSION[ 'mo2f_show_qr_code']);
1883
+ }
1884
+ }
1885
+ }
1886
+ }
1887
+
1888
+ function mo_2_factor_pass2login_show_qr_code(){ //for mobile authentication
1889
+ mo2f_getqrcode();
1890
+ }
1891
+
1892
+ function mo_2_factor_pass2login_show_otp_token(){ //for soft token,sms,email(forgot phone),phone verification
1893
+ mo2f_getotp_form();
1894
+ }
1895
+
1896
+ function mo_2_factor_pass2login_show_push_oobemail($id){ //for push notification and out of band email
1897
+ mo2f_getpush_oobemail_response($id);
1898
+ }
1899
+
1900
+ function mo_2_factor_pass2login_show_device_page(){
1901
+ mo2f_get_device_form();
1902
+ }
1903
+
1904
+ function mo_2_factor_pass2login_show_kba(){
1905
+ mo2f_getkba_form();
1906
+ }
1907
+
1908
+ function mo_2_factor_pass2login_show_forgotphone(){
1909
+ mo2f_get_forgotphone_form();
1910
+ }
1911
+ }
1912
+ ?>
class-miniorange-2-factor-user-registration.php ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Miniorange_User_Register{
26
+
27
+ function __construct(){
28
+ add_action( 'admin_init', array( $this, 'miniorange_user_save_settings' ) );
29
+ add_action( 'admin_enqueue_scripts', array( $this, 'plugin_settings_style' ) );
30
+ }
31
+
32
+ function plugin_settings_style() {
33
+ wp_enqueue_style( 'mo_2_factor_admin_settings_style', plugins_url('includes/css/style_settings.css?version=4.1.3', __FILE__));
34
+ }
35
+
36
+ function mo_auth_success_message() {
37
+ $message = get_option('mo2f_message'); ?>
38
+ <script>
39
+
40
+ jQuery(document).ready(function() {
41
+
42
+ var message = "<?php echo $message; ?>";
43
+ jQuery('#messages').append("<div class='error notice is-dismissible mo2f_error_container'> <p class='mo2f_msgs'>" + message + "</p></div>");
44
+ });
45
+ </script>
46
+ <?php
47
+ }
48
+
49
+ function mo_auth_error_message() {
50
+ $message = get_option('mo2f_message'); ?>
51
+ <script>
52
+ jQuery(document).ready(function() {
53
+
54
+ var message = "<?php echo $message; ?>";
55
+ jQuery('#messages').append("<div class='updated notice is-dismissible mo2f_success_container'> <p class='mo2f_msgs'>" + message + "</p></div>");
56
+
57
+ jQuery('a[href=\"#test\"]').click(function() {
58
+ var currentMethod = jQuery(this).data("method");
59
+
60
+ if(currentMethod == 'MOBILE AUTHENTICATION'){
61
+ jQuery('#mo2f_2factor_test_mobile_form').submit();
62
+ }else if(currentMethod == 'PUSH NOTIFICATIONS'){
63
+ jQuery('#mo2f_2factor_test_push_form').submit();
64
+ }else if(currentMethod == 'SOFT TOKEN'){
65
+ jQuery('#mo2f_2factor_test_softtoken_form').submit();
66
+ }else if(currentMethod == 'SMS' || currentMethod == 'PHONE VERIFICATION'){
67
+ jQuery('#mo2f_test_2factor_method').val(currentMethod);
68
+ jQuery('#mo2f_2factor_test_smsotp_form').submit();
69
+ }else if(currentMethod == 'OUT OF BAND EMAIL'){
70
+ jQuery('#mo2f_2factor_test_out_of_band_email_form').submit();
71
+ }else if(currentMethod == 'GOOGLE AUTHENTICATOR'){
72
+ jQuery('#mo2f_2factor_test_google_auth_form').submit();
73
+ }
74
+ });
75
+
76
+ });
77
+ </script>
78
+ <?php
79
+ }
80
+
81
+ private function mo_auth_show_success_message() {
82
+ remove_action( 'admin_notices', array( $this, 'mo_auth_success_message') );
83
+ add_action( 'admin_notices', array( $this, 'mo_auth_error_message') );
84
+ }
85
+
86
+ private function mo_auth_show_error_message() {
87
+ remove_action( 'admin_notices', array( $this, 'mo_auth_error_message') );
88
+ add_action( 'admin_notices', array( $this, 'mo_auth_success_message') );
89
+ }
90
+
91
+ public function mo2f_register_user(){
92
+ global $wpdb;
93
+ global $current_user;
94
+ $current_user = wp_get_current_user();
95
+ if(mo_2factor_is_curl_installed()==0){ ?>
96
+ <p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled)</p>
97
+ <?php
98
+ }
99
+
100
+
101
+ $mo2f_active_tab = isset($_GET['mo2f_tab']) ? $_GET['mo2f_tab'] : '2factor_setup';
102
+
103
+
104
+ ?>
105
+ <div id="tab">
106
+ <h2 class="nav-tab-wrapper">
107
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup" class="nav-tab <?php echo $mo2f_active_tab == '2factor_setup' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab1"><?php if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ ?>User Profile <?php }else{ ?> Account Setup <?php } ?></a>
108
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure" class="nav-tab <?php echo $mo2f_active_tab == 'mobile_configure' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab2">Setup Two-Factor</a>
109
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_demo' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab4">How It Works</a>
110
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_help' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab3">Help & Troubleshooting</a>
111
+ </h2>
112
+ </div>
113
+
114
+ <div class="mo2f_container">
115
+ <div id="messages"></div>
116
+ <table style="width:100%;">
117
+ <tr>
118
+ <td style="width:60%;vertical-align:top;">
119
+ <?php
120
+
121
+ if($mo2f_active_tab == 'mobile_configure') {
122
+
123
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
124
+ mo2f_select_2_factor_method($current_user,$mo2f_second_factor);
125
+
126
+ ?>
127
+ <script>
128
+ jQuery(document).ready(function(){
129
+ jQuery("#mo2f_support_table").hide();
130
+ });
131
+ </script>
132
+ <?php
133
+ }else if($mo2f_active_tab == 'mo2f_demo'){
134
+ unset($_SESSION[ 'mo2f_google_auth' ]);
135
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
136
+ show_2_factor_login_demo($current_user);
137
+ }else if($mo2f_active_tab == 'mo2f_help'){
138
+ unset($_SESSION[ 'mo2f_google_auth' ]);
139
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
140
+ mo2f_show_help_and_troubleshooting($current_user);
141
+ }else if(get_option('mo2f_deviceid_enabled' ) && $mo2f_active_tab == 'advance_option'){
142
+ unset($_SESSION[ 'mo2f_google_auth' ]);
143
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
144
+ show_2_factor_advanced_options($current_user); //Login Settings tab
145
+ }else{
146
+ unset($_SESSION[ 'mo2f_google_auth' ]);
147
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
148
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE'){
149
+ mo2f_show_user_otp_validation_page();
150
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION') {
151
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
152
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor);
153
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') {
154
+ mo2f_show_instruction_to_allusers($current_user,'NONE');
155
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
156
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
157
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor);
158
+ }else{
159
+ show_user_welcome_page($current_user);
160
+ }
161
+ }
162
+ ?>
163
+ </td>
164
+ <td style="vertical-align:top;padding-left:1%;" id="mo2f_support_table">
165
+ </td>
166
+ </tr>
167
+ </table>
168
+ </div>
169
+ <?php
170
+ }
171
+
172
+ function miniorange_user_save_settings() {
173
+ global $wpdb;
174
+ global $current_user;
175
+ $current_user = wp_get_current_user();
176
+
177
+ if(!current_user_can('manage_options')){
178
+ if(isset($_POST['option']) and $_POST['option'] == "mo_2factor_validate_user_otp"){ //validate OTP
179
+ //validation and sanitization
180
+ $otp_token = '';
181
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
182
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
183
+ $this->mo_auth_show_error_message();
184
+ return;
185
+ } else{
186
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
187
+ }
188
+
189
+ if(!MO2f_Utility::check_if_email_is_already_registered(get_user_meta($current_user->ID,'mo_2factor_user_email',true))){
190
+ $customer = new Customer_Setup();
191
+ $transactionId = get_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',true);
192
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null, $transactionId, $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
193
+ if($content['status'] == 'ERROR'){
194
+ update_option( 'mo2f_message', $content['message']);
195
+ delete_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account');
196
+ }else{
197
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated and generate QRCode
198
+ $this->mo2f_create_user($current_user,get_user_meta($current_user->ID,'mo_2factor_user_email',true));
199
+ delete_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account');
200
+ }else{ // OTP Validation failed.
201
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
202
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
203
+ $this->mo_auth_show_error_message();
204
+ }
205
+ }
206
+
207
+ }else{
208
+ update_option('mo2f_message','The email is already used by other user. Please register with other email by clicking on Back button.');
209
+ $this->mo_auth_show_error_message();
210
+ }
211
+ }
212
+ }
213
+
214
+ }
215
+
216
+ function mo2f_create_user($current_user,$email){ //creating user in miniOrange of wordpress non-admin
217
+ $email = strtolower($email);
218
+ $enduser = new Two_Factor_Setup();
219
+ $check_user = json_decode($enduser->mo_check_user_already_exist($email),true);
220
+ if(json_last_error() == JSON_ERROR_NONE){
221
+ if($check_user['status'] == 'ERROR'){
222
+ update_option( 'mo2f_message', $check_user['message']);
223
+ $this->mo_auth_show_error_message();
224
+ }else{
225
+ if(strcasecmp($check_user['status'], 'USER_FOUND') == 0){
226
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
227
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
228
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',$email);
229
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_INITIALIZE_TWO_FACTOR');
230
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,null,null);
231
+ $message = 'You are registered successfully. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure 2nd factor authentication method.';
232
+ update_option( 'mo2f_message', $message);
233
+ $this->mo_auth_show_success_message();
234
+
235
+ }else if(strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
236
+ $content = json_decode($enduser->mo_create_user($current_user,$email), true);
237
+ if(json_last_error() == JSON_ERROR_NONE) {
238
+ if($content['status'] == 'ERROR'){
239
+ update_option( 'mo2f_message', $content['message']);
240
+ }else{
241
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
242
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
243
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
244
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',$email);
245
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_INITIALIZE_TWO_FACTOR');
246
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,null,null);
247
+ $message = 'You are registered successfully. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure 2nd factor authentication method.';
248
+ update_option( 'mo2f_message', $message);
249
+ $this->mo_auth_show_success_message();
250
+ }else{
251
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
252
+ $this->mo_auth_show_error_message();
253
+ }
254
+ }
255
+ }else{
256
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again or contact your admin.');
257
+ $this->mo_auth_show_error_message();
258
+ }
259
+ }else{
260
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
261
+ $this->mo_auth_show_error_message();
262
+ }
263
+ }
264
+ }else{
265
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
266
+ $this->mo_auth_show_error_message();
267
+ }
268
+ }
269
+
270
+ }
class-rba-attributes.php ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Miniorange_Rba_Attributes{
26
+
27
+ function mo2f_collect_attributes($useremail,$rba_attributes){
28
+
29
+ $url = get_option('mo2f_host_name') . '/moas/rest/rba/acs';
30
+ $ch = curl_init($url);
31
+
32
+ /* The customer Key provided to you */
33
+ $customerKey = get_option('mo2f_customerKey');
34
+
35
+ /* The customer API Key provided to you */
36
+ $apiKey = get_option('mo2f_api_key');
37
+
38
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
39
+ $currentTimeInMillis = round(microtime(true) * 1000);
40
+
41
+ /* Creating the Hash using SHA-512 algorithm */
42
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
43
+ $hashValue = hash("sha512", $stringToHash);
44
+
45
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
46
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
47
+ $authorizationHeader = "Authorization: " . $hashValue;
48
+
49
+ $field_string = "{\"customerKey\":\"" . $customerKey . "\",\"userKey\":\"" . $useremail . "\",\"attributes\":" . $rba_attributes . "}";
50
+
51
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
52
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
53
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
54
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
55
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
56
+
57
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
58
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
59
+ $timestampHeader, $authorizationHeader));
60
+ curl_setopt( $ch, CURLOPT_POST, true);
61
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
62
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
63
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
64
+ $content = curl_exec($ch);
65
+
66
+ if(curl_errno($ch)){
67
+ return null;
68
+ }
69
+ curl_close($ch);
70
+ return $content;
71
+ }
72
+
73
+ function mo2f_evaluate_risk($useremail,$sessionUuid){
74
+
75
+ $url = get_option('mo2f_host_name') . '/moas/rest/rba/evaluate-risk';
76
+ $ch = curl_init($url);
77
+
78
+ /* The customer Key provided to you */
79
+ $customerKey = get_option('mo2f_customerKey');
80
+
81
+ /* The customer API Key provided to you */
82
+ $apiKey = get_option('mo2f_api_key');
83
+
84
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
85
+ $currentTimeInMillis = round(microtime(true) * 1000);
86
+
87
+ /* Creating the Hash using SHA-512 algorithm */
88
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
89
+ $hashValue = hash("sha512", $stringToHash);
90
+
91
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
92
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
93
+ $authorizationHeader = "Authorization: " . $hashValue;
94
+
95
+ $fields = array(
96
+ 'customerKey' => $customerKey,
97
+ 'appSecret' => get_option('mo2f_app_secret'),
98
+ 'userKey' => $useremail,
99
+ 'sessionUuid' => $sessionUuid
100
+ );
101
+ $field_string = json_encode( $fields );
102
+
103
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
104
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
105
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
106
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
107
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
108
+
109
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
110
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
111
+ $timestampHeader, $authorizationHeader));
112
+ curl_setopt( $ch, CURLOPT_POST, true);
113
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
114
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
115
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
116
+ $content = curl_exec($ch);
117
+
118
+ if(curl_errno($ch)){
119
+ return null;
120
+ }
121
+ curl_close($ch);
122
+ return $content;
123
+ }
124
+
125
+ function mo2f_register_rba_profile($useremail,$sessionUuid){
126
+
127
+ $url = get_option('mo2f_host_name') . '/moas/rest/rba/register-profile';
128
+ $ch = curl_init($url);
129
+
130
+ /* The customer Key provided to you */
131
+ $customerKey = get_option('mo2f_customerKey');
132
+
133
+ /* The customer API Key provided to you */
134
+ $apiKey = get_option('mo2f_api_key');
135
+
136
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
137
+ $currentTimeInMillis = round(microtime(true) * 1000);
138
+
139
+ /* Creating the Hash using SHA-512 algorithm */
140
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
141
+ $hashValue = hash("sha512", $stringToHash);
142
+
143
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
144
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
145
+ $authorizationHeader = "Authorization: " . $hashValue;
146
+
147
+ $fields = array(
148
+ 'customerKey' => $customerKey,
149
+ 'userKey' => $useremail,
150
+ 'sessionUuid' => $sessionUuid
151
+ );
152
+ $field_string = json_encode( $fields );
153
+
154
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
155
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
156
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
157
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
158
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
159
+
160
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
161
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
162
+ $timestampHeader, $authorizationHeader));
163
+ curl_setopt( $ch, CURLOPT_POST, true);
164
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
165
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
166
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
167
+ $content = curl_exec($ch);
168
+
169
+ if(curl_errno($ch)){
170
+ return null;
171
+ }
172
+ curl_close($ch);
173
+ return $content;
174
+ }
175
+
176
+ function mo2f_get_app_secret(){
177
+
178
+ $url = get_option('mo2f_host_name') . '/moas/rest/customer/getapp-secret';
179
+ $ch = curl_init($url);
180
+
181
+ /* The customer Key provided to you */
182
+ $customerKey = get_option('mo2f_customerKey');
183
+
184
+ /* The customer API Key provided to you */
185
+ $apiKey = get_option('mo2f_api_key');
186
+
187
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
188
+ $currentTimeInMillis = round(microtime(true) * 1000);
189
+
190
+ /* Creating the Hash using SHA-512 algorithm */
191
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
192
+ $hashValue = hash("sha512", $stringToHash);
193
+
194
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
195
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
196
+ $authorizationHeader = "Authorization: " . $hashValue;
197
+
198
+ $fields = array(
199
+ 'customerId' => $customerKey
200
+ );
201
+ $field_string = json_encode( $fields );
202
+
203
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
204
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
205
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
206
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
207
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
208
+
209
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
210
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
211
+ $timestampHeader, $authorizationHeader));
212
+ curl_setopt( $ch, CURLOPT_POST, true);
213
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
214
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
215
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
216
+ $content = curl_exec($ch);
217
+
218
+ if(curl_errno($ch)){
219
+ return null;
220
+ }
221
+ curl_close($ch);
222
+ return $content;
223
+ }
224
+
225
+ function mo2f_google_auth_service($useremail){
226
+
227
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/google-auth-secret';
228
+ $ch = curl_init($url);
229
+
230
+ /* The customer Key provided to you */
231
+ $customerKey = get_option('mo2f_customerKey');
232
+
233
+ /* The customer API Key provided to you */
234
+ $apiKey = get_option('mo2f_api_key');
235
+
236
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
237
+ $currentTimeInMillis = round(microtime(true) * 1000);
238
+
239
+ /* Creating the Hash using SHA-512 algorithm */
240
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
241
+ $hashValue = hash("sha512", $stringToHash);
242
+
243
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
244
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
245
+ $authorizationHeader = "Authorization: " . $hashValue;
246
+
247
+ $fields = array(
248
+ 'customerKey' => $customerKey,
249
+ 'username' => $useremail
250
+ );
251
+ $field_string = json_encode( $fields );
252
+
253
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
254
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
255
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
256
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
257
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
258
+
259
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
260
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
261
+ $timestampHeader, $authorizationHeader));
262
+ curl_setopt( $ch, CURLOPT_POST, true);
263
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
264
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
265
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
266
+ $content = curl_exec($ch);
267
+
268
+ if(curl_errno($ch)){
269
+ return null;
270
+ }
271
+ curl_close($ch);
272
+ return $content;
273
+ }
274
+
275
+ function mo2f_validate_google_auth($useremail,$otptoken,$secret){
276
+
277
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/validate-google-auth-secret';
278
+ $ch = curl_init($url);
279
+
280
+ /* The customer Key provided to you */
281
+ $customerKey = get_option('mo2f_customerKey');
282
+
283
+ /* The customer API Key provided to you */
284
+ $apiKey = get_option('mo2f_api_key');
285
+
286
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
287
+ $currentTimeInMillis = round(microtime(true) * 1000);
288
+
289
+ /* Creating the Hash using SHA-512 algorithm */
290
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
291
+ $hashValue = hash("sha512", $stringToHash);
292
+
293
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
294
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
295
+ $authorizationHeader = "Authorization: " . $hashValue;
296
+
297
+ $fields = array(
298
+ 'customerKey' => $customerKey,
299
+ 'username' => $useremail,
300
+ 'secret' => $secret,
301
+ 'otpToken' => $otptoken
302
+ );
303
+ $field_string = json_encode( $fields );
304
+
305
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
306
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
307
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
308
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
309
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
310
+
311
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
312
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
313
+ $timestampHeader, $authorizationHeader));
314
+ curl_setopt( $ch, CURLOPT_POST, true);
315
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
316
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
317
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
318
+ $content = curl_exec($ch);
319
+
320
+ if(curl_errno($ch)){
321
+ return null;
322
+ }
323
+ curl_close($ch);
324
+ return $content;
325
+ }
326
+
327
+ }
328
+ ?>
class-two-factor-setup.php ADDED
@@ -0,0 +1,432 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class Two_Factor_Setup{
26
+
27
+ public $email;
28
+
29
+ function check_mobile_status($tId){
30
+ if(!MO2f_Utility::is_curl_installed()) {
31
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
32
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
33
+ }
34
+
35
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/auth-status';
36
+ $ch = curl_init($url);
37
+
38
+ /* The customer Key provided to you */
39
+ $customerKey = get_option('mo2f_customerKey');
40
+
41
+ /* The customer API Key provided to you */
42
+ $apiKey = get_option('mo2f_api_key');
43
+
44
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
45
+ $currentTimeInMillis = round(microtime(true) * 1000);
46
+
47
+ /* Creating the Hash using SHA-512 algorithm */
48
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
49
+ $hashValue = hash("sha512", $stringToHash);
50
+
51
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
52
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
53
+ $authorizationHeader = "Authorization: " . $hashValue;
54
+
55
+ $fields = array(
56
+ 'txId' => $tId
57
+ );
58
+
59
+ $field_string = json_encode($fields);
60
+
61
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
62
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
63
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
64
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
65
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
66
+
67
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
68
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
69
+ $timestampHeader, $authorizationHeader));
70
+ curl_setopt( $ch, CURLOPT_POST, true);
71
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
72
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
73
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
74
+ $content = curl_exec($ch);
75
+
76
+ if(curl_errno($ch)){
77
+ return null;
78
+ }
79
+
80
+
81
+ curl_close($ch);
82
+ return $content;
83
+ }
84
+
85
+ function register_mobile($useremail){
86
+ if(!MO2f_Utility::is_curl_installed()) {
87
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
88
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
89
+ }
90
+
91
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/register-mobile';
92
+ $ch = curl_init($url);
93
+ global $current_user;
94
+ $current_user = wp_get_current_user();
95
+ $this->email = $useremail;
96
+
97
+ /* The customer Key provided to you */
98
+ $customerKey = get_option('mo2f_customerKey');
99
+
100
+ /* The customer API Key provided to you */
101
+ $apiKey = get_option('mo2f_api_key');
102
+
103
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
104
+ $currentTimeInMillis = round(microtime(true) * 1000);
105
+
106
+ /* Creating the Hash using SHA-512 algorithm */
107
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
108
+ $hashValue = hash("sha512", $stringToHash);
109
+
110
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
111
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
112
+ $authorizationHeader = "Authorization: " . $hashValue;
113
+
114
+ $fields = array(
115
+ 'username' => $this->email
116
+ );
117
+
118
+ $field_string = json_encode($fields);
119
+
120
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
121
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
122
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
123
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
124
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
125
+
126
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
127
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
128
+ $timestampHeader, $authorizationHeader));
129
+ curl_setopt( $ch, CURLOPT_POST, true);
130
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
131
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
132
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
133
+ $content = curl_exec($ch);
134
+
135
+ if(curl_errno($ch)){
136
+ return null;
137
+ }
138
+
139
+
140
+ curl_close($ch);
141
+ return $content;
142
+ }
143
+
144
+ function mo_check_user_already_exist($email){
145
+ if(!MO2f_Utility::is_curl_installed()) {
146
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
147
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
148
+ }
149
+
150
+ $url = get_option('mo2f_host_name') . '/moas/api/admin/users/search';
151
+ $ch = curl_init($url);
152
+
153
+ /* The customer Key provided to you */
154
+ $customerKey = get_option('mo2f_customerKey');
155
+
156
+ /* The customer API Key provided to you */
157
+ $apiKey = get_option('mo2f_api_key');
158
+
159
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
160
+ $currentTimeInMillis = round(microtime(true) * 1000);
161
+
162
+ /* Creating the Hash using SHA-512 algorithm */
163
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
164
+ $hashValue = hash("sha512", $stringToHash);
165
+
166
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
167
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
168
+ $authorizationHeader = "Authorization: " . $hashValue;
169
+
170
+ $fields = array(
171
+ 'customerKey' => $customerKey,
172
+ 'username' => $email,
173
+
174
+ );
175
+
176
+ $field_string = json_encode($fields);
177
+
178
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
179
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
180
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
181
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
182
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
183
+
184
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
185
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
186
+ $timestampHeader, $authorizationHeader));
187
+ curl_setopt( $ch, CURLOPT_POST, true);
188
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
189
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
190
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
191
+ $content = curl_exec($ch);
192
+
193
+ if(curl_errno($ch)){
194
+ return null;
195
+ }
196
+
197
+
198
+ curl_close($ch);
199
+ return $content;
200
+ }
201
+
202
+ function mo_create_user($currentuser,$email){
203
+ if(!MO2f_Utility::is_curl_installed()) {
204
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
205
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
206
+ }
207
+
208
+ $url = get_option('mo2f_host_name') . '/moas/api/admin/users/create';
209
+ $ch = curl_init($url);
210
+
211
+ /* The customer Key provided to you */
212
+ $customerKey = get_option('mo2f_customerKey');
213
+
214
+ /* The customer API Key provided to you */
215
+ $apiKey = get_option('mo2f_api_key');
216
+
217
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
218
+ $currentTimeInMillis = round(microtime(true) * 1000);
219
+
220
+ /* Creating the Hash using SHA-512 algorithm */
221
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
222
+ $hashValue = hash("sha512", $stringToHash);
223
+
224
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
225
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
226
+ $authorizationHeader = "Authorization: " . $hashValue;
227
+
228
+ $fields = array(
229
+ 'customerKey' => $customerKey,
230
+ 'username' => $email,
231
+ 'firstName' => $currentuser->user_firstname,
232
+ 'lastName' => $currentuser->user_lastname
233
+ );
234
+
235
+ $field_string = json_encode($fields);
236
+
237
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
238
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
239
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
240
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
241
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
242
+
243
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
244
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
245
+ $timestampHeader, $authorizationHeader));
246
+ curl_setopt( $ch, CURLOPT_POST, true);
247
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
248
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
249
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
250
+ $content = curl_exec($ch);
251
+
252
+ if(curl_errno($ch)){
253
+ return null;
254
+ }
255
+
256
+
257
+ curl_close($ch);
258
+ return $content;
259
+ }
260
+
261
+ function mo2f_get_userinfo($email){
262
+ if(!MO2f_Utility::is_curl_installed()) {
263
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
264
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
265
+ }
266
+
267
+ $url = get_option('mo2f_host_name') . '/moas/api/admin/users/get';
268
+ $ch = curl_init($url);
269
+
270
+ /* The customer Key provided to you */
271
+ $customerKey = get_option('mo2f_customerKey');
272
+
273
+ /* The customer API Key provided to you */
274
+ $apiKey = get_option('mo2f_api_key');
275
+
276
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
277
+ $currentTimeInMillis = round(microtime(true) * 1000);
278
+
279
+ /* Creating the Hash using SHA-512 algorithm */
280
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
281
+ $hashValue = hash("sha512", $stringToHash);
282
+
283
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
284
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
285
+ $authorizationHeader = "Authorization: " . $hashValue;
286
+
287
+ $fields = array(
288
+ 'customerKey' => $customerKey,
289
+ 'username' => $email,
290
+ );
291
+
292
+ $field_string = json_encode($fields);
293
+
294
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
295
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
296
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
297
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
298
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
299
+
300
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
301
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
302
+ $timestampHeader, $authorizationHeader));
303
+ curl_setopt( $ch, CURLOPT_POST, true);
304
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
305
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
306
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
307
+ $content = curl_exec($ch);
308
+
309
+ if(curl_errno($ch)){
310
+ return null;
311
+ }
312
+ curl_close($ch);
313
+ return $content;
314
+ }
315
+
316
+ function mo2f_update_userinfo($email,$authType,$phone,$tname,$enableAdminSecondFactor){
317
+ if(!MO2f_Utility::is_curl_installed()) {
318
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
319
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
320
+ }
321
+
322
+ $url = get_option('mo2f_host_name') . '/moas/api/admin/users/update';
323
+ $ch = curl_init($url);
324
+
325
+ /* The customer Key provided to you */
326
+ $customerKey = get_option('mo2f_customerKey');
327
+
328
+ /* The customer API Key provided to you */
329
+ $apiKey = get_option('mo2f_api_key');
330
+
331
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
332
+ $currentTimeInMillis = round(microtime(true) * 1000);
333
+
334
+ /* Creating the Hash using SHA-512 algorithm */
335
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
336
+ $hashValue = hash("sha512", $stringToHash);
337
+
338
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
339
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
340
+ $authorizationHeader = "Authorization: " . $hashValue;
341
+ if($authType == 'PUSH'){
342
+ $authType = 'PUSH NOTIFICATIONS';
343
+ }
344
+
345
+ $fields = array(
346
+ 'customerKey' => $customerKey,
347
+ 'username' => $email,
348
+ 'phone' => $phone,
349
+ 'authType' => $authType,
350
+ 'transactionName' => $tname,
351
+ 'adminLoginSecondFactor' => $enableAdminSecondFactor
352
+ );
353
+
354
+ $field_string = json_encode($fields);
355
+
356
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
357
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
358
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
359
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
360
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
361
+
362
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
363
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
364
+ $timestampHeader, $authorizationHeader));
365
+ curl_setopt( $ch, CURLOPT_POST, true);
366
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
367
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
368
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
369
+ $content = curl_exec($ch);
370
+
371
+ if(curl_errno($ch)){
372
+ return null;
373
+ }
374
+ curl_close($ch);
375
+ return $content;
376
+ }
377
+
378
+ function register_kba_details($email,$question1,$answer1,$question2,$answer2,$question3,$answer3){
379
+ if(!MO2f_Utility::is_curl_installed()) {
380
+ $message = 'Please enable curl extension. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help">Click here</a> for the steps to enable curl or check Help & Troubleshooting.';
381
+ return json_encode(array("status"=>'ERROR',"message"=>$message));
382
+ }
383
+
384
+ $url = get_option('mo2f_host_name') . '/moas/api/auth/register';
385
+ $ch = curl_init($url);
386
+
387
+ /* The customer Key provided to you */
388
+ $customerKey = get_option('mo2f_customerKey');
389
+
390
+ /* The customer API Key provided to you */
391
+ $apiKey = get_option('mo2f_api_key');
392
+
393
+ /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
394
+ $currentTimeInMillis = round(microtime(true) * 1000);
395
+
396
+ /* Creating the Hash using SHA-512 algorithm */
397
+ $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
398
+ $hashValue = hash("sha512", $stringToHash);
399
+
400
+ $customerKeyHeader = "Customer-Key: " . $customerKey;
401
+ $timestampHeader = "Timestamp: " . number_format($currentTimeInMillis, 0, '', '');
402
+ $authorizationHeader = "Authorization: " . $hashValue;
403
+
404
+ $q_and_a_list = "[{\"question\":\"" . $question1 . "\",\"answer\":\"" . $answer1 . "\" },{\"question\":\"" . $question2 . "\",\"answer\":\"" . $answer2 . "\" },{\"question\":\"" . $question3 . "\",\"answer\":\"" . $answer3 . "\" }]";
405
+
406
+ $field_string = "{\"customerKey\":\"" . $customerKey . "\",\"username\":\"" . $email . "\",\"questionAnswerList\":" . $q_and_a_list . "}";
407
+
408
+ curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false );
409
+ curl_setopt( $ch, CURLOPT_ENCODING, "" );
410
+ curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
411
+ curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
412
+ curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
413
+
414
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
415
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
416
+ $timestampHeader, $authorizationHeader));
417
+ curl_setopt( $ch, CURLOPT_POST, true);
418
+ curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
419
+ curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5);
420
+ curl_setopt( $ch, CURLOPT_TIMEOUT, 20);
421
+ $content = curl_exec($ch);
422
+
423
+ if(curl_errno($ch)){
424
+ return null;
425
+ }
426
+ curl_close($ch);
427
+ return $content;
428
+
429
+ }
430
+
431
+ }
432
+ ?>
class-utility.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ class MO2f_Utility{
26
+
27
+ public static function get_hidden_phone($phone){
28
+ $hidden_phone = 'xxxxxxx' . substr($phone,strlen($phone) - 3);
29
+ return $hidden_phone;
30
+ }
31
+
32
+ public static function mo2f_check_empty_or_null( $value ) {
33
+ if( ! isset( $value ) || $value == '' ) {
34
+ return true;
35
+ }
36
+ return false;
37
+ }
38
+
39
+ public static function is_curl_installed() {
40
+ if (in_array ('curl', get_loaded_extensions())) {
41
+ return 1;
42
+ } else
43
+ return 0;
44
+ }
45
+
46
+ public static function mo2f_check_number_length($token){
47
+ if(is_numeric($token)){
48
+ if(strlen($token) >= 4 && strlen($token) <= 8){
49
+ return true;
50
+ }else{
51
+ return false;
52
+ }
53
+ }else{
54
+ return false;
55
+ }
56
+ }
57
+
58
+ public static function mo2f_get_hiden_email($email){
59
+ if(!isset($email) || trim($email)===''){
60
+ return "";
61
+ }
62
+ $emailsize = strlen($email);
63
+ $partialemail = substr($email,0,1);
64
+ $temp = strrpos($email,"@");
65
+ $endemail = substr($email,$temp-1,$emailsize);
66
+ for($i=1;$i<$temp;$i++){
67
+ $partialemail = $partialemail . 'x';
68
+ }
69
+ $hiddenemail = $partialemail . $endemail;
70
+
71
+ return $hiddenemail;
72
+ }
73
+
74
+ public static function check_if_email_is_already_registered($email){
75
+ $users = get_users( array() );
76
+ foreach ( $users as $user ) {
77
+ if(get_user_meta($user->ID,'mo_2factor_map_id_with_email',true) == $email){
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ }
83
+
84
+ public static function check_if_request_is_from_mobile_device($useragent){
85
+ if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))){
86
+ return true;
87
+ }else{
88
+ return false;
89
+ }
90
+ }
91
+ }
92
+ ?>
includes/css/bootstrap.min.css ADDED
@@ -0,0 +1,509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mo2f_carousel {
2
+ position: relative;
3
+ padding-bottom:18px !important;
4
+
5
+ }
6
+
7
+ .mo2f_carousel-inner {
8
+ position: relative;
9
+ width: 100%;
10
+ overflow: hidden;
11
+
12
+ }
13
+
14
+ .mo2f_carousel-inner>.item {
15
+ position: relative;
16
+ display: none;
17
+ -webkit-transition: .6s ease-in-out left;
18
+ -o-transition: .6s ease-in-out left;
19
+ transition: .6s ease-in-out left;
20
+ height:300px !important;
21
+
22
+ }
23
+
24
+ .mo2f_carousel-inner>.item>img,.mo2f_carousel-inner>.item>a>img {
25
+ line-height: 1;
26
+
27
+ max-height:300px !important;
28
+ max-width:600px !important;
29
+ }
30
+
31
+ @media all and (transform-3d) , ( -webkit-transform-3d ) {
32
+ .mo2f_carousel-inner>.item {
33
+ -webkit-transition: -webkit-transform .6s ease-in-out;
34
+ -o-transition: -o-transform .6s ease-in-out;
35
+ transition: transform .6s ease-in-out;
36
+ -webkit-backface-visibility: hidden;
37
+ backface-visibility: hidden;
38
+ -webkit-perspective: 1000;
39
+ perspective: 1000
40
+ }
41
+ .mo2f_carousel-inner>.item.next,.mo2f_carousel-inner>.item.active.right {
42
+ left: 0;
43
+ -webkit-transform: translate3d(100%, 0, 0);
44
+ transform: translate3d(100%, 0, 0)
45
+ }
46
+ .mo2f_carousel-inner>.item.prev,.mo2f_carousel-inner>.item.active.left {
47
+ left: 0;
48
+ -webkit-transform: translate3d(-100%, 0, 0);
49
+ transform: translate3d(-100%, 0, 0)
50
+ }
51
+ .mo2f_carousel-inner>.item.next.left,.mo2f_carousel-inner>.item.prev.right,.mo2f_carousel-inner>.item.active
52
+ {
53
+ left: 0;
54
+ -webkit-transform: translate3d(0, 0, 0);
55
+ transform: translate3d(0, 0, 0)
56
+ }
57
+ }
58
+
59
+ .mo2f_carousel-inner>.active,.mo2f_carousel-inner>.next,.mo2f_carousel-inner>.prev {
60
+ display: block
61
+ }
62
+
63
+ .mo2f_carousel-inner>.active {
64
+ left: 0
65
+ }
66
+
67
+ .mo2f_carousel-inner>.next,.mo2f_carousel-inner>.prev {
68
+ position: absolute;
69
+ top: 0;
70
+ width: 100%
71
+ }
72
+
73
+ .mo2f_carousel-inner>.next {
74
+ left: 100%
75
+ }
76
+
77
+ .mo2f_carousel-inner>.prev {
78
+ left: -100%
79
+ }
80
+
81
+ .mo2f_carousel-inner>.next.left,.mo2f_carousel-inner>.prev.right {
82
+ left: 0
83
+ }
84
+
85
+ .mo2f_carousel-inner>.active.left {
86
+ left: -100%
87
+ }
88
+
89
+ .mo2f_carousel-inner>.active.right {
90
+ left: 100%
91
+ }
92
+
93
+ .mo2f_carousel-control {
94
+ position: absolute;
95
+ top: 0;
96
+ bottom: 0;
97
+ left: 0;
98
+ width: 15%;
99
+ font-size: 20px;
100
+ color: #fff;
101
+ text-align: center;
102
+ text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
103
+ filter: alpha(opacity = 50);
104
+ opacity: .5
105
+ }
106
+
107
+ .mo2f_carousel-control.left {
108
+ background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0,
109
+ rgba(0, 0, 0, .0001) 100%);
110
+ background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0,
111
+ rgba(0, 0, 0, .0001) 100%);
112
+ background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)),
113
+ to(rgba(0, 0, 0, .0001)));
114
+ background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0,
115
+ rgba(0, 0, 0, .0001) 100%);
116
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000',
117
+ endColorstr='#00000000', GradientType=1);
118
+ background-repeat: repeat-x
119
+ }
120
+
121
+ .mo2f_carousel-control.right {
122
+ right: 0;
123
+ left: auto;
124
+ background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .0001) 0,
125
+ rgba(0, 0, 0, .5) 100%);
126
+ background-image: -o-linear-gradient(left, rgba(0, 0, 0, .0001) 0,
127
+ rgba(0, 0, 0, .5) 100%);
128
+ background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .0001)),
129
+ to(rgba(0, 0, 0, .5)));
130
+ background-image: linear-gradient(to right, rgba(0, 0, 0, .0001) 0,
131
+ rgba(0, 0, 0, .5) 100%);
132
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000',
133
+ endColorstr='#80000000', GradientType=1);
134
+ background-repeat: repeat-x
135
+ }
136
+
137
+ .mo2f_carousel-control:hover,.mo2f_carousel-control:focus {
138
+ color: #fff;
139
+ text-decoration: none;
140
+ filter: alpha(opacity = 90);
141
+ outline: 0;
142
+ opacity: .9
143
+ }
144
+
145
+ .mo2f_carousel-control .icon-prev,.mo2f_carousel-control .icon-next,.mo2f_carousel-control .glyphicon-chevron-left,.mo2f_carousel-control .glyphicon-chevron-right
146
+ {
147
+ position: absolute;
148
+ top: 50%;
149
+ z-index: 5;
150
+ display: inline-block
151
+ }
152
+
153
+ .mo2f_carousel-control .icon-prev,.mo2f_carousel-control .glyphicon-chevron-left {
154
+ left: 50%;
155
+ margin-left: -10px
156
+ }
157
+
158
+ .mo2f_carousel-control .icon-next,.mo2f_carousel-control .glyphicon-chevron-right
159
+ {
160
+ right: 50%;
161
+ margin-right: -10px
162
+ }
163
+
164
+ .mo2f_carousel-control .icon-prev,.mo2f_carousel-control .icon-next {
165
+ width: 20px;
166
+ height: 20px;
167
+ margin-top: -10px;
168
+ font-family: serif
169
+ }
170
+
171
+ .mo2f_carousel-control .icon-prev:before {
172
+ content: '\2039'
173
+ }
174
+
175
+ .mo2f_carousel-control .icon-next:before {
176
+ content: '\203a'
177
+ }
178
+
179
+ .mo2f_carousel-indicators {
180
+ position: absolute;
181
+ bottom: -25px;
182
+ left: 50%;
183
+ z-index: 15;
184
+ width: 60%;
185
+ padding-left: 0;
186
+ margin-left: -30%;
187
+ text-align: center;
188
+ list-style: none
189
+ }
190
+
191
+ .mo2f_carousel-indicators li {
192
+ display: inline-block;
193
+ width: 10px;
194
+ height: 10px;
195
+ margin: 1px;
196
+ text-indent: -999px;
197
+ cursor: pointer;
198
+ background-color: #0 \9;
199
+ background-color: rgba(0, 0, 0, 0);
200
+ border: 1px solid #0073aa;
201
+ border-radius: 10px
202
+ }
203
+
204
+ .mo2f_carousel-indicators .active {
205
+ width: 12px;
206
+ height: 12px;
207
+ margin: 0;
208
+ background-color: #0073aa;
209
+ }
210
+
211
+ .mo2f_carousel-caption {
212
+ position: absolute;
213
+ right: 15%;
214
+ bottom: 20px;
215
+ left: 15%;
216
+ z-index: 10;
217
+ padding-top: 20px;
218
+ padding-bottom: 20px;
219
+ color: #fff;
220
+ text-align: center;
221
+ text-shadow: 0 1px 2px rgba(0, 0, 0, .6)
222
+ }
223
+
224
+ .mo2f_carousel-caption .btn {
225
+ text-shadow: none
226
+ }
227
+
228
+ @media screen and (min-width:768px) {
229
+ .mo2f_carousel-control .glyphicon-chevron-left,.mo2f_carousel-control .glyphicon-chevron-right,.mo2f_carousel-control .icon-prev,.mo2f_carousel-control .icon-next
230
+ {
231
+ width: 30px;
232
+ height: 30px;
233
+ margin-top: -15px;
234
+ font-size: 30px
235
+ }
236
+ .mo2f_carousel-control .glyphicon-chevron-left,.mo2f_carousel-control .icon-prev {
237
+ margin-left: -15px
238
+ }
239
+ .mo2f_carousel-control .glyphicon-chevron-right,.mo2f_carousel-control .icon-next
240
+ {
241
+ margin-right: -15px
242
+ }
243
+ .mo2f_carousel-caption {
244
+ right: 20%;
245
+ left: 20%;
246
+ padding-bottom: 30px
247
+ }
248
+ .mo2f_carousel-indicators {
249
+ bottom: -14px
250
+ }
251
+ }
252
+
253
+ .hidden{
254
+ display: none;
255
+ }
256
+
257
+ .float-right{
258
+ text-align:right;
259
+ }
260
+
261
+ .mo2f_collapse {
262
+ display: none;
263
+ //visibility: hidden;
264
+ font-size: 14px !important;
265
+
266
+
267
+ }
268
+
269
+ .mo2f_collapse.in {
270
+ display: block;
271
+ visibility: visible;
272
+
273
+
274
+ }
275
+
276
+ .mo2f_collapsing {
277
+ position: relative;
278
+ font-size: 14px !important;
279
+ height: 0;
280
+ overflow: hidden;
281
+ -webkit-transition-timing-function: ease;
282
+ -o-transition-timing-function: ease;
283
+ transition-timing-function: ease;
284
+ -webkit-transition-duration: .20s;
285
+ -o-transition-duration: .20s;
286
+ transition-duration: .20s;
287
+ -webkit-transition-property: height, visibility;
288
+ -o-transition-property: height, visibility;
289
+ transition-property: height, visibility
290
+ }
291
+
292
+ .mo2f_thumbnail {
293
+ width:350px;
294
+ padding: 4px;
295
+
296
+ margin-bottom: 10px;
297
+ line-height: 1.42857143;
298
+ background-color: #fff;
299
+ border: 1px solid #ddd;
300
+ border-radius: 4px;
301
+ -webkit-transition: border .2s ease-in-out;
302
+ -o-transition: border .2s ease-in-out;
303
+ transition: border .2s ease-in-out
304
+ }
305
+
306
+ .mo2f_thumbnail>img,.mo2f_thumbnail a>img {
307
+ margin-right: auto;
308
+ margin-left: auto
309
+ }
310
+
311
+ a.mo2f_thumbnail:hover,a.mo2f_thumbnail:focus,a.mo2f_thumbnail.active {
312
+ border-color: #337ab7
313
+ }
314
+
315
+ .mo2f_thumbnail .caption {
316
+ padding: 9px;
317
+ color: #333
318
+ }
319
+
320
+ .mo2f_thumbnail label{
321
+ font-weight: bold;
322
+
323
+ }
324
+ .mo2f_close {
325
+ float: right;
326
+ font-size: 21px;
327
+ font-weight: 700;
328
+ line-height: 1;
329
+ color: #000;
330
+ text-shadow: 0 1px 0 #fff;
331
+ filter: alpha(opacity = 20);
332
+ opacity: .2
333
+ }
334
+
335
+ .mo2f_close:hover,.mo2f_close:focus {
336
+ color: #000;
337
+ text-decoration: none;
338
+ cursor: pointer;
339
+ filter: alpha(opacity = 50);
340
+ opacity: .5
341
+ }
342
+
343
+ button.mo2f_close {
344
+ -webkit-appearance: none;
345
+ padding: 0;
346
+ cursor: pointer;
347
+ background: 0 0;
348
+ border: 0
349
+ }
350
+
351
+ .mo2f_modal-open {
352
+ overflow: hidden !important;
353
+ position:fixed !important;
354
+ width: 100% !important;
355
+
356
+ }
357
+
358
+ .mo2f_modal {
359
+ position: fixed !important;
360
+ top: 0;
361
+ right: 0;
362
+ bottom: 0;
363
+ left: 0;
364
+ z-index: 100000 !important;
365
+ display: none;
366
+ overflow: hidden !important;
367
+ -webkit-overflow-scrolling: touch;
368
+ outline: 0;
369
+
370
+
371
+ }
372
+
373
+ .mo2f_modal.fade .mo2f_modal-dialog {
374
+ -webkit-transition: -webkit-transform .3s ease-out;
375
+ -o-transition: -o-transform .3s ease-out;
376
+ transition: transform .3s ease-out;
377
+ -webkit-transform: translate(0, -25%);
378
+ -ms-transform: translate(0, -25%);
379
+ -o-transform: translate(0, -25%);
380
+ transform: translate(0, -25%)
381
+ }
382
+
383
+ .mo2f_modal.in .mo2f_modal-dialog {
384
+ -webkit-transform: translate(0, 80px) !important;
385
+ -ms-transform: translate(0, 80px) !important;
386
+ -o-transform: translate(0, 80px) !important;
387
+ transform: translate(0, 80px) !important;
388
+
389
+ }
390
+
391
+ .mo2f_modal-open .mo2f_modal {
392
+ overflow-x: hidden;
393
+ overflow-y: hidden;
394
+ }
395
+
396
+ .mo2f_modal-dialog {
397
+ position: relative;
398
+ width: auto;
399
+ margin: 10px;
400
+
401
+ }
402
+
403
+ .mo2f_modal-content {
404
+ position: relative !important;
405
+ background-color: #fff !important;
406
+ -webkit-background-clip: padding-box !important;
407
+ background-clip: padding-box !important;
408
+ border: 1px solid #999 !important;
409
+ border: 1px solid rgba(0, 0, 0, .2) !important;
410
+ border-radius: 6px !important;
411
+ outline: 0 !important;
412
+
413
+ -webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, .5) !important;
414
+ box-shadow: 0 3px 9px rgba(0, 0, 0, .5) !important;
415
+ }
416
+
417
+
418
+ .mo2f-modal-backdrop {
419
+ position: absolute;
420
+ top: 0;
421
+ right: 0;
422
+ left: 0;
423
+ background-color: #000 !important;
424
+ filter: alpha(opacity = 50)!important;
425
+ opacity: 0.8 !important;
426
+ height: 100% !important;
427
+ }
428
+
429
+
430
+
431
+
432
+
433
+ .mo2f_modal-header {
434
+ min-height: 14px;
435
+ padding: 10px;
436
+ border-bottom: 1px solid #e5e5e5
437
+ }
438
+
439
+
440
+ .mo2f_modal-title {
441
+ margin: 0 !important;
442
+ line-height: 1.0 !important;
443
+ }
444
+
445
+ .mo2f_modal-body {
446
+ width:96% !important;
447
+ position: relative !important;
448
+ padding: 15px !important;
449
+ overflow-y:auto !important;
450
+ max-height: 550px !important;
451
+ }
452
+
453
+ .mo2f_modal-footer {
454
+ padding: 15px;
455
+ text-align: right;
456
+ border-top: 1px solid #e5e5e5
457
+ }
458
+
459
+ .mo2f_modal-footer .btn+.btn {
460
+ margin-bottom: 0;
461
+ margin-left: 5px
462
+ }
463
+
464
+ .mo2f_modal-footer .btn-group .btn+.btn {
465
+ margin-left: -1px
466
+ }
467
+
468
+ .mo2f_modal-footer .btn-block+.btn-block {
469
+ margin-left: 0
470
+ }
471
+
472
+ .mo2f_modal-scrollbar-measure {
473
+ position: absolute;
474
+ top: -9999px;
475
+ width: 50px;
476
+ height: 50px;
477
+ overflow: scroll
478
+ }
479
+
480
+ @media ( min-width :768px) {
481
+ .mo2f_modal-dialog {
482
+ width: 373px;
483
+ margin: 0px auto
484
+ }
485
+ .mo2f_modal-content {
486
+ -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
487
+ box-shadow: 0 5px 15px rgba(0, 0, 0, .5)
488
+ }
489
+ .mo2f_modal-sm {
490
+ width: 300px
491
+ }
492
+ .mo2f_modal-md{
493
+ width: 500px
494
+ }
495
+ }
496
+
497
+ @media ( min-width :992px) {
498
+ .mo2f_modal-lg {
499
+ width: 900px;
500
+ }
501
+ .mo2f_modal-md{
502
+ width: 500px
503
+ }
504
+ }
505
+
506
+ .center{
507
+
508
+ text-align: center !important;
509
+ }
includes/css/front_end_login.css ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ .mo2f_powered_by_miniorange{
3
+ width: 100px;
4
+ height: 30px;
5
+ -webkit-background-size: 100px 25px;
6
+ background-size: 100px 25px;
7
+ background-repeat: no-repeat;
8
+ display: inline-block;
9
+ vertical-align: middle;
10
+ }
11
+ .mo2f_powered_by_div{
12
+ text-align: right;
13
+ font-size: 9px;
14
+ padding-right:5px;
15
+ background-color: #FFFFFF;
16
+ width: 92%;
17
+ border-radius: 6px;
18
+ }
19
+
20
+ .mo2f-login-container{
21
+ display:inline-block !important;
22
+ display:-moz-inline-stack !important;
23
+ text-align:center !important;
24
+ width:100%;
25
+
26
+ }
27
+ .mo2f-textbox{
28
+ //width: 100% !important;
29
+ margin: 15px 0px !important;
30
+ background-color: rgba(123, 110, 110, 0.06) !important;
31
+ border-radius: 4px !important;
32
+ padding: 3px !important;
33
+ }
34
+ .mo2f-button{
35
+ width: 100% !important;
36
+ color: #fff !important;
37
+ line-height: normal;
38
+ height: 30px !important;
39
+ margin:0px !important;
40
+ font-size: 14px !important;
41
+ padding: 7px !important;
42
+ background-color: #f0ad4e !important;
43
+ border-color: #eea236 !important;
44
+ -webkit-appearance: none;
45
+ -webkit-border-radius: 3px !important;
46
+ border-radius: 3px !important;
47
+
48
+
49
+ }
50
+
51
+ .mo2fa_display_message_frontend{
52
+ text-align:center !important;
53
+ font-size: 15px !important;
54
+ }
55
+
56
+ .mo2f-link{
57
+ color: #0191BF !important;
58
+ font-size:14px !important;
59
+ font-weight: bold !important;
60
+ cursor: pointer !important;
61
+ }
62
+ .mo_green{
63
+ background:green !important;
64
+ border-color:green !important;
65
+ width:37% !important;
66
+ }
67
+ .mo_red{
68
+ background:rgb(247, 38, 38) !important;
69
+ border-color:rgb(247, 38, 38) !important;
70
+ width:37% !important;
71
+ }
72
+
73
+
74
+ .showQRHelp, .showOTPHelp{
75
+ background-color: rgba(215, 217, 218, 0.78) !important;
76
+ text-align:center !important;
77
+
78
+ }
79
+
80
+ .mo2f_device{
81
+ //padding-left: 200px !important;
82
+ vertical-align: -webkit-baseline-middle !important;
83
+ line-height: 3 !important;
84
+ }
85
+
86
+ .miniorange-button{
87
+ height: 30px;
88
+ font-size: 14px !important;
89
+ line-height: 5px !important;
90
+ padding: 16px !important;
91
+ border-width: 1px;
92
+ vertical-align: middle !important;
93
+ background-color: #f0ad4e !important;
94
+ border-color: #eea236 !important;
95
+ -webkit-appearance: none;
96
+ border-style: solid;
97
+ -webkit-border-radius: 3px !important;
98
+ border-radius: 3px !important;
99
+ white-space: nowrap;
100
+ -webkit-box-sizing: border-box;
101
+ -moz-box-sizing: border-box;
102
+ box-sizing: border-box;
103
+ color: #fff;
104
+ text-decoration: none;
105
+ cursor: pointer;
106
+ }
107
+
108
+
109
+ .mo_hr{
110
+ border-top: 1px solid rgba(220, 214, 214, 0.25) !important;
111
+ margin-top: 5px !important;
112
+ margin-right: 10px !important;
113
+ }
114
+
115
+ .mo_margin_left{
116
+ margin-left:20px !important;
117
+ }
118
+
119
+
120
+
121
+ .mo_app_link{
122
+ text-decoration: none !important;
123
+ color: #000 !important;
124
+ }
125
+
126
+
127
+
128
+ .mo2f_td_show{
129
+ display:grid !important;
130
+ }
131
+
132
+ .mo2f_td_hide{
133
+ display:none !important;
134
+ }
135
+
136
+ .mo2f_label{
137
+ font-weight: 100 !important;
138
+ margin-left: 10px !important;
139
+
140
+ }
141
+
142
+
143
+ .mo2f_kba_ques{
144
+ width:394px !important;
145
+ border-radius:4px !important;
146
+ height:40px !important;
147
+ font-size:14px !important;
148
+ }
149
+
150
+ .mo2f_kba_table{
151
+ padding:0 10px;
152
+ width:100%;
153
+ border: hidden !important;
154
+ }
155
+
156
+ .mo2f_kba_tb_data{
157
+ padding-left:15px;
158
+ }
159
+
160
+ .mo2f_table_textbox_1{
161
+ width:150px;
162
+ border-radius:4px !important;
163
+ height:30px !important;
164
+ font-size:14px !important;
165
+ }
166
+
167
+ .mo2f_table_textbox {
168
+ width:200px;
169
+ border-radius:4px !important;
170
+ height:40px !important;
171
+ font-size:14px !important;
172
+
173
+ }
174
+
175
+ .mo2f_kba_header{
176
+ font-weight:bold;
177
+ border: hidden !important;
178
+ }
179
+ .mo2f_kba_body{
180
+ border: hidden !important;
181
+ }
182
+
183
+ .mo2f_separator{
184
+ border-left: 1px solid #EBECEC; padding: 5px;
185
+ }
186
+
187
+ .mo2f_authn_header{
188
+ font-size: 14px !important;
189
+ }
190
+
191
+ #mo2f_inline_table{
192
+ border: hidden !important;
193
+ }
194
+
195
+ .mo2f_ordered_list{
196
+ margin: 0 0 0 1em !important;
197
+ }
198
+ .mo2f_list{
199
+ font-size:14px !important;
200
+ }
201
+
202
+
203
+
204
+
205
+
206
+
includes/css/hide-login-form.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body.login div#login{
2
+ display:block;
3
+ }
4
+ body.login div#login form#loginform input#user_login {
5
+ display:none;
6
+ }
7
+
8
+ body.login div#login form#loginform p.forgetmenot {
9
+ display: none;
10
+ }
11
+
12
+ body.login div#login form#loginform p.submit input#wp-submit {
13
+ display: none;
14
+ }
15
+
16
+ body.login div#login form#loginform p label {
17
+ display: none;
18
+ }
19
+
20
+ body.login div#login p#nav {
21
+ display: none;
22
+ }
23
+
24
+ body.login div#login form#loginform input#user_pass {
25
+ display: none;
26
+ }
27
+ body.login div#login div#login_error{
28
+ display: none;
29
+ }
30
+ body.login div#login div#login_error1{
31
+ border-left: 4px solid #dd3d36;
32
+ margin-left: 0;
33
+ padding: 12px;
34
+ background: #fff;
35
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
36
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
37
+ }
38
+ input.button-add{
39
+ background: #00a0d2 url(../../includes/images/mo_white_logo.png) no-repeat 10px center !important;
40
+ background-size: 16px !important;
41
+ }
includes/css/hide-login.css ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body.login-action-login div#login{
2
+ display:none;
3
+ }
4
+ body.login-action-login div#login form#loginform input#user_login {
5
+ display:none;
6
+ }
7
+
8
+ body.login-action-login div#login form#loginform p.forgetmenot {
9
+ display: none;
10
+ }
11
+
12
+ body.login-action-login div#login form#loginform p.submit input#wp-submit {
13
+ display: none;
14
+ }
15
+
16
+ body.login-action-login div#login form#loginform p label {
17
+ display: none;
18
+ }
19
+
20
+ body.login-action-login div#login p#nav {
21
+ display: none;
22
+ }
23
+
24
+ body.login-action-login div#login form#loginform input#user_pass {
25
+ display: none;
26
+ }
27
+
28
+ body.login-action-login div#login div#login_error{
29
+ display: none;
30
+ }
31
+ body.login-action-login p.message{
32
+ display: none;
33
+ }
34
+ body.login-action-login div#login #loginform{
35
+ box-shadow:inherit;
36
+ }
37
+
38
+ body.login-action-login div#login div#login_error1{
39
+ border-left: 4px solid #dd3d36;
40
+ margin-left: 0;
41
+ padding: 12px;
42
+ background: #fff;
43
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
44
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
45
+ }
46
+ .mo2f_header{
47
+ font-size: 28px;
48
+ font-family: -webkit-body;
49
+ color: #777;
50
+ }
51
+ .mo2f_powered_by_miniorange{
52
+ width: 100px;
53
+ height: 25px;
54
+ -webkit-background-size: 100px 25px;
55
+ background-size: 100px 25px;
56
+ background-repeat: no-repeat;
57
+ display: inline-block;
58
+ vertical-align: middle;
59
+ }
60
+ .mo2f_powered_by_div{
61
+ text-align: right;
62
+ font-size: 9px;
63
+ padding-right:2%;
64
+ background-color: #FFFFFF;
65
+ }
66
+ .button-green{
67
+ color: rgb(0,160,210);
68
+ background:none!important;
69
+ border:none;
70
+ padding:0!important;
71
+ font: inherit;
72
+ border-color: transparent !important;
73
+ /*border is optional*/
74
+ border-bottom:1px solid #444;
75
+ cursor: pointer;
76
+ }
77
+ .mo2fa_display_message{
78
+ padding: 12px;
79
+ border-left: 4px solid #00a0d2;
80
+ background-color: #fff;
81
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
82
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
83
+
84
+ }
85
+ .mo2fa_messages_container{
86
+ width:300px;
87
+ }
88
+ .mo2fa_otp_messages_container{
89
+ width:400px;
90
+ }
91
+ .mo2fa_push_messages_container{
92
+ width:300px;
93
+ }
94
+ .miniorange_mobile_auth, .miniorange_app_setup_page {
95
+ border: 1px none transparent;
96
+ padding:10% 24px 10px 20px;
97
+ min-height:360px;
98
+ background:transparent;
99
+ z-index:99999;
100
+ }
101
+ .miniorange_kba_page{
102
+ border: 1px none transparent;
103
+ padding:10% 24px 10px 20px;
104
+ min-height:360px;
105
+ background:transparent;
106
+ z-index:99999;
107
+
108
+ }
109
+ .miniorange_push_oobemail_auth,.miniorange_trust_device{
110
+ border: 1px none transparent;
111
+ padding:10% 24px 10px 20px;
112
+ min-height:360px;
113
+ background:transparent;
114
+ z-index:99999;
115
+ }
116
+
117
+ .miniorange_soft_auth {
118
+ border: 1px none transparent;
119
+ padding:10% 24px 10px 20px;
120
+ min-height:360px;
121
+ background:transparent;
122
+ z-index:99999;
123
+ }
124
+ .miniorange-inner-login-container{
125
+ background-color: #fff;
126
+ margin:0px auto!important;
127
+ width:400px;
128
+ border-radius:5px;
129
+ border: 1px solid rgba(128, 128, 128, 0.06);
130
+ }
131
+ .miniorange-inner-kba-login-container{
132
+ background-color: #fff;
133
+ margin:0px auto!important;
134
+ width:500px;
135
+ border-radius:5px;
136
+ z-index:99999;
137
+ border: 1px solid rgba(128, 128, 128, 0.06);
138
+ }
139
+ .miniorange-inner-push-login-container{
140
+ background-color: #fff;
141
+ margin:0px auto!important;
142
+ width:300px;
143
+ border-radius:5px;
144
+
145
+ z-index:99999;
146
+ border: 1px solid rgba(128, 128, 128, 0.06);
147
+ }
148
+
149
+
150
+ .miniorange-button{
151
+ height: 30px;
152
+ display: inline-block;
153
+ font-size: 14px;
154
+ line-height: 28px;
155
+ padding: 0 12px 2px;
156
+ border-width: 1px;
157
+ vertical-align: baseline;
158
+ background: #00a0d2;
159
+ border-style: solid;
160
+ border-color: #0073aa;
161
+ -webkit-appearance: none;
162
+ -webkit-border-radius: 3px;
163
+ border-radius: 3px;
164
+ white-space: nowrap;
165
+ -webkit-box-sizing: border-box;
166
+ -moz-box-sizing: border-box;
167
+ box-sizing: border-box;
168
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
169
+ box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
170
+ color: #fff;
171
+ text-decoration: none;
172
+ cursor:pointer;
173
+ }
174
+ .mo_green{
175
+ background:green;
176
+ border-color:green;
177
+ width:37%;
178
+ }
179
+ .mo_red{
180
+ background:rgb(247, 38, 38);
181
+ border-color:rgb(247, 38, 38);
182
+ width:37%;
183
+ }
184
+ .showQRHelp, .showOTPHelp{
185
+ background-color: rgba(215, 217, 218, 0.78) !important;
186
+ }
187
+
188
+ .mo_email_textbox{
189
+ width:48%;text-align: center;height: 40px;font-size:18px;border-radius:5px;
190
+ }
191
+
192
+ .mo_header_background{
193
+ padding:5px !important;
194
+ background-color:beige !important;
195
+ }
196
+
197
+ .mo2f_textbox {
198
+ width:60% !important;
199
+ border-radius:4px !important;
200
+ height:30px !important;
201
+ font-size:14px !important;
202
+ }
203
+
204
+ .mo2f_kba_textbox {
205
+ width:100% !important;
206
+ border-radius:4px !important;
207
+ height:30px !important;
208
+ font-size:14px !important;
209
+ }
210
+
211
+ .mo_hr{
212
+ border-top: 1px solid rgba(220, 214, 214, 0.25) !important;
213
+ margin-top: 5px !important;
214
+ margin-right: 10px !important;
215
+ }
216
+
217
+ .mo_margin_left{
218
+ margin-left:20px !important;
219
+ }
220
+
221
+ .miniorange-app-setup-container{
222
+ background-color: #fff;
223
+ margin:0px auto!important;
224
+ width:700px;
225
+ border-radius:5px;
226
+ margin-top:-100px !important;
227
+ z-index:99999;
228
+ border: 1px solid rgba(128, 128, 128, 0.06);
229
+
230
+ }
231
+
232
+ .miniorange-ga-setup-container{
233
+ background-color: #fff;
234
+ margin:0px auto!important;
235
+ width:900px;
236
+ border-radius:5px;
237
+ margin-top:-50px !important;
238
+ z-index:99999;
239
+ border: 1px solid rgba(128, 128, 128, 0.06);
240
+ }
241
+
242
+ .mo_app_link{
243
+ text-decoration: none !important;
244
+ color: #000 !important;
245
+ }
246
+
247
+ .mo2fa_app_setup_messages{
248
+ width:700px;
249
+ }
250
+
251
+ .mo2f_td_show{
252
+ display:grid !important;
253
+ }
254
+
255
+ .mo2f_td_hide{
256
+ display:none !important;
257
+ }
258
+
259
+ .mo2f_kba_ques{
260
+ width:370px !important;
261
+ border-radius:4px !important;
262
+ height:30px !important;
263
+ font-size:14px !important;
264
+ }
265
+
266
+ .mo2f_kba_table{
267
+ padding:0 10px;
268
+ width:100%;
269
+ }
270
+
271
+ .mo2f_kba_tb_data{
272
+ padding-left:15px;
273
+ }
274
+
275
+ .mo2f_table_textbox {
276
+ width:150px;
277
+ border-radius:4px !important;
278
+ height:30px !important;
279
+ font-size:14px !important;
280
+
281
+ }
282
+
283
+ .mo2f_kba_header{
284
+ font-weight:bold;
285
+ }
286
+
287
+ .mo2f_separator{
288
+ border-left: 1px solid #EBECEC; padding: 5px;
289
+ }
290
+ .mo2f_inline_padding{
291
+ padding-left:20px;
292
+ padding-right:20px;
293
+ }
includes/css/phone.css ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .intl-number-input { position: inherit; }
2
+ .intl-number-input .hide { display: none; }
3
+ .intl-number-input .flag-dropdown { position: absolute; cursor: pointer; }
4
+ .intl-number-input .flag-dropdown .selected-flag { margin: 1px; padding: 8px 16px 6px 7px; }
5
+ .intl-number-input .flag-dropdown .selected-flag:hover { background-color: rgba(0, 0, 0, 0.05); }
6
+ .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; }
7
+ .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; }
8
+ .intl-number-input .flag-dropdown .country-list .divider { padding-bottom: 5px; margin-bottom: 5px; border-bottom: 1px solid #cccccc; }
9
+ .intl-number-input .flag-dropdown .country-list .country { line-height: 20px; padding: 4px 10px; }
10
+ .intl-number-input .flag-dropdown .country-list .country .dial-code { color: #999999; }
11
+ .intl-number-input .flag-dropdown .country-list .country.highlight { background-color: rgba(0, 0, 0, 0.05); }
12
+ .intl-number-input .flag-dropdown .country-list .flag { display: inline-block; vertical-align: bottom; }
13
+ .intl-number-input .flag-dropdown .country-list .flag, .intl-number-input .flag-dropdown .country-list .country-name { margin-right:2px; }
14
+ .intl-number-input input { box-sizing: border-box; -moz-box-sizing: border-box; height: 30px; padding-left: 40px; }
15
+
16
+ /* originally from https://github.com/lafeber/world-flags-sprite */
17
+ .f16 .flag { width: 16px; height: 16px; background: url("../images/flags16.png") no-repeat; }
18
+ .f16 ._African_Union { background-position: 0 -16px; }
19
+ .f16 ._Arab_League { background-position: 0 -32px; }
20
+ .f16 ._ASEAN { background-position: 0 -48px; }
21
+ .f16 ._CARICOM { background-position: 0 -64px; }
22
+ .f16 ._CIS { background-position: 0 -80px; }
23
+ .f16 ._Commonwealth { background-position: 0 -96px; }
24
+ .f16 ._England { background-position: 0 -112px; }
25
+ .f16 ._European_Union { background-position: 0 -128px; }
26
+ .f16 ._Islamic_Conference { background-position: 0 -144px; }
27
+ .f16 ._Kosovo { background-position: 0 -160px; }
28
+ .f16 ._NATO { background-position: 0 -176px; }
29
+ .f16 ._Northern_Cyprus { background-position: 0 -192px; }
30
+ .f16 ._Northern_Ireland { background-position: 0 -208px; }
31
+ .f16 ._Olimpic_Movement { background-position: 0 -224px; }
32
+ .f16 ._OPEC { background-position: 0 -240px; }
33
+ .f16 ._Red_Cross { background-position: 0 -256px; }
34
+ .f16 ._Scotland { background-position: 0 -272px; }
35
+ .f16 ._Somaliland { background-position: 0 -288px; }
36
+ .f16 ._Tibet { background-position: 0 -304px; }
37
+ .f16 ._United_Nations { background-position: 0 -320px; }
38
+ .f16 ._Wales { background-position: 0 -336px; }
39
+ .f16 .ad { background-position: 0 -352px; }
40
+ .f16 .ae { background-position: 0 -368px; }
41
+ .f16 .af { background-position: 0 -384px; }
42
+ .f16 .ag { background-position: 0 -400px; }
43
+ .f16 .ai { background-position: 0 -416px; }
44
+ .f16 .al { background-position: 0 -432px; }
45
+ .f16 .am { background-position: 0 -448px; }
46
+ .f16 .an { background-position: 0 -464px; }
47
+ .f16 .ao { background-position: 0 -480px; }
48
+ .f16 .aq { background-position: 0 -496px; }
49
+ .f16 .ar { background-position: 0 -512px; }
50
+ .f16 .as { background-position: 0 -528px; }
51
+ .f16 .at { background-position: 0 -544px; }
52
+ .f16 .au { background-position: 0 -560px; }
53
+ .f16 .aw { background-position: 0 -576px; }
54
+ .f16 .az { background-position: 0 -592px; }
55
+ .f16 .ba { background-position: 0 -608px; }
56
+ .f16 .bb { background-position: 0 -624px; }
57
+ .f16 .bd { background-position: 0 -640px; }
58
+ .f16 .be { background-position: 0 -656px; }
59
+ .f16 .bf { background-position: 0 -672px; }
60
+ .f16 .bg { background-position: 0 -688px; }
61
+ .f16 .bh { background-position: 0 -704px; }
62
+ .f16 .bi { background-position: 0 -720px; }
63
+ .f16 .bj { background-position: 0 -736px; }
64
+ .f16 .bm { background-position: 0 -752px; }
65
+ .f16 .bn { background-position: 0 -768px; }
66
+ .f16 .bo { background-position: 0 -784px; }
67
+ .f16 .br { background-position: 0 -800px; }
68
+ .f16 .bs { background-position: 0 -816px; }
69
+ .f16 .bt { background-position: 0 -832px; }
70
+ .f16 .bw { background-position: 0 -848px; }
71
+ .f16 .by { background-position: 0 -864px; }
72
+ .f16 .bz { background-position: 0 -880px; }
73
+ .f16 .ca { background-position: 0 -896px; }
74
+ .f16 .cg { background-position: 0 -912px; }
75
+ .f16 .cf { background-position: 0 -928px; }
76
+ .f16 .cd { background-position: 0 -944px; }
77
+ .f16 .ch { background-position: 0 -960px; }
78
+ .f16 .ci { background-position: 0 -976px; }
79
+ .f16 .ck { background-position: 0 -992px; }
80
+ .f16 .cl { background-position: 0 -1008px; }
81
+ .f16 .cm { background-position: 0 -1024px; }
82
+ .f16 .cn { background-position: 0 -1040px; }
83
+ .f16 .co { background-position: 0 -1056px; }
84
+ .f16 .cr { background-position: 0 -1072px; }
85
+ .f16 .cu { background-position: 0 -1088px; }
86
+ .f16 .cv { background-position: 0 -1104px; }
87
+ .f16 .cy { background-position: 0 -1120px; }
88
+ .f16 .cz { background-position: 0 -1136px; }
89
+ .f16 .de { background-position: 0 -1152px; }
90
+ .f16 .dj { background-position: 0 -1168px; }
91
+ .f16 .dk { background-position: 0 -1184px; }
92
+ .f16 .dm { background-position: 0 -1200px; }
93
+ .f16 .do { background-position: 0 -1216px; }
94
+ .f16 .dz { background-position: 0 -1232px; }
95
+ .f16 .ec { background-position: 0 -1248px; }
96
+ .f16 .ee { background-position: 0 -1264px; }
97
+ .f16 .eg { background-position: 0 -1280px; }
98
+ .f16 .eh { background-position: 0 -1296px; }
99
+ .f16 .er { background-position: 0 -1312px; }
100
+ .f16 .es { background-position: 0 -1328px; }
101
+ .f16 .et { background-position: 0 -1344px; }
102
+ .f16 .fi { background-position: 0 -1360px; }
103
+ .f16 .fj { background-position: 0 -1376px; }
104
+ .f16 .fm { background-position: 0 -1392px; }
105
+ .f16 .fo { background-position: 0 -1408px; }
106
+ .f16 .fr { background-position: 0 -1424px; }
107
+ .f16 .ga { background-position: 0 -1440px; }
108
+ .f16 .gb { background-position: 0 -1456px; }
109
+ .f16 .gd { background-position: 0 -1472px; }
110
+ .f16 .ge { background-position: 0 -1488px; }
111
+ .f16 .gg { background-position: 0 -1504px; }
112
+ .f16 .gh { background-position: 0 -1520px; }
113
+ .f16 .gi { background-position: 0 -1536px; }
114
+ .f16 .gl { background-position: 0 -1552px; }
115
+ .f16 .gm { background-position: 0 -1568px; }
116
+ .f16 .gn { background-position: 0 -1584px; }
117
+ .f16 .gp { background-position: 0 -1600px; }
118
+ .f16 .gq { background-position: 0 -1616px; }
119
+ .f16 .gr { background-position: 0 -1632px; }
120
+ .f16 .gt { background-position: 0 -1648px; }
121
+ .f16 .gu { background-position: 0 -1664px; }
122
+ .f16 .gw { background-position: 0 -1680px; }
123
+ .f16 .gy { background-position: 0 -1696px; }
124
+ .f16 .hk { background-position: 0 -1712px; }
125
+ .f16 .hn { background-position: 0 -1728px; }
126
+ .f16 .hr { background-position: 0 -1744px; }
127
+ .f16 .ht { background-position: 0 -1760px; }
128
+ .f16 .hu { background-position: 0 -1776px; }
129
+ .f16 .id { background-position: 0 -1792px; }
130
+ .f16 .mc { background-position: 0 -1792px; }
131
+ .f16 .ie { background-position: 0 -1808px; }
132
+ .f16 .il { background-position: 0 -1824px; }
133
+ .f16 .im { background-position: 0 -1840px; }
134
+ .f16 .in { background-position: 0 -1856px; }
135
+ .f16 .iq { background-position: 0 -1872px; }
136
+ .f16 .ir { background-position: 0 -1888px; }
137
+ .f16 .is { background-position: 0 -1904px; }
138
+ .f16 .it { background-position: 0 -1920px; }
139
+ .f16 .je { background-position: 0 -1936px; }
140
+ .f16 .jm { background-position: 0 -1952px; }
141
+ .f16 .jo { background-position: 0 -1968px; }
142
+ .f16 .jp { background-position: 0 -1984px; }
143
+ .f16 .ke { background-position: 0 -2000px; }
144
+ .f16 .kg { background-position: 0 -2016px; }
145
+ .f16 .kh { background-position: 0 -2032px; }
146
+ .f16 .ki { background-position: 0 -2048px; }
147
+ .f16 .km { background-position: 0 -2064px; }
148
+ .f16 .kn { background-position: 0 -2080px; }
149
+ .f16 .kp { background-position: 0 -2096px; }
150
+ .f16 .kr { background-position: 0 -2112px; }
151
+ .f16 .kw { background-position: 0 -2128px; }
152
+ .f16 .ky { background-position: 0 -2144px; }
153
+ .f16 .kz { background-position: 0 -2160px; }
154
+ .f16 .la { background-position: 0 -2176px; }
155
+ .f16 .lb { background-position: 0 -2192px; }
156
+ .f16 .lc { background-position: 0 -2208px; }
157
+ .f16 .li { background-position: 0 -2224px; }
158
+ .f16 .lk { background-position: 0 -2240px; }
159
+ .f16 .lr { background-position: 0 -2256px; }
160
+ .f16 .ls { background-position: 0 -2272px; }
161
+ .f16 .lt { background-position: 0 -2288px; }
162
+ .f16 .lu { background-position: 0 -2304px; }
163
+ .f16 .lv { background-position: 0 -2320px; }
164
+ .f16 .ly { background-position: 0 -2336px; }
165
+ .f16 .ma { background-position: 0 -2352px; }
166
+ .f16 .md { background-position: 0 -2368px; }
167
+ .f16 .me { background-position: 0 -2384px; }
168
+ .f16 .mg { background-position: 0 -2400px; }
169
+ .f16 .mh { background-position: 0 -2416px; }
170
+ .f16 .mk { background-position: 0 -2432px; }
171
+ .f16 .ml { background-position: 0 -2448px; }
172
+ .f16 .mm { background-position: 0 -2464px; }
173
+ .f16 .mn { background-position: 0 -2480px; }
174
+ .f16 .mo { background-position: 0 -2496px; }
175
+ .f16 .mq { background-position: 0 -2512px; }
176
+ .f16 .mr { background-position: 0 -2528px; }
177
+ .f16 .ms { background-position: 0 -2544px; }
178
+ .f16 .mt { background-position: 0 -2560px; }
179
+ .f16 .mu { background-position: 0 -2576px; }
180
+ .f16 .mv { background-position: 0 -2592px; }
181
+ .f16 .mw { background-position: 0 -2608px; }
182
+ .f16 .mx { background-position: 0 -2624px; }
183
+ .f16 .my { background-position: 0 -2640px; }
184
+ .f16 .mz { background-position: 0 -2656px; }
185
+ .f16 .na { background-position: 0 -2672px; }
186
+ .f16 .nc { background-position: 0 -2688px; }
187
+ .f16 .ne { background-position: 0 -2704px; }
188
+ .f16 .ng { background-position: 0 -2720px; }
189
+ .f16 .ni { background-position: 0 -2736px; }
190
+ .f16 .nl { background-position: 0 -2752px; }
191
+ .f16 .no { background-position: 0 -2768px; }
192
+ .f16 .np { background-position: 0 -2784px; }
193
+ .f16 .nr { background-position: 0 -2800px; }
194
+ .f16 .nz { background-position: 0 -2816px; }
195
+ .f16 .om { background-position: 0 -2832px; }
196
+ .f16 .pa { background-position: 0 -2848px; }
197
+ .f16 .pe { background-position: 0 -2864px; }
198
+ .f16 .pf { background-position: 0 -2880px; }
199
+ .f16 .pg { background-position: 0 -2896px; }
200
+ .f16 .ph { background-position: 0 -2912px; }
201
+ .f16 .pk { background-position: 0 -2928px; }
202
+ .f16 .pl { background-position: 0 -2944px; }
203
+ .f16 .pr { background-position: 0 -2960px; }
204
+ .f16 .ps { background-position: 0 -2976px; }
205
+ .f16 .pt { background-position: 0 -2992px; }
206
+ .f16 .pw { background-position: 0 -3008px; }
207
+ .f16 .py { background-position: 0 -3024px; }
208
+ .f16 .qa { background-position: 0 -3040px; }
209
+ .f16 .re { background-position: 0 -3056px; }
210
+ .f16 .ro { background-position: 0 -3072px; }
211
+ .f16 .rs { background-position: 0 -3088px; }
212
+ .f16 .ru { background-position: 0 -3104px; }
213
+ .f16 .rw { background-position: 0 -3120px; }
214
+ .f16 .sa { background-position: 0 -3136px; }
215
+ .f16 .sb { background-position: 0 -3152px; }
216
+ .f16 .sc { background-position: 0 -3168px; }
217
+ .f16 .sd { background-position: 0 -3184px; }
218
+ .f16 .se { background-position: 0 -3200px; }
219
+ .f16 .sg { background-position: 0 -3216px; }
220
+ .f16 .si { background-position: 0 -3232px; }
221
+ .f16 .sk { background-position: 0 -3248px; }
222
+ .f16 .sl { background-position: 0 -3264px; }
223
+ .f16 .sm { background-position: 0 -3280px; }
224
+ .f16 .sn { background-position: 0 -3296px; }
225
+ .f16 .so { background-position: 0 -3312px; }
226
+ .f16 .sr { background-position: 0 -3328px; }
227
+ .f16 .st { background-position: 0 -3344px; }
228
+ .f16 .sv { background-position: 0 -3360px; }
229
+ .f16 .sy { background-position: 0 -3376px; }
230
+ .f16 .sz { background-position: 0 -3392px; }
231
+ .f16 .tc { background-position: 0 -3408px; }
232
+ .f16 .td { background-position: 0 -3424px; }
233
+ .f16 .tg { background-position: 0 -3440px; }
234
+ .f16 .th { background-position: 0 -3456px; }
235
+ .f16 .tj { background-position: 0 -3472px; }
236
+ .f16 .tl { background-position: 0 -3488px; }
237
+ .f16 .tm { background-position: 0 -3504px; }
238
+ .f16 .tn { background-position: 0 -3520px; }
239
+ .f16 .to { background-position: 0 -3536px; }
240
+ .f16 .tr { background-position: 0 -3552px; }
241
+ .f16 .tt { background-position: 0 -3568px; }
242
+ .f16 .tv { background-position: 0 -3584px; }
243
+ .f16 .tw { background-position: 0 -3600px; }
244
+ .f16 .tz { background-position: 0 -3616px; }
245
+ .f16 .ua { background-position: 0 -3632px; }
246
+ .f16 .ug { background-position: 0 -3648px; }
247
+ .f16 .us { background-position: 0 -3664px; }
248
+ .f16 .uy { background-position: 0 -3680px; }
249
+ .f16 .uz { background-position: 0 -3696px; }
250
+ .f16 .va { background-position: 0 -3712px; }
251
+ .f16 .vc { background-position: 0 -3728px; }
252
+ .f16 .ve { background-position: 0 -3744px; }
253
+ .f16 .vg { background-position: 0 -3760px; }
254
+ .f16 .vi { background-position: 0 -3776px; }
255
+ .f16 .vn { background-position: 0 -3792px; }
256
+ .f16 .vu { background-position: 0 -3808px; }
257
+ .f16 .ws { background-position: 0 -3824px; }
258
+ .f16 .ye { background-position: 0 -3840px; }
259
+ .f16 .za { background-position: 0 -3856px; }
260
+ .f16 .zm { background-position: 0 -3872px; }
261
+ .f16 .zw { background-position: 0 -3888px; }
262
+
263
+ .intl-number-input input {
264
+ border-radius: 4px !important;
265
+ width: 250px;
266
+ }
267
+
268
+ .actions {
269
+ margin-top: 20px;
270
+ }
includes/css/show-login.css ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body.login div#login{
2
+ display:block;
3
+ }
4
+ body.login div#login form#loginform input#user_login {
5
+ display:block;
6
+ }
7
+
8
+ body.login div#login form#loginform p.forgetmenot {
9
+ display: block;
10
+ }
11
+
12
+ body.login div#login form#loginform p.submit input#wp-submit {
13
+ display: block;
14
+ }
15
+
16
+ body.login div#login form#loginform p label {
17
+ display: block;
18
+ }
19
+
20
+ body.login div#login p#nav {
21
+ display: block;
22
+ }
23
+
24
+ body.login div#login form#loginform input#user_pass {
25
+ display: block;
26
+ }
27
+ body.login div#login div#login_error{
28
+ display: block;
29
+ }
30
+ body.login div#login div#login_error1{
31
+ border-left: 4px solid #dd3d36;
32
+ margin-left: 0;
33
+ padding: 12px;
34
+ background: #fff;
35
+ -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
36
+ box-shadow: 0 1px 1px 0 rgba(0,0,0,0.1);
37
+ }
38
+ input.button-add{
39
+ background: #00a0d2 url(../../includes/images/mo_white_logo.png) no-repeat 10px center !important;
40
+ background-size: 16px !important;
41
+ }
42
+ .miniorange-button{
43
+ height: 34px;
44
+ display: inline-block;
45
+ font-size: 14px;
46
+ line-height: 28px;
47
+ padding: 0 12px 2px;
48
+ border-width: 1px;
49
+ vertical-align: baseline;
50
+ border-style: solid;
51
+ border-color: #0073aa;
52
+ -webkit-appearance: none;
53
+ -webkit-border-radius: 3px;
54
+ border-radius: 3px;
55
+ white-space: nowrap;
56
+ -webkit-box-sizing: border-box;
57
+ -moz-box-sizing: border-box;
58
+ box-sizing: border-box;
59
+ -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
60
+ box-shadow: inset 0 1px 0 rgba(120,200,230,.5),0 1px 0 rgba(0,0,0,.15);
61
+ color: #fff;
62
+ text-decoration: none;
63
+ cursor:pointer;
64
+ }
includes/css/style_settings.css ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .mo2f_table_layout {
2
+ background-color:#FFFFFF;
3
+ border:1px solid #CCCCCC;
4
+ padding:0px 24px 0px 20px;
5
+ min-height:373px;
6
+ }
7
+ .mo2f_small_layout{
8
+ background-color:#FFFFFF;
9
+ border:1px solid #CCCCCC;
10
+ padding:0px 24px 10px 20px;
11
+ }
12
+
13
+ .mo2f_support_layout{
14
+ width: 93%;
15
+ background-color:#FFFFFF;
16
+ border:1px solid #CCCCCC;
17
+ padding-left:20px;
18
+ }
19
+ .mo2f_help_layout{
20
+ background-color:#FFFFFF;
21
+ border:1px solid #CCCCCC;
22
+ padding-left:20px;
23
+ min-height: 550px;
24
+ }
25
+
26
+ .mo2f_table_layout td strong {
27
+ margin-left: 10px;
28
+ }
29
+ .col1 {
30
+ width: 20%;
31
+ }
32
+
33
+ #panel1{
34
+ width: 100%;
35
+ }
36
+ .panel_toggle {
37
+ cursor: pointer;
38
+ }
39
+ .panel_toggle:hover {
40
+ text-decoration: underline;
41
+ }
42
+ .mo2f_table_textbox {
43
+ width:100%;
44
+ border-radius:4px;
45
+ height:30px;
46
+ }
47
+ .mo2f_settings_table {
48
+ width: 100%;
49
+ }
50
+
51
+ #mo2f_note{
52
+ background-color: #d9edf7;
53
+ border-radius: 4px;
54
+ padding: 5px;
55
+ color: #31708f;
56
+ font-style: italic;
57
+ }
58
+ .button-green{
59
+ background: #95D387 !important;
60
+ color: #ffffff !important;
61
+ border: 1px solid #95D387 !important;
62
+ }
63
+ .mo2f_user_layout{
64
+ margin-top:20px;
65
+ margin-right:20px;
66
+ }
67
+ .header2{
68
+ font-size:1.6em;
69
+ color:#00A0D2;
70
+ }
71
+ .alert-box{
72
+ margin-top: 21px;
73
+ }
74
+ .extra-large{
75
+ padding: 10px !important;
76
+ font-size: 2em !important;
77
+ height: 46px !important;
78
+ border-radius: 5px !important;
79
+ line-height:25px!important;
80
+ }
81
+
82
+ .mo2f_account_header{
83
+ margin: 0px !important;
84
+
85
+ }
86
+
87
+ a{
88
+ text-decoration:none !important;
89
+
90
+ }
91
+ .mo2f_help_container{
92
+ background-color:#ccc !important;
93
+ }
94
+
95
+ .mo2f_faqs>h3, .mo2f_faqs>div{
96
+ margin-left:15px !important;
97
+ margin-right:5px !important;
98
+
99
+ }
100
+ .mo2f_faqs>div{
101
+ padding: 5px 20px !important;
102
+ border-left: 2px solid grey !important;
103
+ }
104
+
105
+ .mo2f_faqs>hr{
106
+ border-top: 1px solid rgb(135, 129, 129) !important;
107
+ margin-right:20px !important;
108
+ }
109
+
110
+ .mo2f_faqs>h3>a:focus{
111
+ box-shadow: 0px 0px 0px 0px #fff !important;
112
+ }
113
+
114
+ .mo2f_msgs{
115
+ font-size: 14px !important;
116
+ }
117
+
118
+ .mo2f_row{
119
+
120
+ display :-webkit-inline-box !important;
121
+ }
122
+
123
+ .mo2f_success_container{
124
+ background-color: rgba(185, 228, 155, 0.56) !important;
125
+ margin-left: 3px !important;
126
+
127
+ }
128
+
129
+ .mo2f_error_container{
130
+ background-color: rgba(251, 102, 0, 0.29) !important;
131
+ margin-left: 3px !important;
132
+ }
133
+
134
+ .configuredBasic{
135
+ background: url(../images/feat_smart.png) rgba(99, 143, 223, 0.42) no-repeat right;
136
+ padding: 10px;
137
+ margin-bottom:0px;
138
+ }
139
+
140
+ .configuredSmart{
141
+ background: url(../images/Smartphone-24.png) rgba(99, 143, 223, 0.42) no-repeat right;
142
+ padding: 10px;
143
+ margin-bottom:0px;
144
+ }
145
+
146
+ .notConfiguredBasic{
147
+ background: url(../images/feat_smart.png) rgba(221, 221, 221, 0.66) no-repeat right;
148
+ padding: 10px;
149
+ margin-bottom:0px;
150
+ }
151
+
152
+ .notConfiguredSmart{
153
+ background: url(../images/Smartphone-24.png) rgba(221, 221, 221, 0.66) no-repeat right;
154
+ padding: 10px;
155
+ margin-bottom:0px;
156
+ }
157
+
158
+ .configuredLandline{
159
+ background: url(../images/landline_sprite.png) rgba(99, 143, 223, 0.42) no-repeat right;
160
+ padding: 10px;
161
+ margin-bottom:0px;
162
+ }
163
+
164
+ .notConfiguredLandline{
165
+ background: url(../images/landline_sprite.png) rgba(221, 221, 221, 0.66) no-repeat right;
166
+ padding: 10px;
167
+ margin-bottom:0px;
168
+ }
169
+
170
+ .selectedMethod{
171
+ background-color: rgba(54, 157, 4, 0.42) !important;
172
+ }
173
+
174
+ .color-icon{
175
+ vertical-align:middle;
176
+ display: inline-block;
177
+ width: 15px;
178
+ height: 15px;
179
+ margin-left:20px;
180
+ }
181
+
182
+ .activeMethod{
183
+ background-color: rgba(99, 143, 223, 0.42) !important;
184
+ margin-left:23%;
185
+
186
+ }
187
+ .inactiveMethod{
188
+ background-color: rgba(221, 221, 221, 0.66) !important;
189
+ margin-left:20.5%;
190
+
191
+ }
192
+
193
+ .configuredLaptop{
194
+ background: url(../images/laptop-24.png) rgba(99, 143, 223, 0.42) no-repeat right;
195
+ padding: 10px;
196
+ margin-bottom:0px;
197
+ }
198
+
199
+ .notConfiguredLaptop{
200
+ background: url(../images/laptop-24.png) rgba(221, 221, 221, 0.66) no-repeat right;
201
+ padding: 20px;
202
+ margin-bottom:0px;
203
+ }
204
+
205
+ .mo2f_column_padding{
206
+ padding-right: 10px;
207
+
208
+ }
209
+
210
+ .mo2f_td_show{
211
+ display:grid !important;
212
+ }
213
+
214
+ .mo2f_td_hide{
215
+ display:none !important;
216
+ }
217
+
218
+ .mo2f_pricing_table{
219
+ text-align:center;
220
+ font-size: 15px !important;
221
+ }
222
+
223
+ .mo2f_pricing_header{
224
+ color: #fff !important;
225
+ margin: 8px !important;
226
+ }
227
+
228
+ .mo2f_pricing_sub_header{
229
+ margin: 4px !important;
230
+ color: #fff !important;
231
+ }
232
+
233
+ .mo2f_pricing_text{
234
+ font-size: 15px !important;
235
+ color: #fff !important;
236
+ font-weight: bold !important;
237
+ }
238
+
239
+ .mo2f_pricing_free_tab{
240
+ background-color: rgba(34, 153, 221, 0.82)!important;
241
+ //#29d
242
+ }
243
+
244
+ .mo2f_pricing_paid_tab{
245
+ background-color: #1a71a4 !important;
246
+ }
247
+
248
+ .mo2f_kba_ques{
249
+ width:412px !important;
250
+ border-radius:4px;
251
+ height:30px;
252
+ font-size: 13px !important;
253
+ }
254
+ .mo2f_kba_table{
255
+ padding-left:10px;width:80%;
256
+ }
257
+
258
+ .mo2f_kba_tb_data{
259
+ padding-left:80px;
260
+ }
261
+ .mo2f_grayed_out{
262
+ background-color: rgba(128, 128, 128, 0.05) !important;
263
+ opacity: .5;
264
+ }
265
+
266
+ .mo2f_grayed_out_link{
267
+ position: absolute;
268
+ float: right;
269
+ margin: 0.5% 0 0 24%;
270
+ z-index:99;
271
+ }
272
+
273
+ .black_overlay{
274
+ display: none;
275
+ position: absolute;
276
+ top: 0%;
277
+ left: 0%;
278
+ width: 100%;
279
+ height: 100%;
280
+ background-color: black;
281
+ z-index:1001;
282
+ -moz-opacity: 0.8;
283
+ opacity:.80;
284
+ filter: alpha(opacity=80);
285
+ }
286
+ .white_content {
287
+ display: none;
288
+ position: absolute;
289
+ top: 45%;
290
+ left: 25%;
291
+ width: 35%;
292
+ height: 10%;
293
+ padding: 2px;
294
+ border: 16px solid white;
295
+ background-color: white;
296
+ z-index:1002;
297
+ overflow: auto;
298
+ }
includes/images/Smartphone-24.png ADDED
Binary file
includes/images/ajax-loader-login.gif ADDED
Binary file
includes/images/ajax-loader.gif ADDED
Binary file
includes/images/appstore.png ADDED
Binary file
includes/images/feat_smart.png ADDED
Binary file
includes/images/flags16.png ADDED
Binary file
includes/images/help/step1.png ADDED
Binary file
includes/images/help/step2.png ADDED
Binary file
includes/images/help/step3.png ADDED
Binary file
includes/images/help/step4.png ADDED
Binary file
includes/images/help/step5.png ADDED
Binary file
includes/images/help/step6.png ADDED
Binary file
includes/images/landline_sprite.png ADDED
Binary file
includes/images/laptop-24.png ADDED
Binary file
includes/images/miniOrange2.png ADDED
Binary file
includes/images/miniorange_icon.png ADDED
Binary file
includes/images/miniorange_logo.png ADDED
Binary file
includes/images/mo_white_logo.png ADDED
Binary file
includes/images/playStore.png ADDED
Binary file
includes/images/right.png ADDED
Binary file
includes/images/vertical_line.png ADDED
Binary file
includes/images/wrong.png ADDED
Binary file
includes/js/bootstrap.min.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*!
2
+ * Bootstrap v3.3.4 (http://getbootstrap.com)
3
+ * Copyright 2011-2015 Twitter, Inc.
4
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5
+ */
6
+ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.4",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.4",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.mo2f_carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.mo2f_carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".mo2f_carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.mo2f_carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.mo2f_carousel",a.proxy(this.pause,this)).on("mouseleave.bs.mo2f_carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.mo2f_carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.mo2f_carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.mo2f_carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("mo2f_carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.mo2f_carousel").to(h),c.preventDefault()}};a(document).on("click.bs.mo2f_carousel.data-api","[data-slide]",e).on("click.bs.mo2f_carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.mo2f_collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.mo2f_collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.4",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .mo2f_collapsing");if(!(e&&e.length&&(b=e.data("bs.mo2f_collapse"),b&&b.transitioning))){var f=a.Event("show.bs.mo2f_collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.mo2f_collapse",null));var g=this.dimension();this.$element.removeClass("mo2f_collapse").addClass("mo2f_collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("mo2f_collapsing").addClass("mo2f_collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.mo2f_collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.mo2f_collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("mo2f_collapsing").removeClass("mo2f_collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("mo2f_collapsing").addClass("mo2f_collapse").trigger("hidden.bs.mo2f_collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.mo2f_collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.mo2f_collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.4",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)&&!/input|textarea/i.test(b.target.tagName)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g&&27!=b.which||g&&27==b.which)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(b.target);38==b.which&&j>0&&j--,40==b.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.mo2f_modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.mo2f_modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".mo2f_modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".mo2f_modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.mo2f_modal")},this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.mo2f_modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("mo2f_modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.mo2f_modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.mo2f_modal",function(){d.$element.one("mouseup.dismiss.bs.mo2f_modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in").attr("aria-hidden",!1),d.enforceFocus();var f=a.Event("shown.bs.mo2f_modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.mo2f_modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.mo2f_modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.mo2f_modal").off("mouseup.dismiss.bs.mo2f_modal"),this.$dialog.off("mousedown.dismiss.bs.mo2f_modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.mo2f_modal").on("focusin.bs.mo2f_modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.mo2f_modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.mo2f_modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.mo2f_modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.mo2f_modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("mo2f_modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.mo2f_modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a('<div class="mo2f-modal-backdrop '+e+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.mo2f_modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="mo2f_modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.mo2f_modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.mo2f_modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.mo2f_modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.mo2f_modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-m<p.top?"bottom":"right"==h&&k.right+l>p.width?"left":"left"==h&&k.left-l<p.left?"right":h,f.removeClass(n).addClass(h)}var q=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(q,h);var r=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",r).emulateTransitionEnd(c.TRANSITION_DURATION):r()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.4",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.4",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){
7
+ var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.4",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a(document.body).height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
includes/js/phone.js ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ intl-tel-input
3
+ version: 0.8.3
4
+ description: A jQuery plugin for entering international telephone numbers
5
+ repository: https://github.com/Bluefieldscom/intl-tel-input.git
6
+ license: MIT
7
+ author: Jack O'Connor (http://jackocnr.com)
8
+ */
9
+ !function(a,b,c){function d(b,c){this.element=b,this.options=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="intlTelInput",f={preferredCountries:["IN","US"],americaMode:false};d.prototype={init:function(){var b=this,d=[];a.each(this.options.preferredCountries,function(b,c){var e=a.grep(intlTelInput.countries,function(a){return a.cca2==c});e.length&&d.push(e[0])});var e=a(this.element);""!==e.val()||this.options.americaMode||e.val("+1 "),e.wrap(a("<div>",{"class":"intl-number-input"}));var f=a("<div>",{"class":"flag-dropdown f16"}).insertBefore(e),g=a("<div>",{"class":"selected-flag"}).appendTo(f),h=d[0].cca2.toLowerCase(),i=a("<div>",{"class":"flag "+h}).appendTo(g);a("<div>",{"class":"down-arrow"}).appendTo(i);var j=a("<ul>",{"class":"country-list hide"}).appendTo(f);this.appendListItems(d,j),a("<li>",{"class":"divider"}).appendTo(j),this.appendListItems(intlTelInput.countries,j);var k=j.children(".country");k.first().addClass("active"),e.keyup(function(){var c=b.getDialCode(e.val())||"1",d=intlTelInput.countryCodes[c],f=!1;if(a.each(d,function(a,b){i.hasClass(b.toLowerCase())&&(f=!0)}),!f){var g=intlTelInput.countryCodes[c][0].toLowerCase();i.attr("class","flag "+g),k.removeClass("active"),k.children(".flag."+g).parent().addClass("active")}}),e.keyup(),g.click(function(d){if(d.stopPropagation(),j.hasClass("hide")){k.removeClass("highlight");var f=j.children(".active").addClass("highlight");b.scrollTo(f,j),j.removeClass("hide"),a(c).bind("keydown.intlTelInput",function(c){if(38==c.which||40==c.which){var d=j.children(".highlight").first(),f=38==c.which?d.prev():d.next();f&&(f.hasClass("divider")&&(f=38==c.which?f.prev():f.next()),k.removeClass("highlight"),f.addClass("highlight"),b.scrollTo(f,j))}else if(13==c.which){var h=j.children(".highlight").first();h.length&&b.selectCountry(h,g,e,j)}else if(9==c.which||27==c.which)b.closeDropdown(j);else if(c.which>=97&&c.which<=122||c.which>=65&&c.which<=90){var i=String.fromCharCode(c.which),l=k.filter(function(){return a(this).text().charAt(0)==i});if(l.length){var m,n=l.filter(".highlight").first();m=n&&n.next()&&n.next().text().charAt(0)==i?n.next():l.first(),k.removeClass("highlight"),m.addClass("highlight"),b.scrollTo(m,j)}}})}else b.closeDropdown(j)}),k.mouseover(function(){k.removeClass("highlight"),a(this).addClass("highlight")}),k.click(function(c){var d=a(c.currentTarget);b.selectCountry(d,g,e,j)}),a("html").click(function(c){a(c.target).closest(".country-list").length||b.closeDropdown(j)})},selectCountry:function(a,b,c,d){var e=a.attr("data-country-code").toLowerCase();b.find(".flag").attr("class","flag "+e);var f=this.updateNumber(c.val(),a.attr("data-dial-code"));c.val(f),this.closeDropdown(d),c.focus(),d.children(".country").removeClass("active highlight"),a.addClass("active")},closeDropdown:function(b){b.addClass("hide"),a(c).unbind("keydown.intlTelInput")},scrollTo:function(a,b){var c=b.height(),d=b.offset().top,e=d+c,f=a.outerHeight(),g=a.offset().top,h=g+f,i=g-d+b.scrollTop();if(d>g)b.scrollTop(i);else if(h>e){var j=c-f;b.scrollTop(i-j)}},updateNumber:function(a,b){var c,d="+"+this.getDialCode(a),e="+"+b;return d.length>1?(c=a.replace(d,e),a==d&&(c+=" ")):c=a.length&&"+"!=a.substr(0,1)?e+" "+a.trim():e+" ",this.options.americaMode&&"+1 "==c.substring(0,3)&&(c=c.substring(3)),c},getDialCode:function(a){var b=a.trim().split(" ")[0];if("+"==b.substring(0,1))for(var c=b.replace(/\D/g,"").substring(0,4),d=c.length;d>0;d--)if(c=c.substring(0,d),intlTelInput.countryCodes[c])return c;return""},appendListItems:function(b,c){var d="";a.each(b,function(a,b){d+="<li class='country' data-dial-code='"+b["calling-code"]+"' data-country-code='"+b.cca2+"'>",d+="<div class='flag "+b.cca2.toLowerCase()+"'></div>",d+="<span class='country-name'>"+b.name+"</span>",d+="<span class='dial-code'>+"+b["calling-code"]+"</span>",d+="</li>"}),c.append(d)}},a.fn[e]=function(b){return this.each(function(){a.data(this,"plugin_"+e)||a.data(this,"plugin_"+e,new d(this,b))})}}(jQuery,window,document);var intlTelInput={countries:[{name:"Afghanistan",cca2:"AF","calling-code":"93"},{name:"Albania",cca2:"AL","calling-code":"355"},{name:"Algeria",cca2:"DZ","calling-code":"213"},{name:"American Samoa",cca2:"AS","calling-code":"1684"},{name:"Andorra",cca2:"AD","calling-code":"376"},{name:"Angola",cca2:"AO","calling-code":"244"},{name:"Anguilla",cca2:"AI","calling-code":"1264"},{name:"Antigua and Barbuda",cca2:"AG","calling-code":"1268"},{name:"Argentina",cca2:"AR","calling-code":"54"},{name:"Armenia",cca2:"AM","calling-code":"374"},{name:"Aruba",cca2:"AW","calling-code":"297"},{name:"Australia",cca2:"AU","calling-code":"61"},{name:"Austria",cca2:"AT","calling-code":"43"},{name:"Azerbaijan",cca2:"AZ","calling-code":"994"},{name:"Bahamas",cca2:"BS","calling-code":"1242"},{name:"Bahrain",cca2:"BH","calling-code":"973"},{name:"Bangladesh",cca2:"BD","calling-code":"880"},{name:"Barbados",cca2:"BB","calling-code":"1246"},{name:"Belarus",cca2:"BY","calling-code":"375"},{name:"Belgium",cca2:"BE","calling-code":"32"},{name:"Belize",cca2:"BZ","calling-code":"501"},{name:"Benin",cca2:"BJ","calling-code":"229"},{name:"Bermuda",cca2:"BM","calling-code":"1441"},{name:"Bhutan",cca2:"BT","calling-code":"975"},{name:"Bolivia",cca2:"BO","calling-code":"591"},{name:"Bosnia and Herzegovina",cca2:"BA","calling-code":"387"},{name:"Botswana",cca2:"BW","calling-code":"267"},{name:"Brazil",cca2:"BR","calling-code":"55"},{name:"Brunei Darussalam",cca2:"BN","calling-code":"673"},{name:"Bulgaria",cca2:"BG","calling-code":"359"},{name:"Burkina Faso",cca2:"BF","calling-code":"226"},{name:"Burundi",cca2:"BI","calling-code":"257"},{name:"Cambodia",cca2:"KH","calling-code":"855"},{name:"Cameroon",cca2:"CM","calling-code":"237"},{name:"Canada",cca2:"CA","calling-code":"1"},{name:"Cape Verde",cca2:"CV","calling-code":"238"},{name:"Cayman Islands",cca2:"KY","calling-code":"1345"},{name:"Central African Republic",cca2:"CF","calling-code":"236"},{name:"Chad",cca2:"TD","calling-code":"235"},{name:"Chile",cca2:"CL","calling-code":"56"},{name:"China",cca2:"CN","calling-code":"86"},{name:"Colombia",cca2:"CO","calling-code":"57"},{name:"Comoros",cca2:"KM","calling-code":"269"},{name:"Congo (DRC)",cca2:"CD","calling-code":"243"},{name:"Congo (Republic)",cca2:"CG","calling-code":"242"},{name:"Cook Islands",cca2:"CK","calling-code":"682"},{name:"Costa Rica",cca2:"CR","calling-code":"506"},{name:"Côte d'Ivoire",cca2:"CI","calling-code":"225"},{name:"Croatia",cca2:"HR","calling-code":"385"},{name:"Cuba",cca2:"CU","calling-code":"53"},{name:"Cyprus",cca2:"CY","calling-code":"357"},{name:"Czech Republic",cca2:"CZ","calling-code":"420"},{name:"Denmark",cca2:"DK","calling-code":"45"},{name:"Djibouti",cca2:"DJ","calling-code":"253"},{name:"Dominica",cca2:"DM","calling-code":"1767"},{name:"Dominican Republic",cca2:"DO","calling-code":"1809"},{name:"Ecuador",cca2:"EC","calling-code":"593"},{name:"Egypt",cca2:"EG","calling-code":"20"},{name:"El Salvador",cca2:"SV","calling-code":"503"},{name:"Equatorial Guinea",cca2:"GQ","calling-code":"240"},{name:"Eritrea",cca2:"ER","calling-code":"291"},{name:"Estonia",cca2:"EE","calling-code":"372"},{name:"Ethiopia",cca2:"ET","calling-code":"251"},{name:"Faroe Islands",cca2:"FO","calling-code":"298"},{name:"Fiji",cca2:"FJ","calling-code":"679"},{name:"Finland",cca2:"FI","calling-code":"358"},{name:"France",cca2:"FR","calling-code":"33"},{name:"French Polynesia",cca2:"PF","calling-code":"689"},{name:"Gabon",cca2:"GA","calling-code":"241"},{name:"Gambia",cca2:"GM","calling-code":"220"},{name:"Georgia",cca2:"GE","calling-code":"995"},{name:"Germany",cca2:"DE","calling-code":"49"},{name:"Ghana",cca2:"GH","calling-code":"233"},{name:"Gibraltar",cca2:"GI","calling-code":"350"},{name:"Greece",cca2:"GR","calling-code":"30"},{name:"Greenland",cca2:"GL","calling-code":"299"},{name:"Grenada",cca2:"GD","calling-code":"1473"},{name:"Guadeloupe",cca2:"GP","calling-code":"590"},{name:"Guam",cca2:"GU","calling-code":"1671"},{name:"Guatemala",cca2:"GT","calling-code":"502"},{name:"Guernsey",cca2:"GG","calling-code":"44"},{name:"Guinea",cca2:"GN","calling-code":"224"},{name:"Guinea-Bissau",cca2:"GW","calling-code":"245"},{name:"Guyana",cca2:"GY","calling-code":"592"},{name:"Haiti",cca2:"HT","calling-code":"509"},{name:"Honduras",cca2:"HN","calling-code":"504"},{name:"Hong Kong",cca2:"HK","calling-code":"852"},{name:"Hungary",cca2:"HU","calling-code":"36"},{name:"Iceland",cca2:"IS","calling-code":"354"},{name:"India",cca2:"IN","calling-code":"91"},{name:"Indonesia",cca2:"ID","calling-code":"62"},{name:"Iran",cca2:"IR","calling-code":"98"},{name:"Iraq",cca2:"IQ","calling-code":"964"},{name:"Ireland",cca2:"IE","calling-code":"353"},{name:"Isle of Man",cca2:"IM","calling-code":"44"},{name:"Israel",cca2:"IL","calling-code":"972"},{name:"Italy",cca2:"IT","calling-code":"39"},{name:"Jamaica",cca2:"JM","calling-code":"1876"},{name:"Japan",cca2:"JP","calling-code":"81"},{name:"Jersey",cca2:"JE","calling-code":"44"},{name:"Jordan",cca2:"JO","calling-code":"962"},{name:"Kazakhstan",cca2:"KZ","calling-code":"7"},{name:"Kenya",cca2:"KE","calling-code":"254"},{name:"Kiribati",cca2:"KI","calling-code":"686"},{name:"Kuwait",cca2:"KW","calling-code":"965"},{name:"Kyrgyzstan",cca2:"KG","calling-code":"996"},{name:"Laos",cca2:"LA","calling-code":"856"},{name:"Latvia",cca2:"LV","calling-code":"371"},{name:"Lebanon",cca2:"LB","calling-code":"961"},{name:"Lesotho",cca2:"LS","calling-code":"266"},{name:"Liberia",cca2:"LR","calling-code":"231"},{name:"Libya",cca2:"LY","calling-code":"218"},{name:"Liechtenstein",cca2:"LI","calling-code":"423"},{name:"Lithuania",cca2:"LT","calling-code":"370"},{name:"Luxembourg",cca2:"LU","calling-code":"352"},{name:"Macao",cca2:"MO","calling-code":"853"},{name:"Macedonia",cca2:"MK","calling-code":"389"},{name:"Madagascar",cca2:"MG","calling-code":"261"},{name:"Malawi",cca2:"MW","calling-code":"265"},{name:"Malaysia",cca2:"MY","calling-code":"60"},{name:"Maldives",cca2:"MV","calling-code":"960"},{name:"Mali",cca2:"ML","calling-code":"223"},{name:"Malta",cca2:"MT","calling-code":"356"},{name:"Marshall Islands",cca2:"MH","calling-code":"692"},{name:"Martinique",cca2:"MQ","calling-code":"596"},{name:"Mauritania",cca2:"MR","calling-code":"222"},{name:"Mauritius",cca2:"MU","calling-code":"230"},{name:"Mexico",cca2:"MX","calling-code":"52"},{name:"Micronesia",cca2:"FM","calling-code":"691"},{name:"Moldova",cca2:"MD","calling-code":"373"},{name:"Monaco",cca2:"MC","calling-code":"377"},{name:"Mongolia",cca2:"MN","calling-code":"976"},{name:"Montenegro",cca2:"ME","calling-code":"382"},{name:"Montserrat",cca2:"MS","calling-code":"1664"},{name:"Morocco",cca2:"MA","calling-code":"212"},{name:"Mozambique",cca2:"MZ","calling-code":"258"},{name:"Myanmar (Burma)",cca2:"MM","calling-code":"95"},{name:"Namibia",cca2:"NA","calling-code":"264"},{name:"Nauru",cca2:"NR","calling-code":"674"},{name:"Nepal",cca2:"NP","calling-code":"977"},{name:"Netherlands",cca2:"NL","calling-code":"31"},{name:"New Caledonia",cca2:"NC","calling-code":"687"},{name:"New Zealand",cca2:"NZ","calling-code":"64"},{name:"Nicaragua",cca2:"NI","calling-code":"505"},{name:"Niger",cca2:"NE","calling-code":"227"},{name:"Nigeria",cca2:"NG","calling-code":"234"},{name:"North Korea",cca2:"KP","calling-code":"850"},{name:"Norway",cca2:"NO","calling-code":"47"},{name:"Oman",cca2:"OM","calling-code":"968"},{name:"Pakistan",cca2:"PK","calling-code":"92"},{name:"Palau",cca2:"PW","calling-code":"680"},{name:"Palestinian Territory",cca2:"PS","calling-code":"970"},{name:"Panama",cca2:"PA","calling-code":"507"},{name:"Papua New Guinea",cca2:"PG","calling-code":"675"},{name:"Paraguay",cca2:"PY","calling-code":"595"},{name:"Peru",cca2:"PE","calling-code":"51"},{name:"Philippines",cca2:"PH","calling-code":"63"},{name:"Poland",cca2:"PL","calling-code":"48"},{name:"Portugal",cca2:"PT","calling-code":"351"},{name:"Puerto Rico",cca2:"PR","calling-code":"1787"},{name:"Qatar",cca2:"QA","calling-code":"974"},{name:"Réunion",cca2:"RE","calling-code":"262"},{name:"Romania",cca2:"RO","calling-code":"40"},{name:"Russian Federation",cca2:"RU","calling-code":"7"},{name:"Rwanda",cca2:"RW","calling-code":"250"},{name:"Saint Kitts and Nevis",cca2:"KN","calling-code":"1869"},{name:"Saint Lucia",cca2:"LC","calling-code":"1758"},{name:"Saint Vincent and the Grenadines",cca2:"VC","calling-code":"1784"},{name:"Samoa",cca2:"WS","calling-code":"685"},{name:"San Marino",cca2:"SM","calling-code":"378"},{name:"São Tomé and Príncipe",cca2:"ST","calling-code":"239"},{name:"Saudi Arabia",cca2:"SA","calling-code":"966"},{name:"Senegal",cca2:"SN","calling-code":"221"},{name:"Serbia",cca2:"RS","calling-code":"381"},{name:"Seychelles",cca2:"SC","calling-code":"248"},{name:"Sierra Leone",cca2:"SL","calling-code":"232"},{name:"Singapore",cca2:"SG","calling-code":"65"},{name:"Slovakia",cca2:"SK","calling-code":"421"},{name:"Slovenia",cca2:"SI","calling-code":"386"},{name:"Solomon Islands",cca2:"SB","calling-code":"677"},{name:"Somalia",cca2:"SO","calling-code":"252"},{name:"South Africa",cca2:"ZA","calling-code":"27"},{name:"South Korea",cca2:"KR","calling-code":"82"},{name:"Spain",cca2:"ES","calling-code":"34"},{name:"Sri Lanka",cca2:"LK","calling-code":"94"},{name:"Sudan",cca2:"SD","calling-code":"249"},{name:"Suriname",cca2:"SR","calling-code":"597"},{name:"Swaziland",cca2:"SZ","calling-code":"268"},{name:"Sweden",cca2:"SE","calling-code":"46"},{name:"Switzerland",cca2:"CH","calling-code":"41"},{name:"Syrian Arab Republic",cca2:"SY","calling-code":"963"},{name:"Taiwan, Province of China",cca2:"TW","calling-code":"886"},{name:"Tajikistan",cca2:"TJ","calling-code":"992"},{name:"Tanzania",cca2:"TZ","calling-code":"255"},{name:"Thailand",cca2:"TH","calling-code":"66"},{name:"Timor-Leste",cca2:"TL","calling-code":"670"},{name:"Togo",cca2:"TG","calling-code":"228"},{name:"Tonga",cca2:"TO","calling-code":"676"},{name:"Trinidad and Tobago",cca2:"TT","calling-code":"1868"},{name:"Tunisia",cca2:"TN","calling-code":"216"},{name:"Turkey",cca2:"TR","calling-code":"90"},{name:"Turkmenistan",cca2:"TM","calling-code":"993"},{name:"Turks and Caicos Islands",cca2:"TC","calling-code":"1649"},{name:"Tuvalu",cca2:"TV","calling-code":"688"},{name:"Uganda",cca2:"UG","calling-code":"256"},{name:"Ukraine",cca2:"UA","calling-code":"380"},{name:"United Arab Emirates",cca2:"AE","calling-code":"971"},{name:"United Kingdom",cca2:"GB","calling-code":"44"},{name:"United States",cca2:"US","calling-code":"1"},{name:"Uruguay",cca2:"UY","calling-code":"598"},{name:"Uzbekistan",cca2:"UZ","calling-code":"998"},{name:"Vanuatu",cca2:"VU","calling-code":"678"},{name:"Vatican City",cca2:"VA","calling-code":"379"},{name:"Venezuela",cca2:"VE","calling-code":"58"},{name:"Viet Nam",cca2:"VN","calling-code":"84"},{name:"Virgin Islands (British)",cca2:"VG","calling-code":"1284"},{name:"Virgin Islands (U.S.)",cca2:"VI","calling-code":"1340"},{name:"Western Sahara",cca2:"EH","calling-code":"212"},{name:"Yemen",cca2:"YE","calling-code":"967"},{name:"Zambia",cca2:"ZM","calling-code":"260"},{name:"Zimbabwe",cca2:"ZW","calling-code":"263"}],countryCodes:{1:["US"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],379:["VA"],380:["UA"],381:["RS"],382:["ME"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"],1242:["BS"],1246:["BB"],1264:["AI"],1268:["AG"],1284:["VG"],1340:["VI"],1345:["KY"],1441:["BM"],1473:["GD"],1649:["TC"],1664:["MS"],1671:["GU"],1684:["AS"],1758:["LC"],1767:["DM"],1784:["VC"],1787:["PR"],1809:["DO"],1868:["TT"],1869:["KN"],1876:["JM"]}};
includes/js/rba/js/client.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(c){var a,d=function(){a=(new UAParser).getResult();return this};d.prototype={getSoftwareVersion:function(){return"ClientJS 0.05"},getBrowserData:function(){return a},getFingerprint:function(){var e=a.ua,b=this.getScreenPrint(),c=this.getPlugins(),d=this.getFonts(),f=this.isLocalStorage(),g=this.isSessionStorage(),h=this.getTimeZone(),k=this.getLanguage(),l=this.getSystemLanguage(),m=this.isCookie(),n=this.getCanvasPrint();return murmurhash3_32_gc(e+"|"+b+"|"+c+"|"+d+"|"+f+"|"+g+"|"+h+"|"+
2
+ k+"|"+l+"|"+m+"|"+n,256)},getUserAgent:function(){return a.ua},getUserAgentLowerCase:function(){return a.ua.toLowerCase()},getBrowser:function(){return a.browser.name},getBrowserVersion:function(){return a.browser.version},getBrowserMajorVersion:function(){return a.browser.major},isIE:function(){return/IE/i.test(a.browser.name)},isChrome:function(){return/Chrome/i.test(a.browser.name)},isFirefox:function(){return/Firefox/i.test(a.browser.name)},isSafari:function(){return/Safari/i.test(a.browser.name)},
3
+ isOpera:function(){return/Opera/i.test(a.browser.name)},getEngine:function(){return a.engine.name},getEngineVersion:function(){return a.engine.version},getOS:function(){return a.os.name},getOSVersion:function(){return a.os.version},isWindows:function(){return/Windows/i.test(a.os.name)},isMac:function(){return/Mac/i.test(a.os.name)},isLinux:function(){return/Linux/i.test(a.os.name)},isUbuntu:function(){return/Ubuntu/i.test(a.os.name)},isSolaris:function(){return/Solaris/i.test(a.os.name)},getDevice:function(){return a.device.model},
4
+ getDeviceType:function(){return a.device.type},getDeviceVendor:function(){return a.device.vendor},getCPU:function(){return a.cpu.architecture},isMobile:function(){var e=a.ua||navigator.vendor||window.opera;return/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(e)||
5
+ /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,
6
+ 4))},isMobileMajor:function(){return this.isMobileAndroid()||this.isMobileBlackBerry()||this.isMobileIOS()||this.isMobileOpera()||this.isMobileWindows()},isMobileAndroid:function(){return a.ua.match(/Android/i)?!0:!1},isMobileOpera:function(){return a.ua.match(/Opera Mini/i)?!0:!1},isMobileWindows:function(){return a.ua.match(/IEMobile/i)?!0:!1},isMobileBlackBerry:function(){return a.ua.match(/BlackBerry/i)?!0:!1},isMobileIOS:function(){return a.ua.match(/iPhone|iPad|iPod/i)?!0:!1},isIphone:function(){return a.ua.match(/iPhone/i)?
7
+ !0:!1},isIpad:function(){return a.ua.match(/iPad/i)?!0:!1},isIpod:function(){return a.ua.match(/iPod/i)?!0:!1},getScreenPrint:function(){return"Current Resolution: "+this.getCurrentResolution()+", Avaiable Resolution: "+this.getAvailableResolution()+", Color Depth: "+this.getColorDepth()+", Device XDPI: "+this.getDeviceXDPI()+", Device YDPI: "+this.getDeviceYDPI()},getColorDepth:function(){return screen.colorDepth},getCurrentResolution:function(){return screen.width+"x"+screen.height},getAvailableResolution:function(){return screen.availWidth+
8
+ "x"+screen.availHeight},getDeviceXDPI:function(){return screen.deviceXDPI},getDeviceYDPI:function(){return screen.deviceYDPI},getPlugins:function(){for(var a="",b=0;b<navigator.plugins.length;b++)a=b==navigator.plugins.length-1?a+navigator.plugins[b].name:a+(navigator.plugins[b].name+", ");return a},isJava:function(){return navigator.javaEnabled()},getJavaVersion:function(){return deployJava.getJREs().toString()},isFlash:function(){objPlayerVersion=swfobject.getFlashPlayerVersion();strTemp=objPlayerVersion.major+
9
+ "."+objPlayerVersion.minor+"."+objPlayerVersion.release;return"0.0.0"===strTemp?!1:!0},getFlashVersion:function(){objPlayerVersion=swfobject.getFlashPlayerVersion();return objPlayerVersion.major+"."+objPlayerVersion.minor+"."+objPlayerVersion.release},isSilverlight:function(){return navigator.plugins["Silverlight Plug-In"]?!0:!1},getSilverlightVersion:function(){return navigator.plugins["Silverlight Plug-In"].description},isMimeTypes:function(){return navigator.mimeTypes.length?!0:!1},getMimeTypes:function(){for(var a=
10
+ "",b=0;b<navigator.mimeTypes.length;b++)a=b==navigator.mimeTypes.length-1?a+navigator.mimeTypes[b].description:a+(navigator.mimeTypes[b].description+", ");return a},isFont:function(a){return(new Detector).detect(a)},getFonts:function(){return fontlist;},isLocalStorage:function(){try{return!!c.localStorage}catch(a){return!0}},isSessionStorage:function(){try{return!!c.sessionStorage}catch(a){return!0}},isCookie:function(){return navigator.cookieEnabled},getTimeZone:function(){return String(String(new Date).split("(")[1]).split(")")[0]},
11
+ getLanguage:function(){return navigator.language},getSystemLanguage:function(){return navigator.systemLanguage},isCanvas:function(){var a=document.createElement("canvas");return!(!a.getContext||!a.getContext("2d"))},getCanvasPrint:function(){var a=document.createElement("canvas"),b=a.getContext("2d");b.textBaseline="top";b.font="14px 'Arial'";b.textBaseline="alphabetic";b.fillStyle="#f60";b.fillRect(125,1,62,20);b.fillStyle="#069";b.fillText("http://valve.github.io",2,15);b.fillStyle="rgba(102, 204, 0, 0.7)";
12
+ b.fillText("http://valve.github.io",4,17);return a.toDataURL()}};"object"===typeof module&&"object"===typeof exports&&(module.exports=d);c.ClientJS=d})(window);
includes/js/rba/js/device_attributes.js ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ var jsReady=!1;function isReady(){return jsReady}function pageInit(){jsReady=!0;var a=setInterval(function(){checkFontsExist&&(clearInterval(a),clearTimeout(b),fetch_client_whorls())},50),b=setTimeout(function(){clearInterval(a);fetch_client_whorls()},1E3)}var fontlist="",checkFontsExist=!1,fingerprint,countryName,countryCode,latitude,longitude,ip,timeZone,region,regionCode,postalCode,city,continent,continentCode,isp;
2
+ function populateFontList(a){var b=0,c=0,e;for(e in a){var d=a[e],d=d.replace(/^\s\s*/,"").replace(/\s\s*$/,"");d.match(/[_\-\s]Italic$/)||d.match(/[_\-\s](Demi)?[Bb]old$/)||d.match(/[_\-\s]Medium$/)||d.match(/[_\-\s](Ultra)?[Ll]ight$/)||d.match(/[_\-\s]Condensed$/)||(d=d.replace(/\s*Regular$/,""),c++);fontlist=0==b?d:fontlist+(", "+d);b++}checkFontsExist=!0}
3
+ function get_browser_attributes(){var a=new ClientJS,b=a.getUserAgent();updateJSONObject("browser.useragent",b);b=a.getScreenPrint();updateJSONObject("browser.screenprint",b);fingerprint=a.getFingerprint();updateJSONObject("device.fingerprint",fingerprint);b=a.getPlugins();updateJSONObject("browser.plugins",b);b=a.isLocalStorage();updateJSONObject("browser.hasLocalStorage",b);b=a.isSessionStorage();updateJSONObject("browser.hasSessionStorage",b);b=a.getTimeZone();updateJSONObject("browser.timezone",
4
+ b);b=a.getLanguage();updateJSONObject("browser.language",b);b=a.getSystemLanguage();updateJSONObject("browser.sytemLanguage",b);b=a.isCookie();updateJSONObject("browser.hasCookie",b);b=a.getCanvasPrint();updateJSONObject("browser.canvasPrint",b);var c=a.isMobile(),b=a.getBrowser();updateJSONObject("browser.type",b);0==c?($("#getDeviceType").text("Laptop"),updateJSONObject("device.type","Laptop")):updateJSONObject("device.type","Mobile");updateJSONObject("time.currentTime",(new Date).toTimeString());
5
+ c="";a.isMobile()?(a.isMobileAndroid()?c="Android":a.isMobileOpera()?c="Opera":a.isMobileWindows()?c="Windows":a.isMobileBlackBerry()?c="BlackBerry":a.isMobileIOS()&&(a.isIphone()?c="iPhone":a.isIpad()?c="iPad":a.isIpod()&&(c="iPod")),c=c+" "+a.getOSVersion()+" / "+a.getBrowser()):c=a.getOS()+" "+a.getOSVersion()+" / "+a.getBrowser();updateJSONObject("profile.name",c);$("#title-fingerprint").text(fingerprint);$("#getBrowser").text(b)}
6
+ function hasFlash(){try{if(new ActiveXObject("ShockwaveFlash.ShockwaveFlash"))return!0}catch(a){if(navigator.mimeTypes&&void 0!=navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)return!0}return!1}
7
+ var onSuccess=function(a){countryName=a.country.names.en;countryCode=a.country.iso_code;latitude=a.location.latitude;longitude=a.location.longitude;ip=a.traits.ip_address;timeZone=a.location.time_zone;region=a.subdivisions[0].names.en;regionCode=a.subdivisions[0].iso_code;postalCode=a.postal.code;city=a.city.names.en;continent=a.continent.names.en;continentCode=a.continent.code;isp=a.traits.isp;updateJSONObject("location.countryName",countryName);updateJSONObject("location.countryCode",countryCode);
8
+ updateJSONObject("location.latitude",latitude);updateJSONObject("location.longitude",longitude);updateJSONObject("location.ip",ip);updateJSONObject("location.timeZone",timeZone);updateJSONObject("location.region",region);updateJSONObject("location.regionCode",regionCode);updateJSONObject("location.postalCode",postalCode);updateJSONObject("location.city",city);updateJSONObject("location.continent",continent);updateJSONObject("location.continentCode",continentCode);updateJSONObject("location.isp",isp)},
9
+ onError=function(a){console.log("Couldn't get the location.");updateJSONObject('location.ip',$('#mo_client_ip').val());};function fetch_client_whorls(){$("#message").hide();hasFlash()&&checkFontsExist&&updateJSONObject("system.fonts",fontlist);get_browser_attributes();/*geoip2.insights(onSuccess,onError);*/set_dom_storage()}function updateJSONObject(a,b){rbaAttributes.attributes.push({attrName:a,attrValue:b})}
10
+ function set_dom_storage(){try{localStorage.miniorange="yea",sessionStorage.miniorange="yea"}catch(a){}};
includes/js/rba/js/fontdetect.js ADDED
@@ -0,0 +1 @@
 
1
+ var Detector=function(){var b=["monospace","sans-serif","serif"],d=document.getElementsByTagName("body")[0],a=document.createElement("span");a.style.fontSize="72px";a.innerHTML="mmmmmmmmmmlli";var g={},h={},c;for(c in b)a.style.fontFamily=b[c],d.appendChild(a),g[b[c]]=a.offsetWidth,h[b[c]]=a.offsetHeight,d.removeChild(a);this.detect=function(c){var f=!1,e;for(e in b){a.style.fontFamily=c+","+b[e];d.appendChild(a);var k=a.offsetWidth!=g[b[e]]||a.offsetHeight!=h[b[e]];d.removeChild(a);f=f||k}return f}};
includes/js/rba/js/fonts.swf ADDED
Binary file
includes/js/rba/js/jquery-1.9.1.js ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(r,m){function ya(a){var b=a.length,d=c.type(a);return c.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===d||"function"!==d&&(0===b||"number"===typeof b&&0<b&&b-1 in a)}function Rb(a){var b=Ua[a]={};c.each(a.match(O)||[],function(a,c){b[c]=!0});return b}function Va(a,b,d,e){if(c.acceptData(a)){var f=c.expando,g="string"===typeof b,h=a.nodeType,k=h?c.cache:a,l=h?a[f]:a[f]&&f;if(l&&k[l]&&(e||k[l].data)||!g||d!==m){l||(h?a[f]=l=I.pop()||c.guid++:l=f);k[l]||(k[l]={},h||(k[l].toJSON=c.noop));if("object"===
2
+ typeof b||"function"===typeof b)e?k[l]=c.extend(k[l],b):k[l].data=c.extend(k[l].data,b);a=k[l];e||(a.data||(a.data={}),a=a.data);d!==m&&(a[c.camelCase(b)]=d);g?(d=a[b],null==d&&(d=a[c.camelCase(b)])):d=a;return d}}}function Wa(a,b,d){if(c.acceptData(a)){var e,f,g,h=a.nodeType,k=h?c.cache:a,l=h?a[c.expando]:c.expando;if(k[l]){if(b&&(g=d?k[l]:k[l].data)){c.isArray(b)?b=b.concat(c.map(b,c.camelCase)):b in g?b=[b]:(b=c.camelCase(b),b=b in g?[b]:b.split(" "));e=0;for(f=b.length;e<f;e++)delete g[b[e]];
3
+ if(!(d?za:c.isEmptyObject)(g))return}if(!d&&(delete k[l].data,!za(k[l])))return;h?c.cleanData([a],!0):c.support.deleteExpando||k!=k.window?delete k[l]:k[l]=null}}}function Xa(a,b,d){if(d===m&&1===a.nodeType)if(d="data-"+b.replace(Sb,"-$1").toLowerCase(),d=a.getAttribute(d),"string"===typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:Tb.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=m;return d}function za(a){for(var b in a)if(("data"!==b||!c.isEmptyObject(a[b]))&&"toJSON"!==
4
+ b)return!1;return!0}function ba(){return!0}function R(){return!1}function Ya(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function Za(a,b,d){b=b||0;if(c.isFunction(b))return c.grep(a,function(a,c){return!!b.call(a,c,a)===d});if(b.nodeType)return c.grep(a,function(a){return a===b===d});if("string"===typeof b){var e=c.grep(a,function(a){return 1===a.nodeType});if(Ub.test(b))return c.filter(b,e,!d);b=c.filter(b,e)}return c.grep(a,function(a){return 0<=c.inArray(a,b)===d})}function $a(a){var b=ab.split("|");
5
+ a=a.createDocumentFragment();if(a.createElement)for(;b.length;)a.createElement(b.pop());return a}function Vb(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function bb(a){var b=a.getAttributeNode("type");a.type=(b&&b.specified)+"/"+a.type;return a}function cb(a){var b=Wb.exec(a.type);b?a.type=b[1]:a.removeAttribute("type");return a}function Aa(a,b){for(var d,e=0;null!=(d=a[e]);e++)c._data(d,"globalEval",!b||c._data(b[e],"globalEval"))}function db(a,b){if(1===
6
+ b.nodeType&&c.hasData(a)){var d,e,f;e=c._data(a);var g=c._data(b,e),h=e.events;if(h)for(d in delete g.handle,g.events={},h)for(e=0,f=h[d].length;e<f;e++)c.event.add(b,d,h[d][e]);g.data&&(g.data=c.extend({},g.data))}}function B(a,b){var d,e,f=0,g=typeof a.getElementsByTagName!==z?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==z?a.querySelectorAll(b||"*"):m;if(!g)for(g=[],d=a.childNodes||a;null!=(e=d[f]);f++)!b||c.nodeName(e,b)?g.push(e):c.merge(g,B(e,b));return b===m||b&&c.nodeName(a,b)?
7
+ c.merge([a],g):g}function Xb(a){Ba.test(a.type)&&(a.defaultChecked=a.checked)}function eb(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),e=b,f=fb.length;f--;)if(b=fb[f]+c,b in a)return b;return e}function fa(a,b){a=b||a;return"none"===c.css(a,"display")||!c.contains(a.ownerDocument,a)}function gb(a,b){for(var d,e,f,g=[],h=0,k=a.length;h<k;h++)e=a[h],e.style&&(g[h]=c._data(e,"olddisplay"),d=e.style.display,b?(g[h]||"none"!==d||(e.style.display=""),""===e.style.display&&fa(e)&&
8
+ (g[h]=c._data(e,"olddisplay",hb(e.nodeName)))):g[h]||(f=fa(e),(d&&"none"!==d||!f)&&c._data(e,"olddisplay",f?d:c.css(e,"display"))));for(h=0;h<k;h++)e=a[h],!e.style||b&&"none"!==e.style.display&&""!==e.style.display||(e.style.display=b?g[h]||"":"none");return a}function ib(a,b,c){return(a=Yb.exec(b))?Math.max(0,a[1]-(c||0))+(a[2]||"px"):b}function jb(a,b,d,e,f){b=d===(e?"border":"content")?4:"width"===b?1:0;for(var g=0;4>b;b+=2)"margin"===d&&(g+=c.css(a,d+S[b],!0,f)),e?("content"===d&&(g-=c.css(a,
9
+ "padding"+S[b],!0,f)),"margin"!==d&&(g-=c.css(a,"border"+S[b]+"Width",!0,f))):(g+=c.css(a,"padding"+S[b],!0,f),"padding"!==d&&(g+=c.css(a,"border"+S[b]+"Width",!0,f)));return g}function kb(a,b,d){var e=!0,f="width"===b?a.offsetWidth:a.offsetHeight,g=T(a),h=c.support.boxSizing&&"border-box"===c.css(a,"boxSizing",!1,g);if(0>=f||null==f){f=U(a,b,g);if(0>f||null==f)f=a.style[b];if(ka.test(f))return f;e=h&&(c.support.boxSizingReliable||f===a.style[b]);f=parseFloat(f)||0}return f+jb(a,b,d||(h?"border":
10
+ "content"),e,g)+"px"}function hb(a){var b=p,d=lb[a];d||(d=mb(a,b),"none"!==d&&d||(ga=(ga||c("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(b.documentElement),b=(ga[0].contentWindow||ga[0].contentDocument).document,b.write("<!doctype html><html><body>"),b.close(),d=mb(a,b),ga.detach()),lb[a]=d);return d}function mb(a,b){var d=c(b.createElement(a)).appendTo(b.body),e=c.css(d[0],"display");d.remove();return e}function Ca(a,b,d,e){var f;if(c.isArray(b))c.each(b,
11
+ function(b,c){d||Zb.test(a)?e(a,c):Ca(a+"["+("object"===typeof c?b:"")+"]",c,d,e)});else if(d||"object"!==c.type(b))e(a,b);else for(f in b)Ca(a+"["+f+"]",b[f],d,e)}function nb(a){return function(b,d){"string"!==typeof b&&(d=b,b="*");var e,f=0,g=b.toLowerCase().match(O)||[];if(c.isFunction(d))for(;e=g[f++];)"+"===e[0]?(e=e.slice(1)||"*",(a[e]=a[e]||[]).unshift(d)):(a[e]=a[e]||[]).push(d)}}function ob(a,b,d,e){function f(k){var l;g[k]=!0;c.each(a[k]||[],function(a,c){var k=c(b,d,e);if("string"===typeof k&&
12
+ !h&&!g[k])return b.dataTypes.unshift(k),f(k),!1;if(h)return!(l=k)});return l}var g={},h=a===Da;return f(b.dataTypes[0])||!g["*"]&&f("*")}function Ea(a,b){var d,e,f=c.ajaxSettings.flatOptions||{};for(e in b)b[e]!==m&&((f[e]?a:d||(d={}))[e]=b[e]);d&&c.extend(!0,a,d);return a}function pb(){try{return new r.XMLHttpRequest}catch(a){}}function qb(){setTimeout(function(){Y=m});return Y=c.now()}function $b(a,b){c.each(b,function(b,c){for(var f=(ha[b]||[]).concat(ha["*"]),g=0,h=f.length;g<h&&!f[g].call(a,
13
+ b,c);g++);})}function rb(a,b,d){var e,f=0,g=la.length,h=c.Deferred().always(function(){delete k.elem}),k=function(){if(e)return!1;for(var b=Y||qb(),b=Math.max(0,l.startTime+l.duration-b),c=1-(b/l.duration||0),d=0,f=l.tweens.length;d<f;d++)l.tweens[d].run(c);h.notifyWith(a,[l,c,b]);if(1>c&&f)return b;h.resolveWith(a,[l]);return!1},l=h.promise({elem:a,props:c.extend({},b),opts:c.extend(!0,{specialEasing:{}},d),originalProperties:b,originalOptions:d,startTime:Y||qb(),duration:d.duration,tweens:[],createTween:function(b,
14
+ d){var e=c.Tween(a,l.opts,b,d,l.opts.specialEasing[b]||l.opts.easing);l.tweens.push(e);return e},stop:function(b){var c=0,d=b?l.tweens.length:0;if(e)return this;for(e=!0;c<d;c++)l.tweens[c].run(1);b?h.resolveWith(a,[l,b]):h.rejectWith(a,[l,b]);return this}});d=l.props;for(ac(d,l.opts.specialEasing);f<g;f++)if(b=la[f].call(l,a,d,l.opts))return b;$b(l,d);c.isFunction(l.opts.start)&&l.opts.start.call(a,l);c.fx.timer(c.extend(k,{elem:a,anim:l,queue:l.opts.queue}));return l.progress(l.opts.progress).done(l.opts.done,
15
+ l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function ac(a,b){var d,e,f,g,h;for(f in a)if(e=c.camelCase(f),g=b[e],d=a[f],c.isArray(d)&&(g=d[1],d=a[f]=d[0]),f!==e&&(a[e]=d,delete a[f]),(h=c.cssHooks[e])&&"expand"in h)for(f in d=h.expand(d),delete a[e],d)f in a||(a[f]=d[f],b[f]=g);else b[e]=g}function A(a,b,c,e,f){return new A.prototype.init(a,b,c,e,f)}function ma(a,b){var c,e={height:a},f=0;for(b=b?1:0;4>f;f+=2-b)c=S[f],e["margin"+c]=e["padding"+c]=a;b&&(e.opacity=e.width=a);return e}function sb(a){return c.isWindow(a)?
16
+ a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var na,tb,z=typeof m,p=r.document,bc=r.location,cc=r.jQuery,dc=r.$,oa={},I=[],ub=I.concat,Fa=I.push,C=I.slice,vb=I.indexOf,ec=oa.toString,ia=oa.hasOwnProperty,Ga="1.9.1".trim,c=function(a,b){return new c.fn.init(a,b,tb)},pa=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,O=/\S+/g,fc=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,gc=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,wb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,hc=/^[\],:{}\s]*$/,ic=/(?:^|:|,)(?:\s*\[)+/g,jc=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
17
+ kc=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,lc=/^-ms-/,mc=/-([\da-z])/gi,nc=function(a,b){return b.toUpperCase()},L=function(a){if(p.addEventListener||"load"===a.type||"complete"===p.readyState)xb(),c.ready()},xb=function(){p.addEventListener?(p.removeEventListener("DOMContentLoaded",L,!1),r.removeEventListener("load",L,!1)):(p.detachEvent("onreadystatechange",L),r.detachEvent("onload",L))};c.fn=c.prototype={jquery:"1.9.1",constructor:c,init:function(a,b,d){var e;if(!a)return this;
18
+ if("string"===typeof a){e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&3<=a.length?[null,a,null]:gc.exec(a);if(!e||!e[1]&&b)return!b||b.jquery?(b||d).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof c?b[0]:b,c.merge(this,c.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:p,!0)),wb.test(e[1])&&c.isPlainObject(b))for(e in b)if(c.isFunction(this[e]))this[e](b[e]);else this.attr(e,b[e])}else{if((b=p.getElementById(e[2]))&&b.parentNode){if(b.id!==e[2])return d.find(a);this.length=1;this[0]=
19
+ b}this.context=p;this.selector=a}return this}if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(c.isFunction(a))return d.ready(a);a.selector!==m&&(this.selector=a.selector,this.context=a.context);return c.makeArray(a,this)},selector:"",length:0,size:function(){return this.length},toArray:function(){return C.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a){a=c.merge(this.constructor(),a);a.prevObject=this;a.context=this.context;
20
+ return a},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.ready.promise().done(a);return this},slice:function(){return this.pushStack(C.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length;a=+a+(0>a?b:0);return this.pushStack(0<=a&&a<b?[this[a]]:[])},map:function(a){return this.pushStack(c.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:Fa,
21
+ sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a,b,d,e,f,g=arguments[0]||{},h=1,k=arguments.length,l=!1;"boolean"===typeof g&&(l=g,g=arguments[1]||{},h=2);"object"===typeof g||c.isFunction(g)||(g={});k===h&&(g=this,--h);for(;h<k;h++)if(null!=(f=arguments[h]))for(e in f)a=g[e],d=f[e],g!==d&&(l&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,a=a&&c.isArray(a)?a:[]):a=a&&c.isPlainObject(a)?a:{},g[e]=c.extend(l,a,d)):d!==m&&(g[e]=d));return g};c.extend({noConflict:function(a){r.$===
22
+ c&&(r.$=dc);a&&r.jQuery===c&&(r.jQuery=cc);return c},isReady:!1,readyWait:1,holdReady:function(a){a?c.readyWait++:c.ready(!0)},ready:function(a){if(!0===a?!--c.readyWait:!c.isReady){if(!p.body)return setTimeout(c.ready);c.isReady=!0;!0!==a&&0<--c.readyWait||(na.resolveWith(p,[c]),c.fn.trigger&&c(p).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===c.type(a)},isArray:Array.isArray||function(a){return"array"===c.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&
23
+ isFinite(a)},type:function(a){return null==a?String(a):"object"===typeof a||"function"===typeof a?oa[ec.call(a)]||"object":typeof a},isPlainObject:function(a){if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!ia.call(a,"constructor")&&!ia.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(var b in a);return b===m||ia.call(a,b)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw Error(a);},parseHTML:function(a,
24
+ b,d){if(!a||"string"!==typeof a)return null;"boolean"===typeof b&&(d=b,b=!1);b=b||p;var e=wb.exec(a);d=!d&&[];if(e)return[b.createElement(e[1])];e=c.buildFragment([a],b,d);d&&c(d).remove();return c.merge([],e.childNodes)},parseJSON:function(a){if(r.JSON&&r.JSON.parse)return r.JSON.parse(a);if(null===a)return a;if("string"===typeof a&&(a=c.trim(a))&&hc.test(a.replace(jc,"@").replace(kc,"]").replace(ic,"")))return(new Function("return "+a))();c.error("Invalid JSON: "+a)},parseXML:function(a){var b,
25
+ d;if(!a||"string"!==typeof a)return null;try{r.DOMParser?(d=new DOMParser,b=d.parseFromString(a,"text/xml")):(b=new ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a))}catch(e){b=m}b&&b.documentElement&&!b.getElementsByTagName("parsererror").length||c.error("Invalid XML: "+a);return b},noop:function(){},globalEval:function(a){a&&c.trim(a)&&(r.execScript||function(a){r.eval.call(r,a)})(a)},camelCase:function(a){return a.replace(lc,"ms-").replace(mc,nc)},nodeName:function(a,b){return a.nodeName&&
26
+ a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var e,f=0,g=a.length;e=ya(a);if(c)if(e)for(;f<g&&(e=b.apply(a[f],c),!1!==e);f++);else for(f in a){if(e=b.apply(a[f],c),!1===e)break}else if(e)for(;f<g&&(e=b.call(a[f],f,a[f]),!1!==e);f++);else for(f in a)if(e=b.call(a[f],f,a[f]),!1===e)break;return a},trim:Ga&&!Ga.call("\ufeff\u00a0")?function(a){return null==a?"":Ga.call(a)}:function(a){return null==a?"":(a+"").replace(fc,"")},makeArray:function(a,b){var d=b||[];null!=a&&(ya(Object(a))?
27
+ c.merge(d,"string"===typeof a?[a]:a):Fa.call(d,a));return d},inArray:function(a,b,c){var e;if(b){if(vb)return vb.call(b,a,c);e=b.length;for(c=c?0>c?Math.max(0,e+c):c:0;c<e;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=b.length,e=a.length,f=0;if("number"===typeof c)for(;f<c;f++)a[e++]=b[f];else for(;b[f]!==m;)a[e++]=b[f++];a.length=e;return a},grep:function(a,b,c){var e,f=[],g=0,h=a.length;for(c=!!c;g<h;g++)e=!!b(a[g],g),c!==e&&f.push(a[g]);return f},map:function(a,b,c){var e,
28
+ f=0,g=a.length,h=[];if(ya(a))for(;f<g;f++)e=b(a[f],f,c),null!=e&&(h[h.length]=e);else for(f in a)e=b(a[f],f,c),null!=e&&(h[h.length]=e);return ub.apply([],h)},guid:1,proxy:function(a,b){var d,e;"string"===typeof b&&(e=a[b],b=a,a=e);if(!c.isFunction(a))return m;d=C.call(arguments,2);e=function(){return a.apply(b||this,d.concat(C.call(arguments)))};e.guid=a.guid=a.guid||c.guid++;return e},access:function(a,b,d,e,f,g,h){var k=0,l=a.length,u=null==d;if("object"===c.type(d))for(k in f=!0,d)c.access(a,
29
+ b,k,d[k],!0,g,h);else if(e!==m&&(f=!0,c.isFunction(e)||(h=!0),u&&(h?(b.call(a,e),b=null):(u=b,b=function(a,b,d){return u.call(c(a),d)})),b))for(;k<l;k++)b(a[k],d,h?e:e.call(a[k],k,b(a[k],d)));return f?a:u?b.call(a):l?b(a[0],d):g},now:function(){return(new Date).getTime()}});c.ready.promise=function(a){if(!na)if(na=c.Deferred(),"complete"===p.readyState)setTimeout(c.ready);else if(p.addEventListener)p.addEventListener("DOMContentLoaded",L,!1),r.addEventListener("load",L,!1);else{p.attachEvent("onreadystatechange",
30
+ L);r.attachEvent("onload",L);var b=!1;try{b=null==r.frameElement&&p.documentElement}catch(d){}b&&b.doScroll&&function e(){if(!c.isReady){try{b.doScroll("left")}catch(a){return setTimeout(e,50)}xb();c.ready()}}()}return na.promise(a)};c.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){oa["[object "+b+"]"]=b.toLowerCase()});tb=c(p);var Ua={};c.Callbacks=function(a){a="string"===typeof a?Ua[a]||Rb(a):c.extend({},a);var b,d,e,f,g,h,k=[],l=!a.once&&[],u=function(c){d=
31
+ a.memory&&c;e=!0;g=h||0;h=0;f=k.length;for(b=!0;k&&g<f;g++)if(!1===k[g].apply(c[0],c[1])&&a.stopOnFalse){d=!1;break}b=!1;k&&(l?l.length&&u(l.shift()):d?k=[]:t.disable())},t={add:function(){if(k){var e=k.length;(function oc(b){c.each(b,function(b,d){var e=c.type(d);"function"===e?a.unique&&t.has(d)||k.push(d):d&&d.length&&"string"!==e&&oc(d)})})(arguments);b?f=k.length:d&&(h=e,u(d))}return this},remove:function(){k&&c.each(arguments,function(a,d){for(var e;-1<(e=c.inArray(d,k,e));)k.splice(e,1),b&&
32
+ (e<=f&&f--,e<=g&&g--)});return this},has:function(a){return a?-1<c.inArray(a,k):!(!k||!k.length)},empty:function(){k=[];return this},disable:function(){k=l=d=m;return this},disabled:function(){return!k},lock:function(){l=m;d||t.disable();return this},locked:function(){return!l},fireWith:function(a,c){c=c||[];c=[a,c.slice?c.slice():c];!k||e&&!l||(b?l.push(c):u(c));return this},fire:function(){t.fireWith(this,arguments);return this},fired:function(){return!!e}};return t};c.extend({Deferred:function(a){var b=
33
+ [["resolve","done",c.Callbacks("once memory"),"resolved"],["reject","fail",c.Callbacks("once memory"),"rejected"],["notify","progress",c.Callbacks("memory")]],d="pending",e={state:function(){return d},always:function(){f.done(arguments).fail(arguments);return this},then:function(){var a=arguments;return c.Deferred(function(d){c.each(b,function(b,l){var u=l[0],m=c.isFunction(a[b])&&a[b];f[l[1]](function(){var a=m&&m.apply(this,arguments);if(a&&c.isFunction(a.promise))a.promise().done(d.resolve).fail(d.reject).progress(d.notify);
34
+ else d[u+"With"](this===e?d.promise():this,m?[a]:arguments)})});a=null}).promise()},promise:function(a){return null!=a?c.extend(a,e):e}},f={};e.pipe=e.then;c.each(b,function(a,c){var k=c[2],l=c[3];e[c[1]]=k.add;l&&k.add(function(){d=l},b[a^1][2].disable,b[2][2].lock);f[c[0]]=function(){f[c[0]+"With"](this===f?e:this,arguments);return this};f[c[0]+"With"]=k.fireWith});e.promise(f);a&&a.call(f,f);return f},when:function(a){var b=0,d=C.call(arguments),e=d.length,f=1!==e||a&&c.isFunction(a.promise)?e:
35
+ 0,g=1===f?a:c.Deferred(),h=function(a,b,c){return function(d){b[a]=this;c[a]=1<arguments.length?C.call(arguments):d;c===k?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},k,l,u;if(1<e)for(k=Array(e),l=Array(e),u=Array(e);b<e;b++)d[b]&&c.isFunction(d[b].promise)?d[b].promise().done(h(b,u,d)).fail(g.reject).progress(h(b,l,k)):--f;f||g.resolveWith(u,d);return g.promise()}});c.support=function(){var a,b,d,e,f,g,h,k=p.createElement("div");k.setAttribute("className","t");k.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
36
+ b=k.getElementsByTagName("*");d=k.getElementsByTagName("a")[0];if(!b||!d||!b.length)return{};e=p.createElement("select");f=e.appendChild(p.createElement("option"));b=k.getElementsByTagName("input")[0];d.style.cssText="top:1px;float:left;opacity:.5";a={getSetAttribute:"t"!==k.className,leadingWhitespace:3===k.firstChild.nodeType,tbody:!k.getElementsByTagName("tbody").length,htmlSerialize:!!k.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),
37
+ opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:!!b.value,optSelected:f.selected,enctype:!!p.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==p.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===p.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1};b.checked=!0;a.noCloneChecked=b.cloneNode(!0).checked;e.disabled=!0;a.optDisabled=!f.disabled;try{delete k.test}catch(l){a.deleteExpando=
38
+ !1}b=p.createElement("input");b.setAttribute("value","");a.input=""===b.getAttribute("value");b.value="t";b.setAttribute("type","radio");a.radioValue="t"===b.value;b.setAttribute("checked","t");b.setAttribute("name","t");d=p.createDocumentFragment();d.appendChild(b);a.appendChecked=b.checked;a.checkClone=d.cloneNode(!0).cloneNode(!0).lastChild.checked;k.attachEvent&&(k.attachEvent("onclick",function(){a.noCloneEvent=!1}),k.cloneNode(!0).click());for(h in{submit:!0,change:!0,focusin:!0})k.setAttribute(d=
39
+ "on"+h,"t"),a[h+"Bubbles"]=d in r||!1===k.attributes[d].expando;k.style.backgroundClip="content-box";k.cloneNode(!0).style.backgroundClip="";a.clearCloneStyle="content-box"===k.style.backgroundClip;c(function(){var b,c,d=p.getElementsByTagName("body")[0];d&&(b=p.createElement("div"),b.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",d.appendChild(b).appendChild(k),k.innerHTML="<table><tr><td></td><td>t</td></tr></table>",c=k.getElementsByTagName("td"),
40
+ c[0].style.cssText="padding:0;margin:0;border:0;display:none",g=0===c[0].offsetHeight,c[0].style.display="",c[1].style.display="none",a.reliableHiddenOffsets=g&&0===c[0].offsetHeight,k.innerHTML="",k.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",a.boxSizing=4===k.offsetWidth,a.doesNotIncludeMarginInBodyOffset=1!==d.offsetTop,r.getComputedStyle&&(a.pixelPosition="1%"!==
41
+ (r.getComputedStyle(k,null)||{}).top,a.boxSizingReliable="4px"===(r.getComputedStyle(k,null)||{width:"4px"}).width,c=k.appendChild(p.createElement("div")),c.style.cssText=k.style.cssText="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",c.style.marginRight=c.style.width="0",k.style.width="1px",a.reliableMarginRight=!parseFloat((r.getComputedStyle(c,null)||{}).marginRight)),typeof k.style.zoom!==z&&(k.innerHTML="",k.style.cssText=
42
+ "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;width:1px;padding:1px;display:inline;zoom:1",a.inlineBlockNeedsLayout=3===k.offsetWidth,k.style.display="block",k.innerHTML="<div></div>",k.firstChild.style.width="5px",a.shrinkWrapBlocks=3!==k.offsetWidth,a.inlineBlockNeedsLayout&&(d.style.zoom=1)),d.removeChild(b),k=null)});b=e=d=f=d=b=null;return a}();var Tb=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Sb=/([A-Z])/g;c.extend({cache:{},
43
+ expando:"jQuery"+("1.9.1"+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?c.cache[a[c.expando]]:a[c.expando];return!!a&&!za(a)},data:function(a,b,c){return Va(a,b,c)},removeData:function(a,b){return Wa(a,b)},_data:function(a,b,c){return Va(a,b,c,!0)},_removeData:function(a,b){return Wa(a,b,!0)},acceptData:function(a){if(a.nodeType&&1!==a.nodeType&&9!==a.nodeType)return!1;var b=a.nodeName&&c.noData[a.nodeName.toLowerCase()];
44
+ return!b||!0!==b&&a.getAttribute("classid")===b}});c.fn.extend({data:function(a,b){var d,e,f=this[0],g=0,h=null;if(a===m){if(this.length&&(h=c.data(f),1===f.nodeType&&!c._data(f,"parsedAttrs"))){for(d=f.attributes;g<d.length;g++)e=d[g].name,e.indexOf("data-")||(e=c.camelCase(e.slice(5)),Xa(f,e,h[e]));c._data(f,"parsedAttrs",!0)}return h}return"object"===typeof a?this.each(function(){c.data(this,a)}):c.access(this,function(b){if(b===m)return f?Xa(f,a,c.data(f,a)):null;this.each(function(){c.data(this,
45
+ a,b)})},null,b,1<arguments.length,null,!0)},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){var e;if(a)return b=(b||"fx")+"queue",e=c._data(a,b),d&&(!e||c.isArray(d)?e=c._data(a,b,c.makeArray(d)):e.push(d)),e||[]},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.length,f=d.shift(),g=c._queueHooks(a,b),h=function(){c.dequeue(a,b)};"inprogress"===f&&(f=d.shift(),e--);if(g.cur=f)"fx"===b&&d.unshift("inprogress"),delete g.stop,f.call(a,
46
+ h,g);!e&&g&&g.empty.fire()},_queueHooks:function(a,b){var d=b+"queueHooks";return c._data(a,d)||c._data(a,d,{empty:c.Callbacks("once memory").add(function(){c._removeData(a,b+"queue");c._removeData(a,d)})})}});c.fn.extend({queue:function(a,b){var d=2;"string"!==typeof a&&(b=a,a="fx",d--);return arguments.length<d?c.queue(this[0],a):b===m?this:this.each(function(){var d=c.queue(this,a,b);c._queueHooks(this,a);"fx"===a&&"inprogress"!==d[0]&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
47
+ a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;return this.queue(b||"fx",function(b,c){var f=setTimeout(b,a);c.stop=function(){clearTimeout(f)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var d,e=1,f=c.Deferred(),g=this,h=this.length,k=function(){--e||f.resolveWith(g,[g])};"string"!==typeof a&&(b=a,a=m);for(a=a||"fx";h--;)(d=c._data(g[h],a+"queueHooks"))&&d.empty&&(e++,d.empty.add(k));k();return f.promise(b)}});var V,yb,Ha=/[\t\r\n]/g,pc=/\r/g,qc=/^(?:input|select|textarea|button|object)$/i,
48
+ rc=/^(?:a|area)$/i,zb=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Ia=/^(?:checked|selected)$/i,Z=c.support.getSetAttribute,Ja=c.support.input;c.fn.extend({attr:function(a,b){return c.access(this,c.attr,a,b,1<arguments.length)},removeAttr:function(a){return this.each(function(){c.removeAttr(this,a)})},prop:function(a,b){return c.access(this,c.prop,a,b,1<arguments.length)},removeProp:function(a){a=c.propFix[a]||a;return this.each(function(){try{this[a]=
49
+ m,delete this[a]}catch(b){}})},addClass:function(a){var b,d,e,f,g,h=0,k=this.length;b="string"===typeof a&&a;if(c.isFunction(a))return this.each(function(b){c(this).addClass(a.call(this,b,this.className))});if(b)for(b=(a||"").match(O)||[];h<k;h++)if(d=this[h],e=1===d.nodeType&&(d.className?(" "+d.className+" ").replace(Ha," "):" ")){for(g=0;f=b[g++];)0>e.indexOf(" "+f+" ")&&(e+=f+" ");d.className=c.trim(e)}return this},removeClass:function(a){var b,d,e,f,g,h=0,k=this.length;b=0===arguments.length||
50
+ "string"===typeof a&&a;if(c.isFunction(a))return this.each(function(b){c(this).removeClass(a.call(this,b,this.className))});if(b)for(b=(a||"").match(O)||[];h<k;h++)if(d=this[h],e=1===d.nodeType&&(d.className?(" "+d.className+" ").replace(Ha," "):"")){for(g=0;f=b[g++];)for(;0<=e.indexOf(" "+f+" ");)e=e.replace(" "+f+" "," ");d.className=a?c.trim(e):""}return this},toggleClass:function(a,b){var d=typeof a,e="boolean"===typeof b;return c.isFunction(a)?this.each(function(d){c(this).toggleClass(a.call(this,
51
+ d,this.className,b),b)}):this.each(function(){if("string"===d)for(var f,g=0,h=c(this),k=b,l=a.match(O)||[];f=l[g++];)k=e?k:!h.hasClass(f),h[k?"addClass":"removeClass"](f);else if(d===z||"boolean"===d)this.className&&c._data(this,"__className__",this.className),this.className=this.className||!1===a?"":c._data(this,"__className__")||""})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;b<c;b++)if(1===this[b].nodeType&&0<=(" "+this[b].className+" ").replace(Ha," ").indexOf(a))return!0;return!1},
52
+ val:function(a){var b,d,e,f=this[0];if(arguments.length)return e=c.isFunction(a),this.each(function(b){var f=c(this);1===this.nodeType&&(b=e?a.call(this,b,f.val()):a,null==b?b="":"number"===typeof b?b+="":c.isArray(b)&&(b=c.map(b,function(a){return null==a?"":a+""})),d=c.valHooks[this.type]||c.valHooks[this.nodeName.toLowerCase()],d&&"set"in d&&d.set(this,b,"value")!==m||(this.value=b))});if(f){if((d=c.valHooks[f.type]||c.valHooks[f.nodeName.toLowerCase()])&&"get"in d&&(b=d.get(f,"value"))!==m)return b;
53
+ b=f.value;return"string"===typeof b?b.replace(pc,""):null==b?"":b}}});c.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){for(var b,d=a.options,e=a.selectedIndex,f=(a="select-one"===a.type||0>e)?null:[],g=a?e+1:d.length,h=0>e?g:a?e:0;h<g;h++)if(b=d[h],!(!b.selected&&h!==e||(c.support.optDisabled?b.disabled:null!==b.getAttribute("disabled"))||b.parentNode.disabled&&c.nodeName(b.parentNode,"optgroup"))){b=c(b).val();if(a)return b;
54
+ f.push(b)}return f},set:function(a,b){var d=c.makeArray(b);c(a).find("option").each(function(){this.selected=0<=c.inArray(c(this).val(),d)});d.length||(a.selectedIndex=-1);return d}}},attr:function(a,b,d){var e,f,g;f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f){if(typeof a.getAttribute===z)return c.prop(a,b,d);if(f=1!==f||!c.isXMLDoc(a))b=b.toLowerCase(),e=c.attrHooks[b]||(zb.test(b)?yb:V);if(d!==m)if(null===d)c.removeAttr(a,b);else{if(e&&f&&"set"in e&&(g=e.set(a,d,b))!==m)return g;a.setAttribute(b,d+"");
55
+ return d}else{if(e&&f&&"get"in e&&null!==(g=e.get(a,b)))return g;typeof a.getAttribute!==z&&(g=a.getAttribute(b));return null==g?m:g}}},removeAttr:function(a,b){var d,e,f=0,g=b&&b.match(O);if(g&&1===a.nodeType)for(;d=g[f++];)e=c.propFix[d]||d,zb.test(d)?!Z&&Ia.test(d)?a[c.camelCase("default-"+d)]=a[e]=!1:a[e]=!1:c.attr(a,d,""),a.removeAttribute(Z?d:e)},attrHooks:{type:{set:function(a,b){if(!c.support.radioValue&&"radio"===b&&c.nodeName(a,"input")){var d=a.value;a.setAttribute("type",b);d&&(a.value=
56
+ d);return b}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,b,d){var e,f,g;g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g){if(g=1!==g||!c.isXMLDoc(a))b=c.propFix[b]||b,f=c.propHooks[b];return d!==m?f&&"set"in f&&(e=f.set(a,d,b))!==m?e:a[b]=d:f&&"get"in f&&null!==(e=
57
+ f.get(a,b))?e:a[b]}},propHooks:{tabIndex:{get:function(a){var b=a.getAttributeNode("tabindex");return b&&b.specified?parseInt(b.value,10):qc.test(a.nodeName)||rc.test(a.nodeName)&&a.href?0:m}}}});yb={get:function(a,b){var d=c.prop(a,b),e="boolean"===typeof d&&a.getAttribute(b);return(d="boolean"===typeof d?Ja&&Z?null!=e:Ia.test(b)?a[c.camelCase("default-"+b)]:!!e:a.getAttributeNode(b))&&!1!==d.value?b.toLowerCase():m},set:function(a,b,d){!1===b?c.removeAttr(a,d):Ja&&Z||!Ia.test(d)?a.setAttribute(!Z&&
58
+ c.propFix[d]||d,d):a[c.camelCase("default-"+d)]=a[d]=!0;return d}};Ja&&Z||(c.attrHooks.value={get:function(a,b){var d=a.getAttributeNode(b);return c.nodeName(a,"input")?a.defaultValue:d&&d.specified?d.value:m},set:function(a,b,d){if(c.nodeName(a,"input"))a.defaultValue=b;else return V&&V.set(a,b,d)}});Z||(V=c.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&("id"===b||"name"===b||"coords"===b?""!==c.value:c.specified)?c.value:m},set:function(a,b,c){var e=a.getAttributeNode(c);
59
+ e||a.setAttributeNode(e=a.ownerDocument.createAttribute(c));e.value=b+="";return"value"===c||b===a.getAttribute(c)?b:m}},c.attrHooks.contenteditable={get:V.get,set:function(a,b,c){V.set(a,""===b?!1:b,c)}},c.each(["width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{set:function(a,c){if(""===c)return a.setAttribute(b,"auto"),c}})}));c.support.hrefNormalized||(c.each(["href","src","width","height"],function(a,b){c.attrHooks[b]=c.extend(c.attrHooks[b],{get:function(a){a=a.getAttribute(b,
60
+ 2);return null==a?m:a}})}),c.each(["href","src"],function(a,b){c.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}));c.support.style||(c.attrHooks.style={get:function(a){return a.style.cssText||m},set:function(a,b){return a.style.cssText=b+""}});c.support.optSelected||(c.propHooks.selected=c.extend(c.propHooks.selected,{get:function(a){if(a=a.parentNode)a.selectedIndex,a.parentNode&&a.parentNode.selectedIndex;return null}}));c.support.enctype||(c.propFix.enctype="encoding");c.support.checkOn||
61
+ c.each(["radio","checkbox"],function(){c.valHooks[this]={get:function(a){return null===a.getAttribute("value")?"on":a.value}}});c.each(["radio","checkbox"],function(){c.valHooks[this]=c.extend(c.valHooks[this],{set:function(a,b){if(c.isArray(b))return a.checked=0<=c.inArray(c(a).val(),b)}})});var Ka=/^(?:input|select|textarea)$/i,sc=/^key/,tc=/^(?:mouse|contextmenu)|click/,Ab=/^(?:focusinfocus|focusoutblur)$/,Bb=/^([^.]*)(?:\.(.+)|)$/;c.event={global:{},add:function(a,b,d,e,f){var g,h,k,l,u,t,n,q,
62
+ p;if(k=c._data(a)){d.handler&&(l=d,d=l.handler,f=l.selector);d.guid||(d.guid=c.guid++);(h=k.events)||(h=k.events={});(u=k.handle)||(u=k.handle=function(a){return typeof c===z||a&&c.event.triggered===a.type?m:c.event.dispatch.apply(u.elem,arguments)},u.elem=a);b=(b||"").match(O)||[""];for(k=b.length;k--;)g=Bb.exec(b[k])||[],q=t=g[1],p=(g[2]||"").split(".").sort(),g=c.event.special[q]||{},q=(f?g.delegateType:g.bindType)||q,g=c.event.special[q]||{},t=c.extend({type:q,origType:t,data:e,handler:d,guid:d.guid,
63
+ selector:f,needsContext:f&&c.expr.match.needsContext.test(f),namespace:p.join(".")},l),(n=h[q])||(n=h[q]=[],n.delegateCount=0,g.setup&&!1!==g.setup.call(a,e,p,u)||(a.addEventListener?a.addEventListener(q,u,!1):a.attachEvent&&a.attachEvent("on"+q,u))),g.add&&(g.add.call(a,t),t.handler.guid||(t.handler.guid=d.guid)),f?n.splice(n.delegateCount++,0,t):n.push(t),c.event.global[q]=!0;a=null}},remove:function(a,b,d,e,f){var g,h,k,l,u,m,n,q,p,r,B,A=c.hasData(a)&&c._data(a);if(A&&(m=A.events)){b=(b||"").match(O)||
64
+ [""];for(u=b.length;u--;)if(k=Bb.exec(b[u])||[],p=B=k[1],r=(k[2]||"").split(".").sort(),p){n=c.event.special[p]||{};p=(e?n.delegateType:n.bindType)||p;q=m[p]||[];k=k[2]&&new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)");for(l=g=q.length;g--;)h=q[g],!f&&B!==h.origType||d&&d.guid!==h.guid||k&&!k.test(h.namespace)||e&&e!==h.selector&&("**"!==e||!h.selector)||(q.splice(g,1),h.selector&&q.delegateCount--,n.remove&&n.remove.call(a,h));l&&!q.length&&(n.teardown&&!1!==n.teardown.call(a,r,A.handle)||
65
+ c.removeEvent(a,p,A.handle),delete m[p])}else for(p in m)c.event.remove(a,p+b[u],d,e,!0);c.isEmptyObject(m)&&(delete A.handle,c._removeData(a,"events"))}},trigger:function(a,b,d,e){var f,g,h,k,l,u,t=[d||p],n=ia.call(a,"type")?a.type:a;l=ia.call(a,"namespace")?a.namespace.split("."):[];h=f=d=d||p;if(3!==d.nodeType&&8!==d.nodeType&&!Ab.test(n+c.event.triggered)&&(0<=n.indexOf(".")&&(l=n.split("."),n=l.shift(),l.sort()),g=0>n.indexOf(":")&&"on"+n,a=a[c.expando]?a:new c.Event(n,"object"===typeof a&&a),
66
+ a.isTrigger=!0,a.namespace=l.join("."),a.namespace_re=a.namespace?new RegExp("(^|\\.)"+l.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,a.result=m,a.target||(a.target=d),b=null==b?[a]:c.makeArray(b,[a]),l=c.event.special[n]||{},e||!l.trigger||!1!==l.trigger.apply(d,b))){if(!e&&!l.noBubble&&!c.isWindow(d)){k=l.delegateType||n;Ab.test(k+n)||(h=h.parentNode);for(;h;h=h.parentNode)t.push(h),f=h;f===(d.ownerDocument||p)&&t.push(f.defaultView||f.parentWindow||r)}for(u=0;(h=t[u++])&&!a.isPropagationStopped();)a.type=
67
+ 1<u?k:l.bindType||n,(f=(c._data(h,"events")||{})[a.type]&&c._data(h,"handle"))&&f.apply(h,b),(f=g&&h[g])&&c.acceptData(h)&&f.apply&&!1===f.apply(h,b)&&a.preventDefault();a.type=n;if(!(e||a.isDefaultPrevented()||l._default&&!1!==l._default.apply(d.ownerDocument,b)||"click"===n&&c.nodeName(d,"a"))&&c.acceptData(d)&&g&&d[n]&&!c.isWindow(d)){(f=d[g])&&(d[g]=null);c.event.triggered=n;try{d[n]()}catch(q){}c.event.triggered=m;f&&(d[g]=f)}return a.result}},dispatch:function(a){a=c.event.fix(a);var b,d,e,
68
+ f,g=[],h=C.call(arguments);b=(c._data(this,"events")||{})[a.type]||[];var k=c.event.special[a.type]||{};h[0]=a;a.delegateTarget=this;if(!k.preDispatch||!1!==k.preDispatch.call(this,a)){g=c.event.handlers.call(this,a,b);for(b=0;(e=g[b++])&&!a.isPropagationStopped();)for(a.currentTarget=e.elem,f=0;(d=e.handlers[f++])&&!a.isImmediatePropagationStopped();)if(!a.namespace_re||a.namespace_re.test(d.namespace))a.handleObj=d,a.data=d.data,d=((c.event.special[d.origType]||{}).handle||d.handler).apply(e.elem,
69
+ h),d!==m&&!1===(a.result=d)&&(a.preventDefault(),a.stopPropagation());k.postDispatch&&k.postDispatch.call(this,a);return a.result}},handlers:function(a,b){var d,e,f,g,h=[],k=b.delegateCount,l=a.target;if(k&&l.nodeType&&(!a.button||"click"!==a.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(!0!==l.disabled||"click"!==a.type)){f=[];for(g=0;g<k;g++)e=b[g],d=e.selector+" ",f[d]===m&&(f[d]=e.needsContext?0<=c(d,this).index(l):c.find(d,this,null,[l]).length),f[d]&&f.push(e);f.length&&h.push({elem:l,
70
+ handlers:f})}k<b.length&&h.push({elem:this,handlers:b.slice(k)});return h},fix:function(a){if(a[c.expando])return a;var b,d,e;b=a.type;var f=a,g=this.fixHooks[b];g||(this.fixHooks[b]=g=tc.test(b)?this.mouseHooks:sc.test(b)?this.keyHooks:{});e=g.props?this.props.concat(g.props):this.props;a=new c.Event(f);for(b=e.length;b--;)d=e[b],a[d]=f[d];a.target||(a.target=f.srcElement||p);3===a.target.nodeType&&(a.target=a.target.parentNode);a.metaKey=!!a.metaKey;return g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
71
+ fixHooks:{},keyHooks:{props:["char","charCode","key","keyCode"],filter:function(a,b){null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f=b.button,g=b.fromElement;null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||p,e=c.documentElement,c=c.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||
72
+ c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0));!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g);a.which||f===m||(a.which=f&1?1:f&2?3:f&4?2:0);return a}},special:{load:{noBubble:!0},click:{trigger:function(){if(c.nodeName(this,"input")&&"checkbox"===this.type&&this.click)return this.click(),!1}},focus:{trigger:function(){if(this!==p.activeElement&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},
73
+ blur:{trigger:function(){if(this===p.activeElement&&this.blur)return this.blur(),!1},delegateType:"focusout"},beforeunload:{postDispatch:function(a){a.result!==m&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,d,e){a=c.extend(new c.Event,d,{type:a,isSimulated:!0,originalEvent:{}});e?c.event.trigger(a,null,b):c.event.dispatch.call(b,a);a.isDefaultPrevented()&&d.preventDefault()}};c.removeEvent=p.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:
74
+ function(a,b,c){b="on"+b;a.detachEvent&&(typeof a[b]===z&&(a[b]=null),a.detachEvent(b,c))};c.Event=function(a,b){if(!(this instanceof c.Event))return new c.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||!1===a.returnValue||a.getPreventDefault&&a.getPreventDefault()?ba:R):this.type=a;b&&c.extend(this,b);this.timeStamp=a&&a.timeStamp||c.now();this[c.expando]=!0};c.Event.prototype={isDefaultPrevented:R,isPropagationStopped:R,isImmediatePropagationStopped:R,
75
+ preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ba;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ba;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ba;this.stopPropagation()}};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={delegateType:b,bindType:b,handle:function(a){var e,
76
+ f=a.relatedTarget,g=a.handleObj;if(!f||f!==this&&!c.contains(this,f))a.type=g.origType,e=g.handler.apply(this,arguments),a.type=b;return e}}});c.support.submitBubbles||(c.event.special.submit={setup:function(){if(c.nodeName(this,"form"))return!1;c.event.add(this,"click._submit keypress._submit",function(a){a=a.target;(a=c.nodeName(a,"input")||c.nodeName(a,"button")?a.form:m)&&!c._data(a,"submitBubbles")&&(c.event.add(a,"submit._submit",function(a){a._submit_bubble=!0}),c._data(a,"submitBubbles",!0))})},
77
+ postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&c.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){if(c.nodeName(this,"form"))return!1;c.event.remove(this,"._submit")}});c.support.changeBubbles||(c.event.special.change={setup:function(){if(Ka.test(this.nodeName)){if("checkbox"===this.type||"radio"===this.type)c.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),
78
+ c.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1);c.event.simulate("change",this,a,!0)});return!1}c.event.add(this,"beforeactivate._change",function(a){a=a.target;Ka.test(a.nodeName)&&!c._data(a,"changeBubbles")&&(c.event.add(a,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||c.event.simulate("change",this.parentNode,a,!0)}),c._data(a,"changeBubbles",!0))})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||
79
+ a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type)return a.handleObj.handler.apply(this,arguments)},teardown:function(){c.event.remove(this,"._change");return!Ka.test(this.nodeName)}});c.support.focusinBubbles||c.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){c.event.simulate(b,a.target,c.event.fix(a),!0)};c.event.special[b]={setup:function(){0===d++&&p.addEventListener(a,e,!0)},teardown:function(){0===--d&&p.removeEventListener(a,e,!0)}}});c.fn.extend({on:function(a,
80
+ b,d,e,f){var g,h;if("object"===typeof a){"string"!==typeof b&&(d=d||b,b=m);for(g in a)this.on(g,b,d,a[g],f);return this}null==d&&null==e?(e=b,d=b=m):null==e&&("string"===typeof b?(e=d,d=m):(e=d,d=b,b=m));if(!1===e)e=R;else if(!e)return this;1===f&&(h=e,e=function(a){c().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=c.guid++));return this.each(function(){c.event.add(this,a,e,d,b)})},one:function(a,b,c,e){return this.on(a,b,c,e,1)},off:function(a,b,d){var e;if(a&&a.preventDefault&&a.handleObj)return e=
81
+ a.handleObj,c(a.delegateTarget).off(e.namespace?e.origType+"."+e.namespace:e.origType,e.selector,e.handler),this;if("object"===typeof a){for(e in a)this.off(e,b,a[e]);return this}if(!1===b||"function"===typeof b)d=b,b=m;!1===d&&(d=R);return this.each(function(){c.event.remove(this,a,d,b)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,e){return this.on(b,a,c,e)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,
82
+ "**"):this.off(b,a||"**",c)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){var d=this[0];if(d)return c.event.trigger(a,b,d,!0)}});(function(a,b){function d(a){return ka.test(a+"")}function e(){var a,b=[];return a=function(c,d){b.push(c+=" ")>w.cacheLength&&delete a[b.shift()];return a[c]=d}}function f(a){a[D]=!0;return a}function g(a){var b=E.createElement("div");try{return a(b)}catch(c){return!1}finally{}}function h(a,b,c,d){var e,f,g,
83
+ h,k;(b?b.ownerDocument||b:ja)!==E&&J(b);b=b||E;c=c||[];if(!a||"string"!==typeof a)return c;if(1!==(h=b.nodeType)&&9!==h)return[];if(!P&&!d){if(e=la.exec(a))if(g=e[1])if(9===h)if((f=b.getElementById(g))&&f.parentNode){if(f.id===g)return c.push(f),c}else return c;else{if(b.ownerDocument&&(f=b.ownerDocument.getElementById(g))&&sa(b,f)&&f.id===g)return c.push(f),c}else{if(e[2])return F.apply(c,I.call(b.getElementsByTagName(a),0)),c;if((g=e[3])&&x.getByClassName&&b.getElementsByClassName)return F.apply(c,
84
+ I.call(b.getElementsByClassName(g),0)),c}if(x.qsa&&!K.test(a)){e=!0;f=D;g=b;k=9===h&&a;if(1===h&&"object"!==b.nodeName.toLowerCase()){h=n(a);(e=b.getAttribute("id"))?f=e.replace(oa,"\\$&"):b.setAttribute("id",f);f="[id='"+f+"'] ";for(g=h.length;g--;)h[g]=f+p(h[g]);g=ba.test(a)&&b.parentNode||b;k=h.join(",")}if(k)try{return F.apply(c,I.call(g.querySelectorAll(k),0)),c}catch(l){}finally{e||b.removeAttribute("id")}}}var m;a:{a=a.replace(Q,"$1");f=n(a);if(!d&&1===f.length){e=f[0]=f[0].slice(0);if(2<e.length&&
85
+ "ID"===(m=e[0]).type&&9===b.nodeType&&!P&&w.relative[e[1].type]){b=w.find.ID(m.matches[0].replace(da,ea),b)[0];if(!b){m=c;break a}a=a.slice(e.shift().value.length)}for(h=X.needsContext.test(a)?0:e.length;h--;){m=e[h];if(w.relative[g=m.type])break;if(g=w.find[g])if(d=g(m.matches[0].replace(da,ea),ba.test(e[0].type)&&b.parentNode||b)){e.splice(h,1);a=d.length&&p(e);if(!a){F.apply(c,I.call(d,0));m=c;break a}break}}}L(a,f)(d,b,P,c,ba.test(a));m=c}return m}function k(a,b){var c=b&&a,d=c&&(~b.sourceIndex||
86
+ -2147483648)-(~a.sourceIndex||-2147483648);if(d)return d;if(c)for(;c=c.nextSibling;)if(c===b)return-1;return a?1:-1}function l(a){return function(b){return"input"===b.nodeName.toLowerCase()&&b.type===a}}function u(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function m(a){return f(function(b){b=+b;return f(function(c,d){for(var e,f=a([],c.length,b),g=f.length;g--;)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function n(a,b){var c,d,e,f,g,k,l;if(g=T[a+" "])return b?
87
+ 0:g.slice(0);g=a;k=[];for(l=w.preFilter;g;){if(!c||(d=fa.exec(g)))d&&(g=g.slice(d[0].length)||g),k.push(e=[]);c=!1;if(d=ga.exec(g))c=d.shift(),e.push({value:c,type:d[0].replace(Q," ")}),g=g.slice(c.length);for(f in w.filter)!(d=X[f].exec(g))||l[f]&&!(d=l[f](d))||(c=d.shift(),e.push({value:c,type:f,matches:d}),g=g.slice(c.length));if(!c)break}return b?g.length:g?h.error(a):T(a,k).slice(0)}function p(a){for(var b=0,c=a.length,d="";b<c;b++)d+=a[b].value;return d}function r(a,b,c){var d=b.dir,e=c&&"parentNode"===
88
+ d,f=W++;return b.first?function(b,c,f){for(;b=b[d];)if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,k,La,l=N+" "+f;if(g)for(;b=b[d];){if((1===b.nodeType||e)&&a(b,c,g))return!0}else for(;b=b[d];)if(1===b.nodeType||e)if(La=b[D]||(b[D]={}),(k=La[d])&&k[0]===l){if(!0===(h=k[1])||h===v)return!0===h}else if(k=La[d]=[l],k[1]=a(b,c,g)||v,!0===k[1])return!0}}function A(a){return 1<a.length?function(b,c,d){for(var e=a.length;e--;)if(!a[e](b,c,d))return!1;return!0}:a[0]}function B(a,b,c,d,e){for(var f,
89
+ g=[],h=0,k=a.length,l=null!=b;h<k;h++)if(f=a[h])if(!c||c(f,d,e))g.push(f),l&&b.push(h);return g}function H(a,b,c,d,e,g){d&&!d[D]&&(d=H(d));e&&!e[D]&&(e=H(e,g));return f(function(f,g,k,l){var n,m,u=[],p=[],w=g.length,t;if(!(t=f)){t=b||"*";for(var q=k.nodeType?[k]:k,r=[],ca=0,v=q.length;ca<v;ca++)h(t,q[ca],r);t=r}t=!a||!f&&b?t:B(t,u,a,k,l);q=c?e||(f?a:w||d)?[]:g:t;c&&c(t,q,k,l);if(d)for(n=B(q,p),d(n,[],k,l),k=n.length;k--;)if(m=n[k])q[p[k]]=!(t[p[k]]=m);if(f){if(e||a){if(e){n=[];for(k=q.length;k--;)(m=
90
+ q[k])&&n.push(t[k]=m);e(null,q=[],n,l)}for(k=q.length;k--;)(m=q[k])&&-1<(n=e?R.call(f,m):u[k])&&(f[n]=!(g[n]=m))}}else q=B(q===g?q.splice(w,q.length):q),e?e(null,g,q,l):F.apply(g,q)})}function z(a){var b,c,d,e=a.length,f=w.relative[a[0].type];c=f||w.relative[" "];for(var g=f?1:0,h=r(function(a){return a===b},c,!0),k=r(function(a){return-1<R.call(b,a)},c,!0),l=[function(a,c,d){return!f&&(d||c!==ua)||((b=c).nodeType?h(a,c,d):k(a,c,d))}];g<e;g++)if(c=w.relative[a[g].type])l=[r(A(l),c)];else{c=w.filter[a[g].type].apply(null,
91
+ a[g].matches);if(c[D]){for(d=++g;d<e&&!w.relative[a[d].type];d++);return H(1<g&&A(l),1<g&&p(a.slice(0,g-1)).replace(Q,"$1"),c,g<d&&z(a.slice(g,d)),d<e&&z(a=a.slice(d)),d<e&&p(a))}l.push(c)}return A(l)}function O(a,b){var c=0,d=0<b.length,e=0<a.length,g=function(f,g,k,l,n){var m,u,p=[],q=0,t="0",r=f&&[],ca=null!=n,x=ua,y=f||e&&w.find.TAG("*",n&&g.parentNode||g),ta=N+=null==x?1:Math.random()||.1;ca&&(ua=g!==E&&g,v=c);for(;null!=(n=y[t]);t++){if(e&&n){for(m=0;u=a[m++];)if(u(n,g,k)){l.push(n);break}ca&&
92
+ (N=ta,v=++c)}d&&((n=!u&&n)&&q--,f&&r.push(n))}q+=t;if(d&&t!==q){for(m=0;u=b[m++];)u(r,p,g,k);if(f){if(0<q)for(;t--;)r[t]||p[t]||(p[t]=Z.call(l));p=B(p)}F.apply(l,p);ca&&!f&&0<p.length&&1<q+b.length&&h.uniqueSort(l)}ca&&(N=ta,ua=x);return r};return d?f(g):g}function M(){}var qa,v,w,va,ta,L,ra,ua,J,E,y,P,K,G,wa,sa,Ma,D="sizzle"+-new Date,ja=a.document,x={},N=0,W=0,S=e(),T=e(),U=e(),aa=typeof b,C=[],Z=C.pop,F=C.push,I=C.slice,R=C.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]===a)return b;
93
+ return-1},C="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w#"),Y="\\[[\\x20\\t\\r\\n\\f]*((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)[\\x20\\t\\r\\n\\f]*(?:([*^$|!~]?=)[\\x20\\t\\r\\n\\f]*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+C+")|)|)[\\x20\\t\\r\\n\\f]*\\]",V=":((?:\\\\.|[\\w-]|[^\\x00-\\xa0])+)(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+Y.replace(3,8)+")*)|.*)\\)|)",Q=RegExp("^[\\x20\\t\\r\\n\\f]+|((?:^|[^\\\\])(?:\\\\.)*)[\\x20\\t\\r\\n\\f]+$","g"),fa=/^[\x20\t\r\n\f]*,[\x20\t\r\n\f]*/,
94
+ ga=/^[\x20\t\r\n\f]*([\x20\t\r\n\f>+~])[\x20\t\r\n\f]*/,ha=new RegExp(V),ia=new RegExp("^"+C+"$"),X={ID:/^#((?:\\.|[\w-]|[^\x00-\xa0])+)/,CLASS:/^\.((?:\\.|[\w-]|[^\x00-\xa0])+)/,NAME:/^\[name=['"]?((?:\\.|[\w-]|[^\x00-\xa0])+)['"]?\]/,TAG:new RegExp("^("+"(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+".replace("w","w*")+")"),ATTR:new RegExp("^"+Y),PSEUDO:new RegExp("^"+V),CHILD:/^:(only|first|last|nth|nth-last)-(child|of-type)(?:\([\x20\t\r\n\f]*(even|odd|(([+-]|)(\d*)n|)[\x20\t\r\n\f]*(?:([+-]|)[\x20\t\r\n\f]*(\d+)|))[\x20\t\r\n\f]*\)|)/i,
95
+ needsContext:/^[\x20\t\r\n\f]*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\([\x20\t\r\n\f]*((?:-\d)?\d*)[\x20\t\r\n\f]*\)|)(?=[^-]|$)/i},ba=/[\x20\t\r\n\f]*[+~]/,ka=/^[^{]+\{\s*\[native code/,la=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ma=/^(?:input|select|textarea|button)$/i,na=/^h\d$/i,oa=/'|\\/g,pa=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,da=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,ea=function(a,b){var c="0x"+b-65536;return c!==c?b:0>c?String.fromCharCode(c+65536):String.fromCharCode(c>>10|55296,
96
+ c&1023|56320)};try{I.call(ja.documentElement.childNodes,0)[0].nodeType}catch(Sc){I=function(a){for(var b,c=[];b=this[a++];)c.push(b);return c}}ta=h.isXML=function(a){return(a=a&&(a.ownerDocument||a).documentElement)?"HTML"!==a.nodeName:!1};J=h.setDocument=function(a){var c=a?a.ownerDocument||a:ja;if(c===E||9!==c.nodeType||!c.documentElement)return E;E=c;y=c.documentElement;P=ta(c);x.tagNameNoComments=g(function(a){a.appendChild(c.createComment(""));return!a.getElementsByTagName("*").length});x.attributes=
97
+ g(function(a){a.innerHTML="<select></select>";a=typeof a.lastChild.getAttribute("multiple");return"boolean"!==a&&"string"!==a});x.getByClassName=g(function(a){a.innerHTML="<div class='hidden e'></div><div class='hidden'></div>";if(!a.getElementsByClassName||!a.getElementsByClassName("e").length)return!1;a.lastChild.className="e";return 2===a.getElementsByClassName("e").length});x.getByName=g(function(a){a.id=D+0;a.innerHTML="<a name='"+D+"'></a><div name='"+D+"'></div>";y.insertBefore(a,y.firstChild);
98
+ var b=c.getElementsByName&&c.getElementsByName(D).length===2+c.getElementsByName(D+0).length;x.getIdNotName=!c.getElementById(D);y.removeChild(a);return b});w.attrHandle=g(function(a){a.innerHTML="<a href='#'></a>";return a.firstChild&&typeof a.firstChild.getAttribute!==aa&&"#"===a.firstChild.getAttribute("href")})?{}:{href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}};x.getIdNotName?(w.find.ID=function(a,b){if(typeof b.getElementById!==aa&&!P){var c=
99
+ b.getElementById(a);return c&&c.parentNode?[c]:[]}},w.filter.ID=function(a){var b=a.replace(da,ea);return function(a){return a.getAttribute("id")===b}}):(w.find.ID=function(a,c){if(typeof c.getElementById!==aa&&!P){var d=c.getElementById(a);return d?d.id===a||typeof d.getAttributeNode!==aa&&d.getAttributeNode("id").value===a?[d]:b:[]}},w.filter.ID=function(a){var b=a.replace(da,ea);return function(a){return(a=typeof a.getAttributeNode!==aa&&a.getAttributeNode("id"))&&a.value===b}});w.find.TAG=x.tagNameNoComments?
100
+ function(a,b){if(typeof b.getElementsByTagName!==aa)return b.getElementsByTagName(a)}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){for(;c=f[e++];)1===c.nodeType&&d.push(c);return d}return f};w.find.NAME=x.getByName&&function(a,b){if(typeof b.getElementsByName!==aa)return b.getElementsByName(name)};w.find.CLASS=x.getByClassName&&function(a,b){if(typeof b.getElementsByClassName!==aa&&!P)return b.getElementsByClassName(a)};G=[];K=[":focus"];if(x.qsa=d(c.querySelectorAll))g(function(a){a.innerHTML=
101
+ "<select><option selected=''></option></select>";a.querySelectorAll("[selected]").length||K.push("\\[[\\x20\\t\\r\\n\\f]*(?:checked|disabled|ismap|multiple|readonly|selected|value)");a.querySelectorAll(":checked").length||K.push(":checked")}),g(function(a){a.innerHTML="<input type='hidden' i=''/>";a.querySelectorAll("[i^='']").length&&K.push("[*^$]=[\\x20\\t\\r\\n\\f]*(?:\"\"|'')");a.querySelectorAll(":enabled").length||K.push(":enabled",":disabled");a.querySelectorAll("*,:x");K.push(",.*:")});(x.matchesSelector=
102
+ d(wa=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector))&&g(function(a){x.disconnectedMatch=wa.call(a,"div");wa.call(a,"[s!='']:x");G.push("!=",V)});K=new RegExp(K.join("|"));G=new RegExp(G.join("|"));sa=d(y.contains)||y.compareDocumentPosition?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!!(d&&1===d.nodeType&&(c.contains?c.contains(d):a.compareDocumentPosition&&a.compareDocumentPosition(d)&16))}:function(a,
103
+ b){if(b)for(;b=b.parentNode;)if(b===a)return!0;return!1};Ma=y.compareDocumentPosition?function(a,b){var d;return a===b?(ra=!0,0):(d=b.compareDocumentPosition&&a.compareDocumentPosition&&a.compareDocumentPosition(b))?d&1||a.parentNode&&11===a.parentNode.nodeType?a===c||sa(ja,a)?-1:b===c||sa(ja,b)?1:0:d&4?-1:1:a.compareDocumentPosition?-1:1}:function(a,b){var d,e=0;d=a.parentNode;var f=b.parentNode,g=[a],h=[b];if(a===b)return ra=!0,0;if(!d||!f)return a===c?-1:b===c?1:d?-1:f?1:0;if(d===f)return k(a,
104
+ b);for(d=a;d=d.parentNode;)g.unshift(d);for(d=b;d=d.parentNode;)h.unshift(d);for(;g[e]===h[e];)e++;return e?k(g[e],h[e]):g[e]===ja?-1:h[e]===ja?1:0};ra=!1;[0,0].sort(Ma);x.detectDuplicates=ra;return E};h.matches=function(a,b){return h(a,null,null,b)};h.matchesSelector=function(a,b){(a.ownerDocument||a)!==E&&J(a);b=b.replace(pa,"='$1']");if(!(!x.matchesSelector||P||G&&G.test(b)||K.test(b)))try{var c=wa.call(a,b);if(c||x.disconnectedMatch||a.document&&11!==a.document.nodeType)return c}catch(d){}return 0<
105
+ h(b,E,null,[a]).length};h.contains=function(a,b){(a.ownerDocument||a)!==E&&J(a);return sa(a,b)};h.attr=function(a,b){var c;(a.ownerDocument||a)!==E&&J(a);P||(b=b.toLowerCase());return(c=w.attrHandle[b])?c(a):P||x.attributes?a.getAttribute(b):((c=a.getAttributeNode(b))||a.getAttribute(b))&&!0===a[b]?b:c&&c.specified?c.value:null};h.error=function(a){throw Error("Syntax error, unrecognized expression: "+a);};h.uniqueSort=function(a){var b,c=[],d=1,e=0;ra=!x.detectDuplicates;a.sort(Ma);if(ra){for(;b=
106
+ a[d];d++)b===a[d-1]&&(e=c.push(d));for(;e--;)a.splice(c[e],1)}return a};va=h.getText=function(a){var b,c="",d=0;b=a.nodeType;if(!b)for(;b=a[d];d++)c+=va(b);else if(1===b||9===b||11===b){if("string"===typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=va(a)}else if(3===b||4===b)return a.nodeValue;return c};w=h.selectors={cacheLength:50,createPseudo:f,match:X,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},
107
+ "~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){a[1]=a[1].replace(da,ea);a[3]=(a[4]||a[5]||"").replace(da,ea);"~="===a[2]&&(a[3]=" "+a[3]+" ");return a.slice(0,4)},CHILD:function(a){a[1]=a[1].toLowerCase();"nth"===a[1].slice(0,3)?(a[3]||h.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&h.error(a[0]);return a},PSEUDO:function(a){var b,c=!a[5]&&a[2];if(X.CHILD.test(a[0]))return null;a[4]?a[2]=a[4]:c&&ha.test(c)&&(b=n(c,!0))&&(b=
108
+ c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b));return a.slice(0,3)}},filter:{TAG:function(a){if("*"===a)return function(){return!0};a=a.replace(da,ea).toLowerCase();return function(b){return b.nodeName&&b.nodeName.toLowerCase()===a}},CLASS:function(a){var b=S[a+" "];return b||(b=new RegExp("(^|[\\x20\\t\\r\\n\\f])"+a+"([\\x20\\t\\r\\n\\f]|$)"))&&S(a,function(a){return b.test(a.className||typeof a.getAttribute!==aa&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){d=
109
+ h.attr(d,a);if(null==d)return"!="===b;if(!b)return!0;d+="";return"="===b?d===c:"!="===b?d!==c:"^="===b?c&&0===d.indexOf(c):"*="===b?c&&-1<d.indexOf(c):"$="===b?c&&d.slice(-c.length)===c:"~="===b?-1<(" "+d+" ").indexOf(c):"|="===b?d===c||d.slice(0,c.length+1)===c+"-":!1}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,k){var l,n,m,u,p;c=f!==g?"nextSibling":"previousSibling";var q=b.parentNode,
110
+ t=h&&b.nodeName.toLowerCase();k=!k&&!h;if(q){if(f){for(;c;){for(n=b;n=n[c];)if(h?n.nodeName.toLowerCase()===t:1===n.nodeType)return!1;p=c="only"===a&&!p&&"nextSibling"}return!0}p=[g?q.firstChild:q.lastChild];if(g&&k)for(k=q[D]||(q[D]={}),l=k[a]||[],u=l[0]===N&&l[1],m=l[0]===N&&l[2],n=u&&q.childNodes[u];n=++u&&n&&n[c]||(m=u=0)||p.pop();){if(1===n.nodeType&&++m&&n===b){k[a]=[N,u,m];break}}else if(k&&(l=(b[D]||(b[D]={}))[a])&&l[0]===N)m=l[1];else for(;(n=++u&&n&&n[c]||(m=u=0)||p.pop())&&((h?n.nodeName.toLowerCase()!==
111
+ t:1!==n.nodeType)||!++m||(k&&((n[D]||(n[D]={}))[a]=[N,m]),n!==b)););m-=e;return m===d||0===m%d&&0<=m/d}}},PSEUDO:function(a,b){var c,d=w.pseudos[a]||w.setFilters[a.toLowerCase()]||h.error("unsupported pseudo: "+a);return d[D]?d(b):1<d.length?(c=[a,a,"",b],w.setFilters.hasOwnProperty(a.toLowerCase())?f(function(a,c){for(var e,f=d(a,b),g=f.length;g--;)e=R.call(a,f[g]),a[e]=!(c[e]=f[g])}):function(a){return d(a,0,c)}):d}},pseudos:{not:f(function(a){var b=[],c=[],d=L(a.replace(Q,"$1"));return d[D]?f(function(a,
112
+ b,c,e){e=d(a,null,e,[]);for(var f=a.length;f--;)if(c=e[f])a[f]=!(b[f]=c)}):function(a,e,f){b[0]=a;d(b,null,f,c);return!c.pop()}}),has:f(function(a){return function(b){return 0<h(a,b).length}}),contains:f(function(a){return function(b){return-1<(b.textContent||b.innerText||va(b)).indexOf(a)}}),lang:f(function(a){ia.test(a||"")||h.error("unsupported lang: "+a);a=a.replace(da,ea).toLowerCase();return function(b){var c;do if(c=P?b.getAttribute("xml:lang")||b.getAttribute("lang"):b.lang)return c=c.toLowerCase(),
113
+ c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===y},focus:function(a){return a===E.activeElement&&(!E.hasFocus||E.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return!1===a.disabled},disabled:function(a){return!0===a.disabled},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){a.parentNode&&
114
+ a.parentNode.selectedIndex;return!0===a.selected},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if("@"<a.nodeName||3===a.nodeType||4===a.nodeType)return!1;return!0},parent:function(a){return!w.pseudos.empty(a)},header:function(a){return na.test(a.nodeName)},input:function(a){return ma.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==
115
+ (b=a.getAttribute("type"))||b.toLowerCase()===a.type)},first:m(function(){return[0]}),last:m(function(a,b){return[b-1]}),eq:m(function(a,b,c){return[0>c?c+b:c]}),even:m(function(a,b){for(var c=0;c<b;c+=2)a.push(c);return a}),odd:m(function(a,b){for(var c=1;c<b;c+=2)a.push(c);return a}),lt:m(function(a,b,c){for(b=0>c?c+b:c;0<=--b;)a.push(b);return a}),gt:m(function(a,b,c){for(c=0>c?c+b:c;++c<b;)a.push(c);return a})}};for(qa in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})w.pseudos[qa]=l(qa);
116
+ for(qa in{submit:!0,reset:!0})w.pseudos[qa]=u(qa);L=h.compile=function(a,b){var c,d=[],e=[],f=U[a+" "];if(!f){b||(b=n(a));for(c=b.length;c--;)f=z(b[c]),f[D]?d.push(f):e.push(f);f=U(a,O(e,d))}return f};w.pseudos.nth=w.pseudos.eq;w.filters=M.prototype=w.pseudos;w.setFilters=new M;J();h.attr=c.attr;c.find=h;c.expr=h.selectors;c.expr[":"]=c.expr.pseudos;c.unique=h.uniqueSort;c.text=h.getText;c.isXMLDoc=h.isXML;c.contains=h.contains})(r);var uc=/Until$/,vc=/^(?:parents|prev(?:Until|All))/,Ub=/^.[^:#\[\.,]*$/,
117
+ Cb=c.expr.match.needsContext,wc={children:!0,contents:!0,next:!0,prev:!0};c.fn.extend({find:function(a){var b,d,e,f=this.length;if("string"!==typeof a)return e=this,this.pushStack(c(a).filter(function(){for(b=0;b<f;b++)if(c.contains(e[b],this))return!0}));d=[];for(b=0;b<f;b++)c.find(a,this[b],d);d=this.pushStack(1<f?c.unique(d):d);d.selector=(this.selector?this.selector+" ":"")+a;return d},has:function(a){var b,d=c(a,this),e=d.length;return this.filter(function(){for(b=0;b<e;b++)if(c.contains(this,
118
+ d[b]))return!0})},not:function(a){return this.pushStack(Za(this,a,!1))},filter:function(a){return this.pushStack(Za(this,a,!0))},is:function(a){return!!a&&("string"===typeof a?Cb.test(a)?0<=c(a,this.context).index(this[0]):0<c.filter(a,this).length:0<this.filter(a).length)},closest:function(a,b){for(var d,e=0,f=this.length,g=[],h=Cb.test(a)||"string"!==typeof a?c(a,b||this.context):0;e<f;e++)for(d=this[e];d&&d.ownerDocument&&d!==b&&11!==d.nodeType;){if(h?-1<h.index(d):c.find.matchesSelector(d,a)){g.push(d);
119
+ break}d=d.parentNode}return this.pushStack(1<g.length?c.unique(g):g)},index:function(a){return a?"string"===typeof a?c.inArray(this[0],c(a)):c.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){var d="string"===typeof a?c(a,b):c.makeArray(a&&a.nodeType?[a]:a),d=c.merge(this.get(),d);return this.pushStack(c.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});c.fn.andSelf=c.fn.addBack;c.each({parent:function(a){return(a=
120
+ a.parentNode)&&11!==a.nodeType?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return Ya(a,"nextSibling")},prev:function(a){return Ya(a,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling((a.parentNode||
121
+ {}).firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.merge([],a.childNodes)}},function(a,b){c.fn[a]=function(d,e){var f=c.map(this,b,d);uc.test(a)||(e=d);e&&"string"===typeof e&&(f=c.filter(e,f));f=1<this.length&&!wc[a]?c.unique(f):f;1<this.length&&vc.test(a)&&(f=f.reverse());return this.pushStack(f)}});c.extend({filter:function(a,b,d){d&&(a=":not("+a+")");return 1===b.length?c.find.matchesSelector(b[0],
122
+ a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&9!==a.nodeType&&(d===m||1!==a.nodeType||!c(a).is(d));)1===a.nodeType&&e.push(a),a=a[b];return e},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var ab="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",xc=/ jQuery\d+="(?:null|\d+)"/g,Db=new RegExp("<(?:"+ab+")[\\s/>]",
123
+ "i"),Na=/^\s+/,Eb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Fb=/<([\w:]+)/,Gb=/<tbody/i,yc=/<|&#?\w+;/,zc=/<(?:script|style|link)/i,Ba=/^(?:checkbox|radio)$/i,Ac=/checked\s*(?:[^=]|=\s*.checked.)/i,Hb=/^$|\/(?:java|ecma)script/i,Wb=/^true\/(.*)/,Bc=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,H={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],
124
+ tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:c.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},Oa=$a(p).appendChild(p.createElement("div"));H.optgroup=H.option;H.tbody=H.tfoot=H.colgroup=H.caption=H.thead;H.th=H.td;c.fn.extend({text:function(a){return c.access(this,function(a){return a===m?c.text(this):this.empty().append((this[0]&&this[0].ownerDocument||p).createTextNode(a))},
125
+ null,a,arguments.length)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapAll(a.call(this,b))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return c.isFunction(a)?this.each(function(b){c(this).wrapInner(a.call(this,b))}):this.each(function(){var b=c(this),d=b.contents();
126
+ d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){var b=c.isFunction(a);return this.each(function(d){c(this).wrapAll(b?a.call(this,d):a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){1!==this.nodeType&&11!==
127
+ this.nodeType&&9!==this.nodeType||this.insertBefore(a,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,!1,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var d,e=0;null!=(d=this[e]);e++)if(!a||0<c.filter(a,[d]).length)b||1!==d.nodeType||c.cleanData(B(d)),d.parentNode&&(b&&c.contains(d.ownerDocument,d)&&
128
+ Aa(B(d,"script")),d.parentNode.removeChild(d));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){for(1===a.nodeType&&c.cleanData(B(a,!1));a.firstChild;)a.removeChild(a.firstChild);a.options&&c.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){a=null==a?!1:a;b=null==b?a:b;return this.map(function(){return c.clone(this,a,b)})},html:function(a){return c.access(this,function(a){var d=this[0]||{},e=0,f=this.length;if(a===m)return 1===d.nodeType?d.innerHTML.replace(xc,
129
+ ""):m;if(!("string"!==typeof a||zc.test(a)||!c.support.htmlSerialize&&Db.test(a)||!c.support.leadingWhitespace&&Na.test(a)||H[(Fb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(Eb,"<$1></$2>");try{for(;e<f;e++)d=this[e]||{},1===d.nodeType&&(c.cleanData(B(d,!1)),d.innerHTML=a);d=0}catch(g){}}d&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){c.isFunction(a)||"string"===typeof a||(a=c(a).not(this).detach());return this.domManip([a],!0,function(a){var d=this.nextSibling,
130
+ e=this.parentNode;e&&(c(this).remove(),e.insertBefore(a,d))})},detach:function(a){return this.remove(a,!0)},domManip:function(a,b,d){a=ub.apply([],a);var e,f,g,h,k=0,l=this.length,u=this,p=l-1,n=a[0],q=c.isFunction(n);if(q||!(1>=l||"string"!==typeof n||c.support.checkClone)&&Ac.test(n))return this.each(function(c){var e=u.eq(c);q&&(a[0]=n.call(this,c,b?e.html():m));e.domManip(a,b,d)});if(l&&(h=c.buildFragment(a,this[0].ownerDocument,!1,this),e=h.firstChild,1===h.childNodes.length&&(h=e),e)){b=b&&
131
+ c.nodeName(e,"tr");g=c.map(B(h,"script"),bb);for(f=g.length;k<l;k++)e=h,k!==p&&(e=c.clone(e,!0,!0),f&&c.merge(g,B(e,"script"))),d.call(b&&c.nodeName(this[k],"table")?Vb(this[k],"tbody"):this[k],e,k);if(f)for(h=g[g.length-1].ownerDocument,c.map(g,cb),k=0;k<f;k++)e=g[k],Hb.test(e.type||"")&&!c._data(e,"globalEval")&&c.contains(h,e)&&(e.src?c.ajax({url:e.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):c.globalEval((e.text||e.textContent||e.innerHTML||"").replace(Bc,"")));h=e=null}return this}});
132
+ c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(a){for(var e=0,f=[],g=c(a),h=g.length-1;e<=h;e++)a=e===h?this:this.clone(!0),c(g[e])[b](a),Fa.apply(f,a.get());return this.pushStack(f)}});c.extend({clone:function(a,b,d){var e,f,g,h,k,l=c.contains(a.ownerDocument,a);c.support.html5Clone||c.isXMLDoc(a)||!Db.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(Oa.innerHTML=a.outerHTML,Oa.removeChild(g=Oa.firstChild));
133
+ if(!(c.support.noCloneEvent&&c.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||c.isXMLDoc(a)))for(e=B(g),k=B(a),h=0;null!=(f=k[h]);++h)if(e[h]){var m=e[h],p=void 0,n=void 0,q=void 0;if(1===m.nodeType){p=m.nodeName.toLowerCase();if(!c.support.noCloneEvent&&m[c.expando]){q=c._data(m);for(n in q.events)c.removeEvent(m,n,q.handle);m.removeAttribute(c.expando)}if("script"===p&&m.text!==f.text)bb(m).text=f.text,cb(m);else if("object"===p)m.parentNode&&(m.outerHTML=f.outerHTML),c.support.html5Clone&&
134
+ f.innerHTML&&!c.trim(m.innerHTML)&&(m.innerHTML=f.innerHTML);else if("input"===p&&Ba.test(f.type))m.defaultChecked=m.checked=f.checked,m.value!==f.value&&(m.value=f.value);else if("option"===p)m.defaultSelected=m.selected=f.defaultSelected;else if("input"===p||"textarea"===p)m.defaultValue=f.defaultValue}}if(b)if(d)for(k=k||B(a),e=e||B(g),h=0;null!=(f=k[h]);h++)db(f,e[h]);else db(a,g);e=B(g,"script");0<e.length&&Aa(e,!l&&B(a,"script"));return g},buildFragment:function(a,b,d,e){for(var f,g,h,k,l,m,
135
+ p=a.length,n=$a(b),q=[],r=0;r<p;r++)if((g=a[r])||0===g)if("object"===c.type(g))c.merge(q,g.nodeType?[g]:g);else if(yc.test(g)){h=h||n.appendChild(b.createElement("div"));k=(Fb.exec(g)||["",""])[1].toLowerCase();m=H[k]||H._default;h.innerHTML=m[1]+g.replace(Eb,"<$1></$2>")+m[2];for(f=m[0];f--;)h=h.lastChild;!c.support.leadingWhitespace&&Na.test(g)&&q.push(b.createTextNode(Na.exec(g)[0]));if(!c.support.tbody)for(f=(g="table"!==k||Gb.test(g)?"<table>"!==m[1]||Gb.test(g)?0:h:h.firstChild)&&g.childNodes.length;f--;)c.nodeName(l=
136
+ g.childNodes[f],"tbody")&&!l.childNodes.length&&g.removeChild(l);c.merge(q,h.childNodes);for(h.textContent="";h.firstChild;)h.removeChild(h.firstChild);h=n.lastChild}else q.push(b.createTextNode(g));h&&n.removeChild(h);c.support.appendChecked||c.grep(B(q,"input"),Xb);for(r=0;g=q[r++];)if(!e||-1===c.inArray(g,e))if(a=c.contains(g.ownerDocument,g),h=B(n.appendChild(g),"script"),a&&Aa(h),d)for(f=0;g=h[f++];)Hb.test(g.type||"")&&d.push(g);return n},cleanData:function(a,b){for(var d,e,f,g,h=0,k=c.expando,
137
+ l=c.cache,m=c.support.deleteExpando,p=c.event.special;null!=(d=a[h]);h++)if(b||c.acceptData(d))if(g=(f=d[k])&&l[f]){if(g.events)for(e in g.events)p[e]?c.event.remove(d,e):c.removeEvent(d,e,g.handle);l[f]&&(delete l[f],m?delete d[k]:typeof d.removeAttribute!==z?d.removeAttribute(k):d[k]=null,I.push(f))}}});var ga,T,U,Pa=/alpha\([^)]*\)/i,Cc=/opacity\s*=\s*([^)]*)/,Dc=/^(top|right|bottom|left)$/,Ec=/^(none|table(?!-c[ea]).+)/,Ib=/^margin/,Yb=new RegExp("^("+pa+")(.*)$","i"),ka=new RegExp("^("+pa+")(?!px)[a-z%]+$",
138
+ "i"),Fc=new RegExp("^([+-])=("+pa+")","i"),lb={BODY:"block"},Gc={position:"absolute",visibility:"hidden",display:"block"},Jb={letterSpacing:0,fontWeight:400},S=["Top","Right","Bottom","Left"],fb=["Webkit","O","Moz","ms"];c.fn.extend({css:function(a,b){return c.access(this,function(a,b,f){var g,h={},k=0;if(c.isArray(b)){g=T(a);for(f=b.length;k<f;k++)h[b[k]]=c.css(a,b[k],!1,g);return h}return f!==m?c.style(a,b,f):c.css(a,b)},a,b,1<arguments.length)},show:function(){return gb(this,!0)},hide:function(){return gb(this)},
139
+ toggle:function(a){var b="boolean"===typeof a;return this.each(function(){(b?a:fa(this))?c(this).show():c(this).hide()})}});c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=U(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,k=c.camelCase(b),
140
+ l=a.style;b=c.cssProps[k]||(c.cssProps[k]=eb(l,k));h=c.cssHooks[b]||c.cssHooks[k];if(d!==m){if(g=typeof d,"string"===g&&(f=Fc.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat(c.css(a,b)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||c.cssNumber[k]||(d+="px"),c.support.clearCloneStyle||""!==d||0!==b.indexOf("background")||(l[b]="inherit"),h&&"set"in h&&(d=h.set(a,d,e))===m)))try{l[b]=d}catch(p){}}else return h&&"get"in h&&(f=h.get(a,!1,e))!==m?f:l[b]}},css:function(a,b,d,e){var f,g;g=c.camelCase(b);
141
+ b=c.cssProps[g]||(c.cssProps[g]=eb(a.style,g));(g=c.cssHooks[b]||c.cssHooks[g])&&"get"in g&&(f=g.get(a,!0,d));f===m&&(f=U(a,b,e));"normal"===f&&b in Jb&&(f=Jb[b]);return""===d||d?(a=parseFloat(f),!0===d||c.isNumeric(a)?a||0:f):f},swap:function(a,b,c,e){var f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];c=c.apply(a,e||[]);for(f in b)a.style[f]=g[f];return c}});r.getComputedStyle?(T=function(a){return r.getComputedStyle(a,null)},U=function(a,b,d){var e,f=(d=d||T(a))?d.getPropertyValue(b)||d[b]:m,
142
+ g=a.style;d&&(""!==f||c.contains(a.ownerDocument,a)||(f=c.style(a,b)),ka.test(f)&&Ib.test(b)&&(a=g.width,b=g.minWidth,e=g.maxWidth,g.minWidth=g.maxWidth=g.width=f,f=d.width,g.width=a,g.minWidth=b,g.maxWidth=e));return f}):p.documentElement.currentStyle&&(T=function(a){return a.currentStyle},U=function(a,b,c){var e,f,g=(c=c||T(a))?c[b]:m,h=a.style;null==g&&h&&h[b]&&(g=h[b]);if(ka.test(g)&&!Dc.test(b)){c=h.left;if(f=(e=a.runtimeStyle)&&e.left)e.left=a.currentStyle.left;h.left="fontSize"===b?"1em":g;
143
+ g=h.pixelLeft+"px";h.left=c;f&&(e.left=f)}return""===g?"auto":g});c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(a,e,f){if(e)return 0===a.offsetWidth&&Ec.test(c.css(a,"display"))?c.swap(a,Gc,function(){return kb(a,b,f)}):kb(a,b,f)},set:function(a,e,f){var g=f&&T(a);return ib(a,e,f?jb(a,b,f,c.support.boxSizing&&"border-box"===c.css(a,"boxSizing",!1,g),g):0)}}});c.support.opacity||(c.cssHooks.opacity={get:function(a,b){return Cc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||
144
+ "")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var d=a.style,e=a.currentStyle,f=c.isNumeric(b)?"alpha(opacity="+100*b+")":"",g=e&&e.filter||d.filter||"";d.zoom=1;if((1<=b||""===b)&&""===c.trim(g.replace(Pa,""))&&d.removeAttribute&&(d.removeAttribute("filter"),""===b||e&&!e.filter))return;d.filter=Pa.test(g)?g.replace(Pa,f):g+" "+f}});c(function(){c.support.reliableMarginRight||(c.cssHooks.marginRight={get:function(a,b){if(b)return c.swap(a,{display:"inline-block"},U,[a,"marginRight"])}});
145
+ !c.support.pixelPosition&&c.fn.position&&c.each(["top","left"],function(a,b){c.cssHooks[b]={get:function(a,e){if(e)return e=U(a,b),ka.test(e)?c(a).position()[b]+"px":e}}})});c.expr&&c.expr.filters&&(c.expr.filters.hidden=function(a){return 0>=a.offsetWidth&&0>=a.offsetHeight||!c.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||c.css(a,"display"))},c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)});c.each({margin:"",padding:"",border:"Width"},function(a,b){c.cssHooks[a+
146
+ b]={expand:function(c){var e=0,f={};for(c="string"===typeof c?c.split(" "):[c];4>e;e++)f[a+S[e]+b]=c[e]||c[e-2]||c[0];return f}};Ib.test(a)||(c.cssHooks[a+b].set=ib)});var Hc=/%20/g,Zb=/\[\]$/,Kb=/\r?\n/g,Ic=/^(?:submit|button|image|reset|file)$/i,Jc=/^(?:input|select|textarea|keygen)/i;c.fn.extend({serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=c.prop(this,"elements");return a?c.makeArray(a):this}).filter(function(){var a=this.type;
147
+ return this.name&&!c(this).is(":disabled")&&Jc.test(this.nodeName)&&!Ic.test(a)&&(this.checked||!Ba.test(a))}).map(function(a,b){var d=c(this).val();return null==d?null:c.isArray(d)?c.map(d,function(a){return{name:b.name,value:a.replace(Kb,"\r\n")}}):{name:b.name,value:d.replace(Kb,"\r\n")}}).get()}});c.param=function(a,b){var d,e=[],f=function(a,b){b=c.isFunction(b)?b():null==b?"":b;e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};b===m&&(b=c.ajaxSettings&&c.ajaxSettings.traditional);
148
+ if(c.isArray(a)||a.jquery&&!c.isPlainObject(a))c.each(a,function(){f(this.name,this.value)});else for(d in a)Ca(d,a[d],b,f);return e.join("&").replace(Hc,"+")};c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){c.fn[b]=function(a,c){return 0<arguments.length?this.on(b,null,a,c):this.trigger(b)}});c.fn.hover=function(a,
149
+ b){return this.mouseenter(a).mouseleave(b||a)};var F,W,Qa=c.now(),Ra=/\?/,Kc=/#.*$/,Lb=/([?&])_=[^&]*/,Lc=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,Mc=/^(?:GET|HEAD)$/,Nc=/^\/\//,Mb=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Nb=c.fn.load,Ob={},Da={},Pb="*/".concat("*");try{W=bc.href}catch(a){W=p.createElement("a"),W.href="",W=W.href}F=Mb.exec(W.toLowerCase())||[];c.fn.load=function(a,b,d){if("string"!==typeof a&&Nb)return Nb.apply(this,arguments);var e,f,g,h=this,k=a.indexOf(" ");0<=k&&(e=a.slice(k,a.length),
150
+ a=a.slice(0,k));c.isFunction(b)?(d=b,b=m):b&&"object"===typeof b&&(g="POST");0<h.length&&c.ajax({url:a,type:g,dataType:"html",data:b}).done(function(a){f=arguments;h.html(e?c("<div>").append(c.parseHTML(a)).find(e):a)}).complete(d&&function(a,b){h.each(d,f||[a.responseText,b,a])});return this};c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(a){return this.on(b,a)}});c.each(["get","post"],function(a,b){c[b]=function(a,e,f,g){c.isFunction(e)&&
151
+ (g=g||f,f=e,e=m);return c.ajax({url:a,type:b,dataType:g,data:e,success:f})}});c.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:W,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(F[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Pb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",
152
+ text:"responseText"},converters:{"* text":r.String,"text html":!0,"text json":c.parseJSON,"text xml":c.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ea(Ea(a,c.ajaxSettings),b):Ea(c.ajaxSettings,a)},ajaxPrefilter:nb(Ob),ajaxTransport:nb(Da),ajax:function(a,b){function d(a,b,d,e){var f,t,J,E,y=b;if(2!==M){M=2;k&&clearTimeout(k);p=m;h=e||"";v.readyState=0<a?4:0;if(d){E=n;e=v;var C,K,G,z,I=E.contents,F=E.dataTypes,D=E.responseFields;for(z in D)z in d&&(e[D[z]]=d[z]);for(;"*"===
153
+ F[0];)F.shift(),K===m&&(K=E.mimeType||e.getResponseHeader("Content-Type"));if(K)for(z in I)if(I[z]&&I[z].test(K)){F.unshift(z);break}if(F[0]in d)G=F[0];else{for(z in d){if(!F[0]||E.converters[z+" "+F[0]]){G=z;break}C||(C=z)}G=G||C}G?(G!==F[0]&&F.unshift(G),E=d[G]):E=void 0}if(200<=a&&300>a||304===a)if(n.ifModified&&((d=v.getResponseHeader("Last-Modified"))&&(c.lastModified[g]=d),(d=v.getResponseHeader("etag"))&&(c.etag[g]=d)),204===a)f=!0,y="nocontent";else if(304===a)f=!0,y="notmodified";else{a:{t=
154
+ n;J=E;var L,x,y={};C=0;K=t.dataTypes.slice();G=K[0];t.dataFilter&&(J=t.dataFilter(J,t.dataType));if(K[1])for(x in t.converters)y[x.toLowerCase()]=t.converters[x];for(;d=K[++C];)if("*"!==d){if("*"!==G&&G!==d){x=y[G+" "+d]||y["* "+d];if(!x)for(L in y)if(f=L.split(" "),f[1]===d&&(x=y[G+" "+f[0]]||y["* "+f[0]])){!0===x?x=y[L]:!0!==y[L]&&(d=f[0],K.splice(C--,0,d));break}if(!0!==x)if(x&&t["throws"])J=x(J);else try{J=x(J)}catch(N){f={state:"parsererror",error:x?N:"No conversion from "+G+" to "+d};break a}}G=
155
+ d}f={state:"success",data:J}}y=f.state;t=f.data;J=f.error;f=!J}else if(J=y,a||!y)y="error",0>a&&(a=0);v.status=a;v.statusText=(b||y)+"";f?A.resolveWith(q,[t,y,v]):A.rejectWith(q,[v,y,J]);v.statusCode(H);H=m;l&&r.trigger(f?"ajaxSuccess":"ajaxError",[v,n,f?t:J]);B.fireWith(q,[v,y]);l&&(r.trigger("ajaxComplete",[v,n]),--c.active||c.event.trigger("ajaxStop"))}}"object"===typeof a&&(b=a,a=m);b=b||{};var e,f,g,h,k,l,p,t,n=c.ajaxSetup({},b),q=n.context||n,r=n.context&&(q.nodeType||q.jquery)?c(q):c.event,
156
+ A=c.Deferred(),B=c.Callbacks("once memory"),H=n.statusCode||{},C={},z={},M=0,I="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===M){if(!t)for(t={};b=Lc.exec(h);)t[b[1].toLowerCase()]=b[2];b=t[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===M?h:null},setRequestHeader:function(a,b){var c=a.toLowerCase();M||(a=z[c]=z[c]||a,C[a]=b);return this},overrideMimeType:function(a){M||(n.mimeType=a);return this},statusCode:function(a){var b;if(a)if(2>M)for(b in a)H[b]=
157
+ [H[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){a=a||I;p&&p.abort(a);d(0,a);return this}};A.promise(v).complete=B.add;v.success=v.done;v.error=v.fail;n.url=((a||n.url||W)+"").replace(Kc,"").replace(Nc,F[1]+"//");n.type=b.method||b.type||n.method||n.type;n.dataTypes=c.trim(n.dataType||"*").toLowerCase().match(O)||[""];null==n.crossDomain&&(e=Mb.exec(n.url.toLowerCase()),n.crossDomain=!(!e||e[1]===F[1]&&e[2]===F[2]&&(e[3]||("http:"===e[1]?80:443))==(F[3]||("http:"===F[1]?80:443))));
158
+ n.data&&n.processData&&"string"!==typeof n.data&&(n.data=c.param(n.data,n.traditional));ob(Ob,n,b,v);if(2===M)return v;(l=n.global)&&0===c.active++&&c.event.trigger("ajaxStart");n.type=n.type.toUpperCase();n.hasContent=!Mc.test(n.type);g=n.url;n.hasContent||(n.data&&(g=n.url+=(Ra.test(g)?"&":"?")+n.data,delete n.data),!1===n.cache&&(n.url=Lb.test(g)?g.replace(Lb,"$1_="+Qa++):g+(Ra.test(g)?"&":"?")+"_="+Qa++));n.ifModified&&(c.lastModified[g]&&v.setRequestHeader("If-Modified-Since",c.lastModified[g]),
159
+ c.etag[g]&&v.setRequestHeader("If-None-Match",c.etag[g]));(n.data&&n.hasContent&&!1!==n.contentType||b.contentType)&&v.setRequestHeader("Content-Type",n.contentType);v.setRequestHeader("Accept",n.dataTypes[0]&&n.accepts[n.dataTypes[0]]?n.accepts[n.dataTypes[0]]+("*"!==n.dataTypes[0]?", "+Pb+"; q=0.01":""):n.accepts["*"]);for(f in n.headers)v.setRequestHeader(f,n.headers[f]);if(n.beforeSend&&(!1===n.beforeSend.call(q,v,n)||2===M))return v.abort();I="abort";for(f in{success:1,error:1,complete:1})v[f](n[f]);
160
+ if(p=ob(Da,n,b,v)){v.readyState=1;l&&r.trigger("ajaxSend",[v,n]);n.async&&0<n.timeout&&(k=setTimeout(function(){v.abort("timeout")},n.timeout));try{M=1,p.send(C,d)}catch(w){if(2>M)d(-1,w);else throw w;}}else d(-1,"No Transport");return v},getScript:function(a,b){return c.get(a,m,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")}});c.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},
161
+ converters:{"text script":function(a){c.globalEval(a);return a}}});c.ajaxPrefilter("script",function(a){a.cache===m&&(a.cache=!1);a.crossDomain&&(a.type="GET",a.global=!1)});c.ajaxTransport("script",function(a){if(a.crossDomain){var b,d=p.head||c("head")[0]||p.documentElement;return{send:function(c,f){b=p.createElement("script");b.async=!0;a.scriptCharset&&(b.charset=a.scriptCharset);b.src=a.url;b.onload=b.onreadystatechange=function(a,c){if(c||!b.readyState||/loaded|complete/.test(b.readyState))b.onload=
162
+ b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success")};d.insertBefore(b,d.firstChild)},abort:function(){if(b)b.onload(m,!0)}}}});var Qb=[],Sa=/(=)\?(?=&|$)|\?\?/;c.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Qb.pop()||c.expando+"_"+Qa++;this[a]=!0;return a}});c.ajaxPrefilter("json jsonp",function(a,b,d){var e,f,g,h=!1!==a.jsonp&&(Sa.test(a.url)?"url":"string"===typeof a.data&&!(a.contentType||"").indexOf("application/x-www-form-urlencoded")&&
163
+ Sa.test(a.data)&&"data");if(h||"jsonp"===a.dataTypes[0])return e=a.jsonpCallback=c.isFunction(a.jsonpCallback)?a.jsonpCallback():a.jsonpCallback,h?a[h]=a[h].replace(Sa,"$1"+e):!1!==a.jsonp&&(a.url+=(Ra.test(a.url)?"&":"?")+a.jsonp+"="+e),a.converters["script json"]=function(){g||c.error(e+" was not called");return g[0]},a.dataTypes[0]="json",f=r[e],r[e]=function(){g=arguments},d.always(function(){r[e]=f;a[e]&&(a.jsonpCallback=b.jsonpCallback,Qb.push(e));g&&c.isFunction(f)&&f(g[0]);g=f=m}),"script"});
164
+ var Q,X,Oc=0,Ta=r.ActiveXObject&&function(){for(var a in Q)Q[a](m,!0)};c.ajaxSettings.xhr=r.ActiveXObject?function(){var a;if(!(a=!this.isLocal&&pb()))a:{try{a=new r.ActiveXObject("Microsoft.XMLHTTP");break a}catch(b){}a=void 0}return a}:pb;X=c.ajaxSettings.xhr();c.support.cors=!!X&&"withCredentials"in X;(X=c.support.ajax=!!X)&&c.ajaxTransport(function(a){if(!a.crossDomain||c.support.cors){var b;return{send:function(d,e){var f,g,h=a.xhr();a.username?h.open(a.type,a.url,a.async,a.username,a.password):
165
+ h.open(a.type,a.url,a.async);if(a.xhrFields)for(g in a.xhrFields)h[g]=a.xhrFields[g];a.mimeType&&h.overrideMimeType&&h.overrideMimeType(a.mimeType);a.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");try{for(g in d)h.setRequestHeader(g,d[g])}catch(k){}h.send(a.hasContent&&a.data||null);b=function(d,g){var p,t,n,q;try{if(b&&(g||4===h.readyState))if(b=m,f&&(h.onreadystatechange=c.noop,Ta&&delete Q[f]),g)4!==h.readyState&&h.abort();else{q={};p=h.status;t=h.getAllResponseHeaders();
166
+ "string"===typeof h.responseText&&(q.text=h.responseText);try{n=h.statusText}catch(r){n=""}p||!a.isLocal||a.crossDomain?1223===p&&(p=204):p=q.text?200:404}}catch(r){g||e(-1,r)}q&&e(p,n,q,t)};a.async?4===h.readyState?setTimeout(b):(f=++Oc,Ta&&(Q||(Q={},c(r).unload(Ta)),Q[f]=b),h.onreadystatechange=b):b()},abort:function(){b&&b(m,!0)}}}});var Y,xa,Pc=/^(?:toggle|show|hide)$/,Qc=new RegExp("^(?:([+-])=|)("+pa+")([a-z%]*)$","i"),Rc=/queueHooks$/,la=[function(a,b,d){var e,f,g,h,k,l,m=this,p=a.style,n=
167
+ {},q=[],r=a.nodeType&&fa(a);d.queue||(k=c._queueHooks(a,"fx"),null==k.unqueued&&(k.unqueued=0,l=k.empty.fire,k.empty.fire=function(){k.unqueued||l()}),k.unqueued++,m.always(function(){m.always(function(){k.unqueued--;c.queue(a,"fx").length||k.empty.fire()})}));1===a.nodeType&&("height"in b||"width"in b)&&(d.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===c.css(a,"display")&&"none"===c.css(a,"float")&&(c.support.inlineBlockNeedsLayout&&"inline"!==hb(a.nodeName)?p.zoom=1:p.display="inline-block"));
168
+ d.overflow&&(p.overflow="hidden",c.support.shrinkWrapBlocks||m.always(function(){p.overflow=d.overflow[0];p.overflowX=d.overflow[1];p.overflowY=d.overflow[2]}));for(f in b)g=b[f],Pc.exec(g)&&(delete b[f],e=e||"toggle"===g,g!==(r?"hide":"show")&&q.push(f));if(b=q.length)for(g=c._data(a,"fxshow")||c._data(a,"fxshow",{}),("hidden"in g)&&(r=g.hidden),e&&(g.hidden=!r),r?c(a).show():m.done(function(){c(a).hide()}),m.done(function(){var b;c._removeData(a,"fxshow");for(b in n)c.style(a,b,n[b])}),f=0;f<b;f++)e=
169
+ q[f],h=m.createTween(e,r?g[e]:0),n[e]=g[e]||c.style(a,e),e in g||(g[e]=h.start,r&&(h.end=h.start,h.start="width"===e||"height"===e?1:0))}],ha={"*":[function(a,b){var d,e,f=this.createTween(a,b),g=Qc.exec(b),h=f.cur(),k=+h||0,l=1,m=20;if(g){d=+g[2];e=g[3]||(c.cssNumber[a]?"":"px");if("px"!==e&&k){k=c.css(f.elem,a,!0)||d||1;do l=l||".5",k/=l,c.style(f.elem,a,k+e);while(l!==(l=f.cur()/h)&&1!==l&&--m)}f.unit=e;f.start=k;f.end=g[1]?k+(g[1]+1)*d:d}return f}]};c.Animation=c.extend(rb,{tweener:function(a,
170
+ b){c.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var d,e=0,f=a.length;e<f;e++)d=a[e],ha[d]=ha[d]||[],ha[d].unshift(b)},prefilter:function(a,b){b?la.unshift(a):la.push(a)}});c.Tween=A;A.prototype={constructor:A,init:function(a,b,d,e,f,g){this.elem=a;this.prop=d;this.easing=f||"swing";this.options=b;this.start=this.now=this.cur();this.end=e;this.unit=g||(c.cssNumber[d]?"":"px")},cur:function(){var a=A.propHooks[this.prop];return a&&a.get?a.get(this):A.propHooks._default.get(this)},run:function(a){var b,
171
+ d=A.propHooks[this.prop];this.pos=this.options.duration?b=c.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):b=a;this.now=(this.end-this.start)*b+this.start;this.options.step&&this.options.step.call(this.elem,this.now,this);d&&d.set?d.set(this):A.propHooks._default.set(this);return this}};A.prototype.init.prototype=A.prototype;A.propHooks={_default:{get:function(a){return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(a=c.css(a.elem,a.prop,""))&&"auto"!==a?
172
+ a:0:a.elem[a.prop]},set:function(a){if(c.fx.step[a.prop])c.fx.step[a.prop](a);else a.elem.style&&(null!=a.elem.style[c.cssProps[a.prop]]||c.cssHooks[a.prop])?c.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}};A.propHooks.scrollTop=A.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}};c.each(["toggle","show","hide"],function(a,b){var d=c.fn[b];c.fn[b]=function(a,c,g){return null==a||"boolean"===typeof a?d.apply(this,arguments):this.animate(ma(b,
173
+ !0),a,c,g)}});c.fn.extend({fadeTo:function(a,b,c,e){return this.filter(fa).css("opacity",0).show().end().animate({opacity:b},a,c,e)},animate:function(a,b,d,e){var f=c.isEmptyObject(a),g=c.speed(b,d,e),h=function(){var b=rb(this,c.extend({},a),g);h.finish=function(){b.stop(!0)};(f||c._data(this,"finish"))&&b.stop(!0)};h.finish=h;return f||!1===g.queue?this.each(h):this.queue(g.queue,h)},stop:function(a,b,d){var e=function(a){var b=a.stop;delete a.stop;b(d)};"string"!==typeof a&&(d=b,b=a,a=m);b&&!1!==
174
+ a&&this.queue(a||"fx",[]);return this.each(function(){var b=!0,g=null!=a&&a+"queueHooks",h=c.timers,k=c._data(this);if(g)k[g]&&k[g].stop&&e(k[g]);else for(g in k)k[g]&&k[g].stop&&Rc.test(g)&&e(k[g]);for(g=h.length;g--;)h[g].elem!==this||null!=a&&h[g].queue!==a||(h[g].anim.stop(d),b=!1,h.splice(g,1));!b&&d||c.dequeue(this,a)})},finish:function(a){!1!==a&&(a=a||"fx");return this.each(function(){var b,d=c._data(this),e=d[a+"queue"];b=d[a+"queueHooks"];var f=c.timers,g=e?e.length:0;d.finish=!0;c.queue(this,
175
+ a,[]);b&&b.cur&&b.cur.finish&&b.cur.finish.call(this);for(b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;b<g;b++)e[b]&&e[b].finish&&e[b].finish.call(this);delete d.finish})}});c.each({slideDown:ma("show"),slideUp:ma("hide"),slideToggle:ma("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(a,c,f){return this.animate(b,a,c,f)}});c.speed=function(a,b,d){var e=a&&"object"===typeof a?c.extend({},
176
+ a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:"number"===typeof e.duration?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;if(null==e.queue||!0===e.queue)e.queue="fx";e.old=e.complete;e.complete=function(){c.isFunction(e.old)&&e.old.call(this);e.queue&&c.dequeue(this,e.queue)};return e};c.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}};c.timers=[];c.fx=A.prototype.init;
177
+ c.fx.tick=function(){var a,b=c.timers,d=0;for(Y=c.now();d<b.length;d++)a=b[d],a()||b[d]!==a||b.splice(d--,1);b.length||c.fx.stop();Y=m};c.fx.timer=function(a){a()&&c.timers.push(a)&&c.fx.start()};c.fx.interval=13;c.fx.start=function(){xa||(xa=setInterval(c.fx.tick,c.fx.interval))};c.fx.stop=function(){clearInterval(xa);xa=null};c.fx.speeds={slow:600,fast:200,_default:400};c.fx.step={};c.expr&&c.expr.filters&&(c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length});
178
+ c.fn.offset=function(a){if(arguments.length)return a===m?this:this.each(function(b){c.offset.setOffset(this,a,b)});var b,d,e={top:0,left:0},f=(d=this[0])&&d.ownerDocument;if(f){b=f.documentElement;if(!c.contains(b,d))return e;typeof d.getBoundingClientRect!==z&&(e=d.getBoundingClientRect());d=sb(f);return{top:e.top+(d.pageYOffset||b.scrollTop)-(b.clientTop||0),left:e.left+(d.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}}};c.offset={setOffset:function(a,b,d){var e=c.css(a,"position");"static"===e&&
179
+ (a.style.position="relative");var f=c(a),g=f.offset(),h=c.css(a,"top"),k=c.css(a,"left"),l={},m={};("absolute"===e||"fixed"===e)&&-1<c.inArray("auto",[h,k])?(m=f.position(),e=m.top,k=m.left):(e=parseFloat(h)||0,k=parseFloat(k)||0);c.isFunction(b)&&(b=b.call(a,d,g));null!=b.top&&(l.top=b.top-g.top+e);null!=b.left&&(l.left=b.left-g.left+k);"using"in b?b.using.call(a,l):f.css(l)}};c.fn.extend({position:function(){if(this[0]){var a,b,d={top:0,left:0},e=this[0];"fixed"===c.css(e,"position")?b=e.getBoundingClientRect():
180
+ (a=this.offsetParent(),b=this.offset(),c.nodeName(a[0],"html")||(d=a.offset()),d.top+=c.css(a[0],"borderTopWidth",!0),d.left+=c.css(a[0],"borderLeftWidth",!0));return{top:b.top-d.top-c.css(e,"marginTop",!0),left:b.left-d.left-c.css(e,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||p.documentElement;a&&!c.nodeName(a,"html")&&"static"===c.css(a,"position");)a=a.offsetParent;return a||p.documentElement})}});c.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},
181
+ function(a,b){var d=/Y/.test(b);c.fn[a]=function(e){return c.access(this,function(a,e,h){var k=sb(a);if(h===m)return k?b in k?k[b]:k.document.documentElement[e]:a[e];k?k.scrollTo(d?c(k).scrollLeft():h,d?h:c(k).scrollTop()):a[e]=h},a,e,arguments.length,null)}});c.each({Height:"height",Width:"width"},function(a,b){c.each({padding:"inner"+a,content:b,"":"outer"+a},function(d,e){c.fn[e]=function(e,g){var h=arguments.length&&(d||"boolean"!==typeof e),k=d||(!0===e||!0===g?"margin":"border");return c.access(this,
182
+ function(b,d,e){return c.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(d=b.documentElement,Math.max(b.body["scroll"+a],d["scroll"+a],b.body["offset"+a],d["offset"+a],d["client"+a])):e===m?c.css(b,d,k):c.style(b,d,e,k)},b,h?e:m,h,null)}})});r.jQuery=r.$=c;"function"===typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return c})})(window);
includes/js/rba/js/jquery.flash.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ (function(){function e(){var a="",b;for(b in this)"function"!=typeof this[b]&&(a+=b+'="'+this[b]+'" ');return a}function h(){var a="",b;for(b in this)"function"!=typeof this[b]&&(a+=b+"="+encodeURIComponent(this[b])+"&");return a.replace(/&$/,"")}var c;c=jQuery.fn.flash=function(a,b,f,d){var g=f||c.replace;b=c.copy(c.pluginOptions,b);if(!c.hasFlash(b.version))if(b.expressInstall&&c.hasFlash(6,0,65))var e={flashvars:{MMredirectURL:location,MMplayerType:"PlugIn",MMdoctitle:jQuery("title").text()}};
2
+ else if(b.update)g=d||c.update;else return this;a=c.copy(c.htmlOptions,e,a);return this.each(function(){g.call(this,c.copy(a))})};c.copy=function(){for(var a={},b={},c=0;c<arguments.length;c++){var d=arguments[c];void 0!=d&&(jQuery.extend(a,d),void 0!=d.flashvars&&jQuery.extend(b,d.flashvars))}a.flashvars=b;return a};c.hasFlash=function(a,b,f){if(/hasFlash\=true/.test(location))return!0;if(/hasFlash\=false/.test(location))return!1;var d=c.hasFlash.playerVersion().match(/\d+/g);a=String([a,b,f]).match(/\d+/g)||
3
+ String(c.pluginOptions.version).match(/\d+/g);for(b=0;3>b;b++){d[b]=parseInt(d[b]||0);a[b]=parseInt(a[b]||0);if(d[b]<a[b])return!1;if(d[b]>a[b])break}return!0};c.hasFlash.playerVersion=function(){try{try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{a.AllowScriptAccess="always"}catch(b){return"6,0,0"}}catch(b){}return(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(b){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)return(navigator.plugins["Shockwave Flash 2.0"]||
4
+ navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(c){}}return"0,0,0"};c.htmlOptions={height:240,flashvars:{},pluginspage:"http://www.adobe.com/go/getflashplayer",src:"#",type:"application/x-shockwave-flash",width:320};c.pluginOptions={expressInstall:!1,update:!0,version:"6.0.65"};c.replace=function(a){this.innerHTML='<div class="alt">'+this.innerHTML+"</div>";jQuery(this).addClass("flash-replaced").prepend(c.transform(a))};c.update=function(a){a=String(location).split("?");
5
+ a.splice(1,0,"?hasFlash=true&");a=a.join("");a='<p>This content requires the Flash Player. <a href="http://www.adobe.com/go/getflashplayer">Download Flash Player</a>. Already have Flash Player? <a href="'+a+'">Click here.</a></p>';this.innerHTML='<span class="alt">'+this.innerHTML+"</span>";jQuery(this).addClass("flash-update").prepend(a)};c.transform=function(a){a.toString=e;a.flashvars&&(a.flashvars.toString=h);return"<embed "+String(a)+"/>"};window.attachEvent&&window.attachEvent("onbeforeunload",
6
+ function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})})();
includes/js/rba/js/miniorange-fp.js ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var geoip2=function(){"use strict";function Lookup(successCallback,errorCallback,options,type){this.successCallback=successCallback,this.errorCallback=errorCallback,this.geolocation=options&&options.hasOwnProperty("geolocation")?options.geolocation:navigator.geolocation,this.type=type}var exports={};Lookup.prototype.returnSuccess=function(location){this.successCallback&&"function"==typeof this.successCallback&&this.successCallback(this.fillInObject(this.objectFromJSON(location)))},Lookup.prototype.returnError=function(error){this.errorCallback&&"function"==typeof this.errorCallback&&(error||(error={error:"Unknown error"}),this.errorCallback(error))},Lookup.prototype.objectFromJSON=function(json){return"undefined"!=typeof window.JSON&&"function"==typeof window.JSON.parse?window.JSON.parse(json):eval("("+json+")")};var fillIns={country:[["continent","Object","names","Object"],["country","Object","names","Object"],["registered_country","Object","names","Object"],["represented_country","Object","names","Object"],["traits","Object"]],city:[["city","Object","names","Object"],["continent","Object","names","Object"],["country","Object","names","Object"],["location","Object"],["postal","Object"],["registered_country","Object","names","Object"],["represented_country","Object","names","Object"],["subdivisions","Array",0,"Object","names","Object"],["traits","Object"]]};return Lookup.prototype.fillInObject=function(obj){for(var fill="country"===this.type?fillIns.country:fillIns.city,i=0;i<fill.length;i++)for(var path=fill[i],o=obj,j=0;j<path.length;j+=2){var key=path[j];o[key]||(o[key]="Object"===path[j+1]?{}:[]),o=o[key]}try{Object.defineProperty(obj.continent,"continent_code",{enumerable:!1,get:function(){return this.code},set:function(value){this.code=value}})}catch(e){obj.continent.code&&(obj.continent.continent_code=obj.continent.code)}if("country"!==this.type)try{Object.defineProperty(obj,"most_specific_subdivision",{enumerable:!1,get:function(){return this.subdivisions[this.subdivisions.length-1]},set:function(value){this.subdivisions[this.subdivisions.length-1]=value}})}catch(e){obj.most_specific_subdivision=obj.subdivisions[obj.subdivisions.length-1]}return obj},Lookup.prototype.getGeoIPResult=function(){var param,request,that=this,httpParams={},uri="//js.maxmind.com/geoip/v2.1/"+this.type+"/me?";if(!this.alreadyRan){this.alreadyRan=1,"Microsoft Internet Explorer"===navigator.appName&&window.XDomainRequest&&-1===navigator.appVersion.indexOf("MSIE 1")?(request=new XDomainRequest,httpParams.referrer=document.URL,uri=window.location.protocol+uri,request.onprogress=function(){}):(request=new window.XMLHttpRequest,uri="https:"+uri);for(param in httpParams)httpParams.hasOwnProperty(param)&&httpParams[param]&&(uri+=param+"="+encodeURIComponent(httpParams[param])+"&");uri=uri.substring(0,uri.length-1),request.open("GET",uri,!0),request.onload=function(){if("undefined"==typeof request.status||200===request.status)that.returnSuccess(request.responseText);else{var error,contentType=request.hasOwnProperty("contentType")?request.contentType:request.getResponseHeader("Content-Type");if(/json/.test(contentType)&&request.responseText.length)try{error=that.objectFromJSON(request.responseText)}catch(e){error={code:"HTTP_ERROR",error:"The server returned a "+request.status+" status with an invalid JSON body."}}else error=request.responseText.length?{code:"HTTP_ERROR",error:"The server returned a "+request.status+" status with the following body: "+request.responseText}:{code:"HTTP_ERROR",error:"The server returned a "+request.status+" status but either the server did not return a body or this browser is a version of Internet Explorer that hides error bodies."};that.returnError(error)}},request.ontimeout=function(){that.returnError({code:"HTTP_TIMEOUT",error:"The request to the GeoIP2 web service timed out."})},request.onerror=function(){that.returnError({code:"HTTP_ERROR",error:"There was an error making the request to the GeoIP2 web service."})},request.send(null)}},exports.country=function(successCallback,errorCallback,options){var l=new Lookup(successCallback,errorCallback,options,"country");l.getGeoIPResult()},exports.city=function(successCallback,errorCallback,options){var l=new Lookup(successCallback,errorCallback,options,"city");l.getGeoIPResult()},exports.insights=function(successCallback,errorCallback,options){var l=new Lookup(successCallback,errorCallback,options,"insights");l.getGeoIPResult()},exports}();
2
+
3
+ var fp = new Object();
4
+ var isJSReady = false;
5
+ var rbaAttributes = {
6
+ attributes : []
7
+ };
8
+ initializeJS();
9
+
10
+ function initializeJS() {
11
+
12
+ var fontCollectionObjectDiv = document.createElement('div');
13
+ fontCollectionObjectDiv.style.width = "0px";
14
+ fontCollectionObjectDiv.style.height = "0px";
15
+
16
+ fontCollectionObjectDiv.innerHTML = "<object id='FontList' width='1' height='1' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab'> <param name='movie' value='wp-content/plugins/miniorange-2-factor-authentication/includes/js/rba/js/fonts.swf' /> <param name='quality' value='high' /> <param name='bgcolor' value='#869ca7' /> <param name='allowScriptAccess' value='always' /> <embed src='wp-content/plugins/miniorange-2-factor-authentication/includes/js/rba/js/fonts.swf' quality='high' bgcolor='#869ca7' width='1' height='1' name='fonts' align='middle' play='true' loop='false' quality='high' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'> </embed> </object>";
17
+
18
+ document.body.appendChild(fontCollectionObjectDiv);
19
+
20
+ pageInit();
21
+ }
includes/js/rba/js/murmurhash3.js ADDED
@@ -0,0 +1,2 @@
 
 
1
+ function murmurhash3_32_gc(c,g){var e,f,a,b,d;e=c.length&3;f=c.length-e;a=g;for(d=0;d<f;)b=c.charCodeAt(d)&255|(c.charCodeAt(++d)&255)<<8|(c.charCodeAt(++d)&255)<<16|(c.charCodeAt(++d)&255)<<24,++d,b=3432918353*(b&65535)+((3432918353*(b>>>16)&65535)<<16)&4294967295,b=b<<15|b>>>17,b=461845907*(b&65535)+((461845907*(b>>>16)&65535)<<16)&4294967295,a^=b,a=a<<13|a>>>19,a=5*(a&65535)+((5*(a>>>16)&65535)<<16)&4294967295,a=(a&65535)+27492+(((a>>>16)+58964&65535)<<16);b=0;switch(e){case 3:b^=(c.charCodeAt(d+
2
+ 2)&255)<<16;case 2:b^=(c.charCodeAt(d+1)&255)<<8;case 1:b^=c.charCodeAt(d)&255,b=3432918353*(b&65535)+((3432918353*(b>>>16)&65535)<<16)&4294967295,b=b<<15|b>>>17,a^=461845907*(b&65535)+((461845907*(b>>>16)&65535)<<16)&4294967295}a^=c.length;a^=a>>>16;a=2246822507*(a&65535)+((2246822507*(a>>>16)&65535)<<16)&4294967295;a^=a>>>13;a=3266489909*(a&65535)+((3266489909*(a>>>16)&65535)<<16)&4294967295;return(a^a>>>16)>>>0};
includes/js/rba/js/swfobject.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var swfobject=function(){function w(){if(!u){try{var a=d.getElementsByTagName("body")[0].appendChild(d.createElement("span"));a.parentNode.removeChild(a)}catch(c){return}u=!0;for(var a=z.length,b=0;b<a;b++)z[b]()}}function M(a){u?a():z[z.length]=a}function N(a){if("undefined"!=typeof n.addEventListener)n.addEventListener("load",a,!1);else if("undefined"!=typeof d.addEventListener)d.addEventListener("load",a,!1);else if("undefined"!=typeof n.attachEvent)U(n,"onload",a);else if("function"==typeof n.onload){var b=
2
+ n.onload;n.onload=function(){b();a()}}else n.onload=a}function V(){var a=d.getElementsByTagName("body")[0],b=d.createElement("object");b.setAttribute("type","application/x-shockwave-flash");var c=a.appendChild(b);if(c){var f=0;(function(){if("undefined"!=typeof c.GetVariable){var g=c.GetVariable("$version");g&&(g=g.split(" ")[1].split(","),e.pv=[parseInt(g[0],10),parseInt(g[1],10),parseInt(g[2],10)])}else if(10>f){f++;setTimeout(arguments.callee,10);return}a.removeChild(b);c=null;E()})()}else E()}
3
+ function E(){var a=r.length;if(0<a)for(var b=0;b<a;b++){var c=r[b].id,f=r[b].callbackFn,g={success:!1,id:c};if(0<e.pv[0]){var d=p(c);if(d)if(!A(r[b].swfVersion)||e.wk&&312>e.wk)if(r[b].expressInstall&&F()){g={};g.data=r[b].expressInstall;g.width=d.getAttribute("width")||"0";g.height=d.getAttribute("height")||"0";d.getAttribute("class")&&(g.styleclass=d.getAttribute("class"));d.getAttribute("align")&&(g.align=d.getAttribute("align"));for(var h={},d=d.getElementsByTagName("param"),k=d.length,l=0;l<
4
+ k;l++)"movie"!=d[l].getAttribute("name").toLowerCase()&&(h[d[l].getAttribute("name")]=d[l].getAttribute("value"));G(g,h,c,f)}else W(d),f&&f(g);else v(c,!0),f&&(g.success=!0,g.ref=H(c),f(g))}else v(c,!0),f&&((c=H(c))&&"undefined"!=typeof c.SetVariable&&(g.success=!0,g.ref=c),f(g))}}function H(a){var b=null;(a=p(a))&&"OBJECT"==a.nodeName&&("undefined"!=typeof a.SetVariable?b=a:(a=a.getElementsByTagName("object")[0])&&(b=a));return b}function F(){return!B&&A("6.0.65")&&(e.win||e.mac)&&!(e.wk&&312>e.wk)}
5
+ function G(a,b,c,f){B=!0;I=f||null;O={success:!1,id:c};var g=p(c);if(g){"OBJECT"==g.nodeName?(y=J(g),C=null):(y=g,C=c);a.id="SWFObjectExprInst";if("undefined"==typeof a.width||!/%$/.test(a.width)&&310>parseInt(a.width,10))a.width="310";if("undefined"==typeof a.height||!/%$/.test(a.height)&&137>parseInt(a.height,10))a.height="137";d.title=d.title.slice(0,47)+" - Flash Player Installation";f=e.ie&&e.win?"ActiveX":"PlugIn";f="MMredirectURL="+n.location.toString().replace(/&/g,"%26")+"&MMplayerType="+
6
+ f+"&MMdoctitle="+d.title;b.flashvars="undefined"!=typeof b.flashvars?b.flashvars+("&"+f):f;e.ie&&e.win&&4!=g.readyState&&(f=d.createElement("div"),c+="SWFObjectNew",f.setAttribute("id",c),g.parentNode.insertBefore(f,g),g.style.display="none",function(){4==g.readyState?g.parentNode.removeChild(g):setTimeout(arguments.callee,10)}());K(a,b,c)}}function W(a){if(e.ie&&e.win&&4!=a.readyState){var b=d.createElement("div");a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(J(a),b);a.style.display="none";
7
+ (function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)})()}else a.parentNode.replaceChild(J(a),a)}function J(a){var b=d.createElement("div");if(e.win&&e.ie)b.innerHTML=a.innerHTML;else if(a=a.getElementsByTagName("object")[0])if(a=a.childNodes)for(var c=a.length,f=0;f<c;f++)1==a[f].nodeType&&"PARAM"==a[f].nodeName||8==a[f].nodeType||b.appendChild(a[f].cloneNode(!0));return b}function K(a,b,c){var f,g=p(c);if(e.wk&&312>e.wk)return f;if(g)if("undefined"==typeof a.id&&
8
+ (a.id=c),e.ie&&e.win){var q="",h;for(h in a)a[h]!=Object.prototype[h]&&("data"==h.toLowerCase()?b.movie=a[h]:"styleclass"==h.toLowerCase()?q+=' class="'+a[h]+'"':"classid"!=h.toLowerCase()&&(q+=" "+h+'="'+a[h]+'"'));h="";for(var k in b)b[k]!=Object.prototype[k]&&(h+='<param name="'+k+'" value="'+b[k]+'" />');g.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+q+">"+h+"</object>";D[D.length]=a.id;f=p(a.id)}else{k=d.createElement("object");k.setAttribute("type","application/x-shockwave-flash");
9
+ for(var l in a)a[l]!=Object.prototype[l]&&("styleclass"==l.toLowerCase()?k.setAttribute("class",a[l]):"classid"!=l.toLowerCase()&&k.setAttribute(l,a[l]));for(q in b)b[q]!=Object.prototype[q]&&"movie"!=q.toLowerCase()&&(a=k,h=q,l=b[q],c=d.createElement("param"),c.setAttribute("name",h),c.setAttribute("value",l),a.appendChild(c));g.parentNode.replaceChild(k,g);f=k}return f}function P(a){var b=p(a);b&&"OBJECT"==b.nodeName&&(e.ie&&e.win?(b.style.display="none",function(){if(4==b.readyState){var c=p(a);
10
+ if(c){for(var f in c)"function"==typeof c[f]&&(c[f]=null);c.parentNode.removeChild(c)}}else setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function p(a){var b=null;try{b=d.getElementById(a)}catch(c){}return b}function U(a,b,c){a.attachEvent(b,c);x[x.length]=[a,b,c]}function A(a){var b=e.pv;a=a.split(".");a[0]=parseInt(a[0],10);a[1]=parseInt(a[1],10)||0;a[2]=parseInt(a[2],10)||0;return b[0]>a[0]||b[0]==a[0]&&b[1]>a[1]||b[0]==a[0]&&b[1]==a[1]&&b[2]>=a[2]?!0:!1}function Q(a,b,c,f){if(!e.ie||
11
+ !e.mac){var g=d.getElementsByTagName("head")[0];g&&(c=c&&"string"==typeof c?c:"screen",f&&(L=m=null),m&&L==c||(f=d.createElement("style"),f.setAttribute("type","text/css"),f.setAttribute("media",c),m=g.appendChild(f),e.ie&&e.win&&"undefined"!=typeof d.styleSheets&&0<d.styleSheets.length&&(m=d.styleSheets[d.styleSheets.length-1]),L=c),e.ie&&e.win?m&&"object"==typeof m.addRule&&m.addRule(a,b):m&&"undefined"!=typeof d.createTextNode&&m.appendChild(d.createTextNode(a+" {"+b+"}")))}}function v(a,b){if(R){var c=
12
+ b?"visible":"hidden";u&&p(a)?p(a).style.visibility=c:Q("#"+a,"visibility:"+c)}}function S(a){return null!=/[\\\"<>\.;]/.exec(a)&&"undefined"!=typeof encodeURIComponent?encodeURIComponent(a):a}var n=window,d=document,t=navigator,T=!1,z=[function(){T?V():E()}],r=[],D=[],x=[],y,C,I,O,u=!1,B=!1,m,L,R=!0,e=function(){var a="undefined"!=typeof d.getElementById&&"undefined"!=typeof d.getElementsByTagName&&"undefined"!=typeof d.createElement,b=t.userAgent.toLowerCase(),c=t.platform.toLowerCase(),f=c?/win/.test(c):
13
+ /win/.test(b),c=c?/mac/.test(c):/mac/.test(b),b=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,g=!+"\v1",e=[0,0,0],h=null;if("undefined"!=typeof t.plugins&&"object"==typeof t.plugins["Shockwave Flash"])!(h=t.plugins["Shockwave Flash"].description)||"undefined"!=typeof t.mimeTypes&&t.mimeTypes["application/x-shockwave-flash"]&&!t.mimeTypes["application/x-shockwave-flash"].enabledPlugin||(T=!0,g=!1,h=h.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),e[0]=parseInt(h.replace(/^(.*)\..*$/,
14
+ "$1"),10),e[1]=parseInt(h.replace(/^.*\.(.*)\s.*$/,"$1"),10),e[2]=/[a-zA-Z]/.test(h)?parseInt(h.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if("undefined"!=typeof n.ActiveXObject)try{var k=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");k&&(h=k.GetVariable("$version"))&&(g=!0,h=h.split(" ")[1].split(","),e=[parseInt(h[0],10),parseInt(h[1],10),parseInt(h[2],10)])}catch(l){}return{w3:a,pv:e,wk:b,ie:g,win:f,mac:c}}();(function(){e.w3&&(("undefined"!=typeof d.readyState&&"complete"==d.readyState||
15
+ "undefined"==typeof d.readyState&&(d.getElementsByTagName("body")[0]||d.body))&&w(),u||("undefined"!=typeof d.addEventListener&&d.addEventListener("DOMContentLoaded",w,!1),e.ie&&e.win&&(d.attachEvent("onreadystatechange",function(){"complete"==d.readyState&&(d.detachEvent("onreadystatechange",arguments.callee),w())}),n==top&&function(){if(!u){try{d.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}w()}}()),e.wk&&function(){u||(/loaded|complete/.test(d.readyState)?w():
16
+ setTimeout(arguments.callee,0))}(),N(w)))})();(function(){e.ie&&e.win&&window.attachEvent("onunload",function(){for(var a=x.length,b=0;b<a;b++)x[b][0].detachEvent(x[b][1],x[b][2]);a=D.length;for(b=0;b<a;b++)P(D[b]);for(var c in e)e[c]=null;e=null;for(var f in swfobject)swfobject[f]=null;swfobject=null})})();return{registerObject:function(a,b,c,f){if(e.w3&&a&&b){var d={};d.id=a;d.swfVersion=b;d.expressInstall=c;d.callbackFn=f;r[r.length]=d;v(a,!1)}else f&&f({success:!1,id:a})},getObjectById:function(a){if(e.w3)return H(a)},
17
+ embedSWF:function(a,b,c,d,g,q,h,k,l,n){var p={success:!1,id:b};e.w3&&!(e.wk&&312>e.wk)&&a&&b&&c&&d&&g?(v(b,!1),M(function(){c+="";d+="";var e={};if(l&&"object"===typeof l)for(var m in l)e[m]=l[m];e.data=a;e.width=c;e.height=d;m={};if(k&&"object"===typeof k)for(var r in k)m[r]=k[r];if(h&&"object"===typeof h)for(var t in h)m.flashvars="undefined"!=typeof m.flashvars?m.flashvars+("&"+t+"="+h[t]):t+"="+h[t];if(A(g))r=K(e,m,b),e.id==b&&v(b,!0),p.success=!0,p.ref=r;else{if(q&&F()){e.data=q;G(e,m,b,n);return}v(b,
18
+ !0)}n&&n(p)})):n&&n(p)},switchOffAutoHideShow:function(){R=!1},ua:e,getFlashPlayerVersion:function(){return{major:e.pv[0],minor:e.pv[1],release:e.pv[2]}},hasFlashPlayerVersion:A,createSWF:function(a,b,c){if(e.w3)return K(a,b,c)},showExpressInstall:function(a,b,c,d){e.w3&&F()&&G(a,b,c,d)},removeSWF:function(a){e.w3&&P(a)},createCSS:function(a,b,c,d){e.w3&&Q(a,b,c,d)},addDomLoadEvent:M,addLoadEvent:N,getQueryParamValue:function(a){var b=d.location.search||d.location.hash;if(b){/\?/.test(b)&&(b=b.split("?")[1]);
19
+ if(null==a)return S(b);for(var b=b.split("&"),c=0;c<b.length;c++)if(b[c].substring(0,b[c].indexOf("="))==a)return S(b[c].substring(b[c].indexOf("=")+1))}return""},expressInstallCallback:function(){if(B){var a=p("SWFObjectExprInst");a&&y&&(a.parentNode.replaceChild(y,a),C&&(v(C,!0),e.ie&&e.win&&(y.style.display="block")),I&&I(O));B=!1}}}}();
includes/js/rba/js/ua-parser.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(f,l){var h={has:function(b,c){return-1!==c.toLowerCase().indexOf(b.toLowerCase())},lowerize:function(b){return b.toLowerCase()}},k=function(){for(var b,c=0,a,f,d,g,e,k=arguments;c<k.length;c+=2){e=k[c];var h=k[c+1];if("undefined"===typeof b)for(d in b={},h)a=h[d],"object"===typeof a?b[a[0]]=l:b[a]=l;for(a=f=0;a<e.length;a++)if(g=e[a].exec(this.getUA())){for(d=0;d<h.length;d++)e=g[++f],a=h[d],"object"===typeof a&&0<a.length?2==a.length?b[a[0]]="function"==typeof a[1]?a[1].call(this,e):a[1]:
2
+ 3==a.length?b[a[0]]="function"!==typeof a[1]||a[1].exec&&a[1].test?e?e.replace(a[1],a[2]):l:e?a[1].call(this,e,a[2]):l:4==a.length&&(b[a[0]]=e?a[3].call(this,e.replace(a[1],a[2])):l):b[a]=e?e:l;break}if(g)break}return b},g=function(b,c){for(var a in c)if("object"===typeof c[a]&&0<c[a].length)for(var d=0;d<c[a].length;d++){if(h.has(c[a][d],b))return"?"===a?l:a}else if(h.has(c[a],b))return"?"===a?l:a;return b},p={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2E3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",
3
+ 7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",RT:"ARM"},q=[[/(opera\smini)\/((\d+)?[\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i,/(opera).+version\/((\d+)?[\w\.]+)/i,/(opera)[\/\s]+((\d+)?[\w\.]+)/i],["name","version","major"],[/\s(opr)\/((\d+)?[\w\.]+)/i],[["name","Opera"],"version","major"],[/(kindle)\/((\d+)?[\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i,
4
+ /(rekonq)((?:\/)[\w\.]+)*/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i],["name","version","major"],[/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i],[["name","IE"],"version","major"],[/(yabrowser)\/((\d+)?[\w\.]+)/i],[["name","Yandex"],"version","major"],[/(comodo_dragon)\/((\d+)?[\w\.]+)/i],[["name",/_/g," "],"version","major"],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i],["name","version","major"],[/(dolfin)\/((\d+)?[\w\.]+)/i],
5
+ [["name","Dolphin"],"version","major"],[/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i],[["name","Chrome"],"version","major"],[/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i],["version","major",["name","Mobile Safari"]],[/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i],["version","major","name"],[/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i],["name",["major",g,{1:["/8","/1","/3"],2:"/4","?":"/"}],["version",g,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417",
6
+ "2.0.4":"/419","?":"/"}]],[/(konqueror)\/((\d+)?[\w\.]+)/i,/(webkit|khtml)\/((\d+)?[\w\.]+)/i],["name","version","major"],[/(navigator|netscape)\/((\d+)?[\w\.-]+)/i],[["name","Netscape"],"version","major"],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i,/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
7
+ /(links)\s\(((\d+)?[\w\.]+)/i,/(gobrowser)\/?((\d+)?[\w\.]+)*/i,/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i,/(mosaic)[\/\s]((\d+)?[\w\.]+)/i],["name","version","major"]],r=[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",h.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/(ia64(?=;)|68k(?=\))|arm(?=v\d+;)|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],
8
+ ["architecture",h.lowerize]],t=[[/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i],["model","vendor",["type","tablet"]],[/(hp).+(touchpad)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],["vendor","model",["type","tablet"]],[/\((ip[honed]+);.+(apple)/i],["model","vendor",["type","mobile"]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],["vendor",
9
+ "model",["type","mobile"]],[/\((bb10);\s(\w+)/i],[["vendor","BlackBerry"],"model",["type","mobile"]],[/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+))/i],[["vendor","Asus"],"model",["type","tablet"]],[/(sony)\s(tablet\s[ps])/i],["vendor","model",["type","tablet"]],[/(nintendo)\s([wids3u]+)/i],["vendor","model",["type","console"]],[/((playstation)\s[3portablevi]+)/i],[["vendor","Sony"],"model",["type","console"]],[/(sprint\s(\w+))/i],[["vendor",g,{HTC:"APA",Sprint:"Sprint"}],["model",g,
10
+ {"Evo Shift 4G":"7373KT"}],["type","mobile"]],[/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i,/(zte)-(\w+)*/i,/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i],["vendor",["model",/_/g," "],["type","mobile"]],[/\s((milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?))[\w\s]+build\//i,/(mot)[\s-]?(\w+)*/i],[["vendor","Motorola"],"model",["type","mobile"]],[/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i],[["vendor","Motorola"],"model",["type","tablet"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9))/i],
11
+ [["vendor","Samsung"],"model",["type","tablet"]],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,/sec-((sgh\w+))/i],[["vendor","Samsung"],"model",["type","mobile"]],[/(sie)-(\w+)*/i],[["vendor","Siemens"],"model",["type","mobile"]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]+)*/i],[["vendor","Nokia"],"model",["type","mobile"]],[/android\s3\.[\s\w-;]{10}((a\d{3}))/i],[["vendor","Acer"],"model",["type","tablet"]],[/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i],
12
+ [["vendor","LG"],"model",["type","tablet"]],[/((nexus\s4))/i,/(lg)[e;\s-\/]+(\w+)*/i],[["vendor","LG"],"model",["type","mobile"]],[/(mobile|tablet);.+rv\:.+gecko\//i],["type","vendor","model"]],u=[[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv\:([\w\.]+).*(gecko)/i],["version","name"]],v=[[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],
13
+ ["name",["version",g,p]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",g,p]],[/\((bb)(10);/i],[["name","BlackBerry"],"version"],[/(blackberry)\w*\/?([\w\.]+)*/i,/(tizen)\/([\w\.]+)/i,/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i],["name","version"],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i],[["name","Symbian"],"version"],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"],"version"],[/(nintendo|playstation)\s([wids3portablevu]+)/i,
14
+ /(mint)[\/\s\(]?(\w+)*/i,/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,/(hurd|linux)\s?([\w\.]+)*/i,/(gnu)\s?([\w\.]+)*/i],["name","version"],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name","Chromium OS"],"version"],[/(sunos)\s?([\w\.]+\d)*/i],[["name","Solaris"],"version"],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i],["name","version"],[/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i],[["name","iOS"],["version",
15
+ /_/g,"."]],[/(mac\sos\sx)\s?([\w\s\.]+\w)*/i],["name",["version",/_/g,"."]],[/(haiku)\s(\w+)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i,/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,/(unix)\s?([\w\.]+)*/i],["name","version"]],d=function(b){var c=b||(f&&f.navigator&&f.navigator.userAgent?f.navigator.userAgent:"");if(!(this instanceof d))return(new d(b)).getResult();this.getBrowser=function(){return k.apply(this,q)};this.getCPU=function(){return k.apply(this,r)};this.getDevice=
16
+ function(){return k.apply(this,t)};this.getEngine=function(){return k.apply(this,u)};this.getOS=function(){return k.apply(this,v)};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return c};this.setUA=function(a){c=a;return this};this.setUA(c)};if("undefined"!==typeof exports)"undefined"!==typeof module&&module.exports&&(exports=module.exports=d),exports.UAParser=d;else if(f.UAParser=
17
+ d,"function"===typeof define&&define.amd&&define(function(){return d}),"undefined"!==typeof f.jQuery){var m=f.jQuery,n=new d;m.ua=n.getResult();m.ua.get=function(){return n.getUA()};m.ua.set=function(b){n.setUA(b);b=n.getResult();for(var c in b)m.ua[c]=b[c]}}})(this);
miniorange_2_factor_common_login.php ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function redirect_user_to($user){
3
+ $roles = $user->roles;
4
+ $current_role = array_shift($roles);
5
+ if($current_role == 'administrator'){
6
+ wp_redirect( admin_url() );
7
+ }else{
8
+ wp_redirect( home_url());
9
+ }
10
+ }
11
+
12
+ function mo2f_register_profile($email,$deviceKey,$mo2f_rba_status){
13
+
14
+ if(isset($deviceKey) && $deviceKey == 'true'){
15
+ if($mo2f_rba_status['status'] == 'WAIT_FOR_INPUT' && $mo2f_rba_status['decision_flag']){
16
+ $rba_profile = new Miniorange_Rba_Attributes();
17
+ $rba_response = json_decode($rba_profile->mo2f_register_rba_profile($email,$mo2f_rba_status['sessionUuid']),true); //register profile
18
+ return true;
19
+ }else{
20
+ return false;
21
+ }
22
+ }
23
+ return false;
24
+ }
25
+
26
+ function mo2f_collect_attributes($email,$attributes){
27
+ if(get_option('mo2f_deviceid_enabled')){
28
+ $rba_attributes = new Miniorange_Rba_Attributes();
29
+ $rba_response = json_decode($rba_attributes->mo2f_collect_attributes($email,$attributes),true); //collect rba attributes
30
+ if(json_last_error() == JSON_ERROR_NONE){
31
+ if($rba_response['status'] == 'SUCCESS'){ //attribute are collected successfully
32
+ $sessionUuid = $rba_response['sessionUuid'];
33
+ $rba_risk_response = json_decode($rba_attributes->mo2f_evaluate_risk($email,$sessionUuid),true); // evaluate the rba risk
34
+ if(json_last_error() == JSON_ERROR_NONE){
35
+ if($rba_risk_response['status'] == 'SUCCESS' || $rba_risk_response['status'] == 'WAIT_FOR_INPUT'){
36
+ $mo2f_rba_status = array();
37
+ $mo2f_rba_status['status'] = $rba_risk_response['status'];
38
+ $mo2f_rba_status['sessionUuid'] = $sessionUuid;
39
+ $mo2f_rba_status['decision_flag'] = true;
40
+ return $mo2f_rba_status;
41
+ }else{
42
+ $mo2f_rba_status = array();
43
+ $mo2f_rba_status['status'] = $rba_risk_response['status'];
44
+ $mo2f_rba_status['sessionUuid'] = $sessionUuid;
45
+ $mo2f_rba_status['decision_flag'] = false;
46
+ return $mo2f_rba_status;
47
+ }
48
+ }else{
49
+ $mo2f_rba_status = array();
50
+ $mo2f_rba_status['status'] = 'JSON_EVALUATE_ERROR';
51
+ $mo2f_rba_status['sessionUuid'] = $sessionUuid;
52
+ $mo2f_rba_status['decision_flag'] = false;
53
+ return $mo2f_rba_status;
54
+ }
55
+ }else{
56
+ $mo2f_rba_status = array();
57
+ $mo2f_rba_status['status'] = 'ATTR_NOT_COLLECTED';
58
+ $mo2f_rba_status['sessionUuid'] = '';
59
+ $mo2f_rba_status['decision_flag'] = false;
60
+ return $mo2f_rba_status;
61
+ }
62
+ }else{
63
+ $mo2f_rba_status = array();
64
+ $mo2f_rba_status['status'] = 'JSON_ATTR_NOT_COLLECTED';
65
+ $mo2f_rba_status['sessionUuid'] = '';
66
+ $mo2f_rba_status['decision_flag'] = false;
67
+ return $mo2f_rba_status;
68
+ }
69
+ }else{
70
+ $mo2f_rba_status = array();
71
+ $mo2f_rba_status['status'] = 'RBA_NOT_ENABLED';
72
+ $mo2f_rba_status['sessionUuid'] = '';
73
+ $mo2f_rba_status['decision_flag'] = false;
74
+ return $mo2f_rba_status;
75
+ }
76
+ }
77
+
78
+ function mo2f_get_user_2ndfactor($current_user){
79
+ if(get_user_meta($current_user->ID,'mo_2factor_mobile_registration_status',true) == 'MO_2_FACTOR_SUCCESS'){
80
+ $mo2f_second_factor = 'MOBILE AUTHENTICATION';
81
+ }else{
82
+ $enduser = new Two_Factor_Setup();
83
+ $userinfo = json_decode($enduser->mo2f_get_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
84
+ if(json_last_error() == JSON_ERROR_NONE){
85
+ if($userinfo['status'] == 'ERROR'){
86
+ $mo2f_second_factor = 'NONE';
87
+ }else if($userinfo['status'] == 'SUCCESS'){
88
+ $mo2f_second_factor = $userinfo['authType'];
89
+ }else if($userinfo['status'] == 'FAILED'){
90
+ $mo2f_second_factor = 'USER_NOT_FOUND';
91
+ }else{
92
+ $mo2f_second_factor = 'NONE';
93
+ }
94
+ }else{
95
+ $mo2f_second_factor = 'NONE';
96
+ }
97
+ }
98
+ return $mo2f_second_factor;
99
+ }
100
+
101
+ function mo2f_get_forgotphone_form(){
102
+ $random_mo_key = get_option('mo2f_new_customer');
103
+ $message = $random_mo_key ? 'Please select the option and click on Continue button' : 'Please choose from below options:';
104
+ ?>
105
+ <div class="miniorange_soft_auth">
106
+
107
+ <div class="miniorange-inner-login-container">
108
+
109
+ <h3 class="mo_header_background">How would you like to authenticate yourself</h3>
110
+ <br>
111
+ <div style="padding-left:10px;padding-right:10px;"><?php echo isset($_SESSION['mo2f-login-message']) ? $_SESSION['mo2f-login-message'] : '';?></div>
112
+ <p style="padding-left:10px;padding-right:10px;"><?php echo $message; ?></p><br/>
113
+ <div style="padding-left:40px;padding-right:40px;">
114
+ <?php if(!$random_mo_key){ ?>
115
+ <input type="radio" name="mo2f_selected_forgotphone_option" value="OTP OVER EMAIL" checked="ckecked" />Send a one time passcode to my registered email<br /><br />
116
+ <?php } ?>
117
+ <input type="radio" name="mo2f_selected_forgotphone_option" value="KBA" />Answer your Security Questions (KBA)
118
+
119
+ <br /><br />
120
+ <input type="button" name="miniorange_validtae_otp" style="float:right;" value="Continue" class="miniorange-button" onclick="mo2fselectforgotphoneoption();" />
121
+
122
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
123
+ </div>
124
+ <br><br>
125
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
126
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
127
+ <?php }?>
128
+
129
+ </div>
130
+
131
+
132
+
133
+ </div>
134
+ <script>
135
+ jQuery("div#login").hide();
136
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
137
+ function mologinback(){
138
+ jQuery('#mo2f_backto_mo_loginform').submit();
139
+ }
140
+ function mo2fselectforgotphoneoption(){
141
+ var option = jQuery('input[name=mo2f_selected_forgotphone_option]:checked').val();
142
+ document.getElementById("mo2f_challenge_forgotphone_form").elements[0].value = option;
143
+ jQuery('#mo2f_challenge_forgotphone_form').submit();
144
+ }
145
+ </script>
146
+ <?php }
147
+
148
+ function mo2f_getkba_form(){
149
+ ?>
150
+ <div class="miniorange_kba_page">
151
+ <center>
152
+ <div id="mo_2_factor_kba_page" class="miniorange-inner-kba-login-container">
153
+ <span><h2 class="mo_header_background">Validate Security Questions</h2></span>
154
+ <div id="kbaSection" style="padding:30px;">
155
+
156
+ <div id="mo_kba_title" style="padding-bottom:20px;">
157
+ <h3><?php echo isset($_SESSION['mo2f-login-message']) ? $_SESSION['mo2f-login-message'] : 'Please answer the following questions:'; ?></h3>
158
+ </div>
159
+ <div id="mo2f_kba_content" style="text-align:left">
160
+ <h4><?php if(isset($_SESSION['mo_2_factor_kba_questions'])){
161
+ echo $_SESSION['mo_2_factor_kba_questions'][0];
162
+ ?></h4>
163
+ <input type="text" name="mo2f_answer_1" id="mo2f_answer_1" required="true" autofocus="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." class="mo2f_kba_textbox" autocomplete="off">
164
+ <h4><?php
165
+ echo $_SESSION['mo_2_factor_kba_questions'][1];
166
+ ?></h4>
167
+ <input class="mo2f_kba_textbox" type="text" name="mo2f_answer_2" id="mo2f_answer_2" required="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." autocomplete="off" >
168
+ <?php
169
+ }
170
+ ?>
171
+ </div>
172
+ <div>
173
+ <?php if(get_option('mo2f_login_policy')){
174
+ if(get_option('mo2f_deviceid_enabled')){
175
+ ?>
176
+ <span style="padding-right:80px;"><input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" />Remember this device.</span>
177
+ <?php
178
+ }else{
179
+ ?>
180
+ <input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" style="display:none;" />
181
+ <?php
182
+ }
183
+ }else{
184
+ ?>
185
+ <input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" style="display:none;" />
186
+ <?php
187
+ }
188
+ ?>
189
+ <input type="button" name="miniorange_kba_validate" onclick="mo2f_validate_kba();" id="miniorange_kba_validate" class="miniorange-button" style="float:right;" value="Validate" />
190
+
191
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
192
+ </div>
193
+ </div>
194
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
195
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
196
+ <?php }?>
197
+ </div>
198
+ </center>
199
+ </div>
200
+ <script>
201
+ jQuery("div#login").hide();
202
+ jQuery("body.login div#login").before(jQuery('.miniorange_kba_page'));
203
+ function mologinback(){
204
+ jQuery('#mo2f_backto_mo_loginform').submit();
205
+ }
206
+ function mo2f_validate_kba(){
207
+ var ans1 = jQuery('#mo2f_answer_1').val();
208
+ var ans2 = jQuery('#mo2f_answer_2').val();
209
+ var check = jQuery('#miniorange_remember_device').prop('checked');
210
+ document.getElementById("mo2f_submitkba_loginform").elements[0].value = ans1;
211
+ document.getElementById("mo2f_submitkba_loginform").elements[1].value = ans2;
212
+ document.getElementById("mo2f_submitkba_loginform").elements[2].value = check;
213
+ jQuery('#mo2f_submitkba_loginform').submit();
214
+ }
215
+
216
+ jQuery('#mo2f_answer_2').keypress(function(e){
217
+ if(e.which == 13){//Enter key pressed
218
+ e.preventDefault();
219
+ mo2f_validate_kba();
220
+ }
221
+ });
222
+ </script>
223
+ <?php
224
+ }
225
+
226
+ function mo2f_getpush_oobemail_response($id){
227
+ ?>
228
+ <div class="miniorange_push_oobemail_auth">
229
+ <center>
230
+ <div class="mo2fa_push_messages_container" id="otpMessage" >
231
+ <p class='mo2fa_display_message'><?php echo $_SESSION['mo2f-login-message']; ?></p>
232
+ </div>
233
+ </center><br/>
234
+
235
+ <div id="mo_2_factor_push_page" class="miniorange-inner-push-login-container">
236
+ <div id="pushSection">
237
+ <br>
238
+ <center><a href="#showPushHelp" id="pushHelpLink"><h3>See How It Works ?</h3></a></center>
239
+ <div style="margin-bottom:10%;padding-top:6%;">
240
+ <center>
241
+ <h3>Waiting for your approval...</h3>
242
+ </center>
243
+ </div>
244
+
245
+ <div id="showPushImage" style="margin-bottom:10%;">
246
+ <center>
247
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" />
248
+ </center>
249
+ </div>
250
+
251
+ <span style="padding-right:2%;">
252
+ <?php if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS'){ ?>
253
+ <center>
254
+ <?php if(get_option('mo2f_enable_forgotphone')){ ?>
255
+ <input type="button" name="miniorange_login_forgotphone" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="miniorange-button" value="Forgot Phone?" />
256
+ <?php } ?>
257
+
258
+ <input type="button" name="miniorange_login_offline" onclick="mologinoffline();" id="miniorange_login_offline" class="miniorange-button" value="Phone is Offline?" /></center>
259
+
260
+ <?php }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL' && get_user_meta($id,'mo2f_kba_registration_status',true)){ ?>
261
+ <center><a href="#mo2f_alternate_login_kba" ><h3>Didn't receive mail?</h3></a></center>
262
+ <?php }
263
+ ?>
264
+ </span>
265
+ <div><center><input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" /></center></div>
266
+ <br />
267
+
268
+ </div>
269
+ <div id="showPushHelp" class="showPushHelp" hidden>
270
+ <br>
271
+ <center><a href="#showPushHelp" id="pushLink"><h3>←Go Back.</h3></a>
272
+ <br>
273
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
274
+ <ol class="mo2f_carousel-indicators">
275
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
276
+ <li data-target="#myCarousel" data-slide-to="1"></li>
277
+ <li data-target="#myCarousel" data-slide-to="2"></li>
278
+ </ol>
279
+ <div class="mo2f_carousel-inner" role="listbox">
280
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL') { ?>
281
+ <div class="item active">
282
+
283
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-1.png" alt="First slide">
284
+ </div>
285
+ <div class="item">
286
+ <p>Click on Accept Transaction link to verify your email .</p><br>
287
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-2.png" alt="First slide">
288
+
289
+ </div>
290
+ <div class="item">
291
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-3.png" alt="First slide">
292
+ </div>
293
+ <?php } else { ?>
294
+ <!-- Indicators -->
295
+
296
+
297
+ <div class="item active">
298
+ <p>You will receive a notification on your phone.</p><br>
299
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow.png" alt="First slide">
300
+ </div>
301
+ <div class="item">
302
+ <p>Open the notification and click on accept button.</p><br>
303
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow-1.png" alt="First slide">
304
+
305
+ </div>
306
+ <div class="item">
307
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow-2.png" alt="First slide">
308
+ </div>
309
+ <?php } ?>
310
+ </div>
311
+ </div>
312
+ </center>
313
+ </div>
314
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
315
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
316
+ <?php }?>
317
+ </div>
318
+ </div>
319
+
320
+ <script>
321
+ jQuery("div#login").hide();
322
+ jQuery("body.login div#login").before(jQuery('.miniorange_push_oobemail_auth'));
323
+ var timeout;
324
+ pollPushValidation();
325
+ function pollPushValidation()
326
+ {
327
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
328
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
329
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
330
+
331
+ jQuery.ajax({
332
+ url: postUrl,
333
+ type : "POST",
334
+ dataType : "json",
335
+ data : jsonString,
336
+ contentType : "application/json; charset=utf-8",
337
+ success : function(result) {
338
+ var status = JSON.parse(JSON.stringify(result)).status;
339
+ if (status == 'SUCCESS') {
340
+ jQuery('#mo2f_mobile_validation_form').submit();
341
+ } else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {
342
+ jQuery('#mo2f_backto_mo_loginform').submit();
343
+ } else {
344
+ timeout = setTimeout(pollPushValidation, 3000);
345
+ }
346
+ }
347
+ });
348
+ }
349
+ jQuery('#myCarousel').carousel('pause');
350
+ jQuery('#pushHelpLink').click(function() {
351
+ jQuery('#showPushHelp').show();
352
+ jQuery('#pushSection').hide();
353
+
354
+ jQuery('#myCarousel').carousel(0);
355
+ });
356
+ jQuery('#pushLink').click(function() {
357
+ jQuery('#showPushHelp').hide();
358
+ jQuery('#pushSection').show();
359
+ jQuery('#myCarousel').carousel('pause');
360
+ });
361
+ function mologinback(){
362
+ jQuery('#mo2f_backto_mo_loginform').submit();
363
+ }
364
+ function mologinoffline(){
365
+ jQuery('#mo2f_show_softtoken_loginform').submit();
366
+ }
367
+ function mologinforgotphone(){
368
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
369
+ }
370
+ function mologinforgotphone(){
371
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
372
+ }
373
+ jQuery('a[href=\"#mo2f_alternate_login_kba\"]').click(function() {
374
+ jQuery('#mo2f_alternate_login_kbaform').submit();
375
+ });
376
+
377
+ </script>
378
+ <?php
379
+ }
380
+
381
+ function mo2f_getqrcode(){
382
+ ?>
383
+ <div class="miniorange_mobile_auth">
384
+ <?php if(isset($_SESSION['mo2f-login-message']) && $_SESSION['mo2f-login-message'] == 'Error:OTP over Email'){ ?>
385
+ <center>
386
+ <div class="mo2fa_messages_container" id="otpMessage">
387
+ <p class='mo2fa_display_message'><?php echo 'Error occurred while sending OTP over email. Please try again.'; ?></p>
388
+ </div></center><br />
389
+ <?php } ?>
390
+
391
+ <div id="mo_2_factor_qr_code_page" class="miniorange-inner-login-container">
392
+ <div id="scanQRSection">
393
+ <br>
394
+ <center><a href="#showQRHelp" id="helpLink"><h3>See How It Works ?</h3></a></center>
395
+ <div style="margin-bottom:10%;padding-top:6%;">
396
+ <center>
397
+ <h3>Identify yourself by scanning the QR code with miniOrange Authenticator app.</h3>
398
+ </center></div>
399
+
400
+ <div id="showQrCode" style="margin-bottom:10%;"><center> <?php echo '<img src="data:image/jpg;base64,' . $_SESSION[ 'mo2f-login-qrCode' ] . '" />'; ?>
401
+ </center>
402
+ </div>
403
+
404
+
405
+ <span style="padding-right:2%;">
406
+
407
+ <center>
408
+ <?php if(get_option('mo2f_enable_forgotphone')){ ?>
409
+ <input type="button" name="miniorange_login_forgotphone" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="miniorange-button" style="margin-right:5%;" value="Forgot Phone?" />
410
+ <?php } ?>
411
+
412
+ <input type="button" name="miniorange_login_offline" onclick="mologinoffline();" id="miniorange_login_offline" class="miniorange-button" value="Phone is Offline?" /></center></span>
413
+
414
+ <div><center><input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" /></center></div>
415
+ <br />
416
+
417
+ </div>
418
+ <div id="showQRHelp" class="showQRHelp" hidden>
419
+ <br>
420
+ <center><a href="#showQRHelp" id="qrLink"><h3>←Back to Scan QR Code.</h3></a>
421
+ <br>
422
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
423
+ <!-- Indicators -->
424
+ <ol class="mo2f_carousel-indicators">
425
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
426
+ <li data-target="#myCarousel" data-slide-to="1"></li>
427
+ <li data-target="#myCarousel" data-slide-to="2"></li>
428
+ <li data-target="#myCarousel" data-slide-to="3"></li>
429
+ <li data-target="#myCarousel" data-slide-to="4"></li>
430
+ </ol>
431
+ <div class="mo2f_carousel-inner" role="listbox">
432
+ <div class="item active">
433
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
434
+ </div>
435
+ <div class="item">
436
+ <p>Open miniOrange Authenticator app and click on Authenticate.</p><br>
437
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
438
+
439
+ </div>
440
+ <div class="item">
441
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-3.png" alt="First slide">
442
+ </div>
443
+ <div class="item">
444
+ <img class="first-slide" src="https://auth.miniorange.com/moas//images/help/qr-help-4.png" alt="First slide">
445
+ </div>
446
+ <div class="item">
447
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-5.png" alt="First slide">
448
+ </div>
449
+ </div>
450
+ </div>
451
+ </center>
452
+ </div>
453
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
454
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
455
+ <?php }?>
456
+ </div>
457
+ </div>
458
+
459
+ <script>
460
+ jQuery("div#login").hide();
461
+ jQuery("body.login div#login").before(jQuery('.miniorange_mobile_auth'));
462
+ var timeout;
463
+ pollMobileValidation();
464
+ function pollMobileValidation()
465
+ {
466
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
467
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
468
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
469
+ jQuery.ajax({
470
+ url: postUrl,
471
+ type : "POST",
472
+ dataType : "json",
473
+ data : jsonString,
474
+ contentType : "application/json; charset=utf-8",
475
+ success : function(result) {
476
+ var status = JSON.parse(JSON.stringify(result)).status;
477
+ if (status == 'SUCCESS') {
478
+ var content = "<div id='success'><center><img src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></center></div>";
479
+ jQuery("#showQrCode").empty();
480
+ jQuery("#showQrCode").append(content);
481
+ setTimeout(function(){jQuery("#mo2f_mobile_validation_form").submit();}, 100);
482
+ } else if (status == 'ERROR' || status == 'FAILED') {
483
+ var content = "<div id='error'><center><img src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></center></div>";
484
+ jQuery("#showQrCode").empty();
485
+ jQuery("#showQrCode").append(content);
486
+ setTimeout(function(){jQuery('#mo2f_backto_mo_loginform').submit();}, 1000);
487
+ } else {
488
+ timeout = setTimeout(pollMobileValidation, 3000);
489
+ }
490
+ }
491
+ });
492
+ }
493
+ jQuery('#myCarousel').carousel('pause');
494
+ jQuery('#helpLink').click(function() {
495
+ jQuery('#showQRHelp').show();
496
+ jQuery('#scanQRSection').hide();
497
+
498
+ jQuery('#myCarousel').carousel(0);
499
+ });
500
+ jQuery('#qrLink').click(function() {
501
+ jQuery('#showQRHelp').hide();
502
+ jQuery('#scanQRSection').show();
503
+ jQuery('#myCarousel').carousel('pause');
504
+ });
505
+ function mologinback(){
506
+ jQuery('#mo2f_backto_mo_loginform').submit();
507
+ }
508
+ function mologinoffline(){
509
+ jQuery('#mo2f_show_softtoken_loginform').submit();
510
+ }
511
+ function mologinforgotphone(){
512
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
513
+ }
514
+ </script>
515
+ <?php
516
+ }
517
+
518
+ function mo2f_getotp_form(){
519
+ ?> <div class="miniorange_soft_auth">
520
+ <center>
521
+ <div id="otpMessage" class="mo2fa_otp_messages_container">
522
+ <p class='mo2fa_display_message' ><?php echo $_SESSION['mo2f-login-message']; ?></p>
523
+ </div>
524
+ </center>
525
+ <br>
526
+ <div id="mo_2_factor_soft_token_page" class="miniorange-inner-login-container" >
527
+ <div id="showOTP">
528
+ <br />
529
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION'){ ?>
530
+ <center><a href="#showOTPHelp" id="otpHelpLink"><h3>See How It Works ?</h3></a></center>
531
+ <?php } ?>
532
+ <br />
533
+
534
+ <div id="displaySoftToken"><center><input type="text" name="mo2fa_softtokenkey" style="width:75%;" placeholder="Enter one time passcode" id="mo2fa_softtokenkey" required="true" autofocus="true" pattern="[0-9]{4,8}" title="Only digits within range 4-8 are allowed."/></center></div>
535
+
536
+ <span><input type="button" name="miniorange_soft_token_submit" onclick="mootploginsubmit();" id="miniorange_soft_token_submit" class="miniorange-button" style="margin-left:12%;width:300px;" value="Validate" />
537
+ <br /><br />
538
+
539
+ <?php if(get_option('mo2f_enable_forgotphone') && isset($_SESSION[ 'mo_2factor_login_status' ] ) && $_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL'){ ?>
540
+ <input type="button" name="miniorange_login_forgotphone" style="width:139px;margin-left:21px;" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="button-green" value="Forgot Phone ?" />
541
+ <?php } ?>
542
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" style="float:right;margin-right:50px;" id="miniorange_login_back" class="button-green" value="←Back To Login"/>
543
+
544
+ </span><br><br>
545
+ </div>
546
+ <div id="showOTPHelp" class="showOTPHelp" hidden>
547
+ <br>
548
+ <center><a href="#showOTP" id="otpLink"><h3>←Go Back</h3></a>
549
+ <br>
550
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
551
+ <!-- Indicators -->
552
+
553
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN'){ ?>
554
+ <ol class="mo2f_carousel-indicators">
555
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
556
+ <li data-target="#myCarousel" data-slide-to="1"></li>
557
+ <li data-target="#myCarousel" data-slide-to="2"></li>
558
+ <li data-target="#myCarousel" data-slide-to="3"></li>
559
+
560
+ </ol>
561
+ <div class="mo2f_carousel-inner" role="listbox">
562
+
563
+
564
+ <div class="item active">
565
+ <p>Open miniOrange Authenticator app and click on settings icon on top right corner.</p><br>
566
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
567
+ </div>
568
+ <div class="item">
569
+ <p>Click on Sync button below to sync your time with miniOrange Servers. This is a one time sync to avoid otp validation failure.</p><br>
570
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-3.png" alt="First slide">
571
+ </div>
572
+ <div class="item">
573
+ <p>Go to Soft Token tab.</p><br>
574
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-2.png" alt="First slide">
575
+ </div>
576
+ <div class="item">
577
+ <p>Enter the one time passcode shown in miniOrange Authenticator app here.</p><br>
578
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-4.png" alt="First slide">
579
+ </div>
580
+ </div>
581
+ <?php } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL') { ?>
582
+ <ol class="mo2f_carousel-indicators">
583
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
584
+ <li data-target="#myCarousel" data-slide-to="1"></li>
585
+ <li data-target="#myCarousel" data-slide-to="2"></li>
586
+
587
+ </ol>
588
+ <div class="mo2f_carousel-inner" role="listbox">
589
+ <div class="item active">
590
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-1.png" alt="First slide">
591
+ </div>
592
+ <div class="item">
593
+ <p>Check your email with which you registered and copy the one time passcode.</p><br>
594
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-2.png" alt="First slide">
595
+ </div>
596
+ <div class="item">
597
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-3.png" alt="First slide">
598
+ </div>
599
+ </div>
600
+ <?php } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS') { ?>
601
+ <ol class="mo2f_carousel-indicators">
602
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
603
+ <li data-target="#myCarousel" data-slide-to="1"></li>
604
+ <li data-target="#myCarousel" data-slide-to="2"></li>
605
+
606
+ </ol>
607
+ <div class="mo2f_carousel-inner" role="listbox">
608
+ <div class="item active">
609
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-1.png" alt="First slide">
610
+ </div>
611
+ <div class="item">
612
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-2.png" alt="First slide">
613
+ </div>
614
+ <div class="item">
615
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-3.png" alt="First slide">
616
+ </div>
617
+ </div>
618
+ <?php } else { ?>
619
+ <!-- phone call verification -->
620
+ <ol class="mo2f_carousel-indicators">
621
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
622
+ <li data-target="#myCarousel" data-slide-to="1"></li>
623
+
624
+
625
+ </ol>
626
+ <div class="mo2f_carousel-inner" role="listbox">
627
+ <div class="item active">
628
+ <p>You will receive a phone call. Pick up the call and listen to the one time passcode carefully. </p>
629
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/phone-call-login-flow-2.png" alt="First slide">
630
+ </div>
631
+ <div class="item">
632
+ <p>Enter the one time passcode here and click on validate button to login.</p><br>
633
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/phone-call-login-flow.png" alt="First slide">
634
+ </div>
635
+
636
+ </div>
637
+ <?php } ?>
638
+
639
+ </div>
640
+ </div>
641
+
642
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
643
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
644
+ <?php }?>
645
+ </div>
646
+
647
+ </div>
648
+ <script>
649
+
650
+ jQuery("div#login").hide();
651
+ jQuery('#otpHelpLink').click(function() {
652
+ jQuery('#showOTPHelp').show();
653
+ jQuery('#showOTP').hide();
654
+ jQuery('#otpMessage').hide();
655
+ });
656
+ jQuery('#otpLink').click(function() {
657
+ jQuery('#showOTPHelp').hide();
658
+ jQuery('#showOTP').show();
659
+ jQuery('#otpMessage').show();
660
+ });
661
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
662
+ function mologinback(){
663
+ jQuery('#mo2f_backto_mo_loginform').submit();
664
+ }
665
+ function mologinforgotphone(){
666
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
667
+ }
668
+ function mootploginsubmit(){
669
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
670
+ document.getElementById("mo2f_submitotp_loginform").elements[0].value = otpkey;
671
+ jQuery('#mo2f_submitotp_loginform').submit();
672
+
673
+ }
674
+
675
+ jQuery('#mo2fa_softtokenkey').keypress(function(e){
676
+ if(e.which == 13){//Enter key pressed
677
+ e.preventDefault();
678
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
679
+ document.getElementById("mo2f_submitotp_loginform").elements[0].value = otpkey;
680
+ jQuery('#mo2f_submitotp_loginform').submit();
681
+ }
682
+
683
+ });
684
+
685
+
686
+
687
+ </script>
688
+ <?php
689
+ }
690
+
691
+ function mo2f_get_device_form(){
692
+ ?>
693
+ <div class="miniorange_trust_device">
694
+
695
+ <div id="mo_2_factor_push_page" class="miniorange-inner-push-login-container">
696
+ <div id="pushSection">
697
+ <span><h2 style="padding:5px;background-color:beige;">Remember Device</h2></span>
698
+ <br>
699
+ <div id="mo_device_title" style="margin-bottom:10%;padding-top:6%;">
700
+ <center>
701
+ <h3>Do you want to remember this device?</h3>
702
+ </center>
703
+ </div>
704
+ <br />
705
+ <div id="mo2f_device_content">
706
+ <center>
707
+ <input type="button" name="miniorange_trust_device_yes" onclick="mo_check_device_confirm();" id="miniorange_trust_device_yes" class="miniorange-button mo_green" style="margin-right:5%;" value="Yes" />
708
+
709
+ <input type="button" name="miniorange_trust_device_no" onclick="mo_check_device_cancel();" id="miniorange_trust_device_no" class="miniorange-button mo_red" value="No" />
710
+ </center>
711
+ </div>
712
+ <div id="showLoadingBar" hidden>
713
+ <center>
714
+ <h3>Please wait...We are taking you into your account.</h3>
715
+
716
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" />
717
+ </center>
718
+ </div>
719
+ <br /><br />
720
+ <center>
721
+ <span>
722
+ Click on <i><b>Yes</b></i> if this is your personal device.<br />
723
+ Click on <i><b>No</b></i> if this is a public device.
724
+ </span>
725
+ </center>
726
+
727
+ <br /><br />
728
+
729
+ <div><center><input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" /></center></div>
730
+ <br />
731
+
732
+ </div>
733
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
734
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
735
+ <?php }?>
736
+ </div>
737
+
738
+ </div>
739
+ <script>
740
+ jQuery("div#login").hide();
741
+ jQuery("body.login div#login").before(jQuery('.miniorange_trust_device'));
742
+ function mologinback(){
743
+ jQuery('#mo2f_backto_mo_loginform').submit();
744
+ }
745
+ function mo_check_device_confirm(){
746
+ jQuery('#mo2f_device_content').hide();
747
+ jQuery('#mo_device_title').hide();
748
+ jQuery('#showLoadingBar').show();
749
+ jQuery('#mo2f_trust_device_confirm_form').submit();
750
+ }
751
+ function mo_check_device_cancel(){
752
+ jQuery('#mo2f_device_content').hide();
753
+ jQuery('#mo_device_title').hide();
754
+ jQuery('#showLoadingBar').show();
755
+ jQuery('#mo2f_trust_device_cancel_form').submit();
756
+ }
757
+ </script>
758
+ <?php
759
+ }
760
+ ?>
miniorange_2_factor_configuration.php ADDED
@@ -0,0 +1,617 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function mo_2_factor_register($current_user) {
3
+ if(mo_2factor_is_curl_installed()==0){ ?>
4
+ <p style="color:red;">(Warning: <a href="http://php.net/manual/en/curl.installation.php" target="_blank">PHP CURL extension</a> is not installed or disabled)</p>
5
+ <?php
6
+ }
7
+
8
+ if(version_compare(PHP_VERSION, '5.3.0') < 0){
9
+ ?>
10
+ <p style="color:red;"><b><span style="font-size:18px;">(Warning:</span></b> Your current PHP version is <?php echo PHP_VERSION; ?>. Some of the functionality of the plugin may not work in this version of PHP. Please upgrade your PHP version to 5.3.0 or above.<br/> You can also write us by submitting a query on the right hand side in our <b>Support Section</b>. )</p>
11
+ <?php
12
+ }
13
+
14
+
15
+ $mo2f_active_tab = isset($_GET['mo2f_tab']) ? $_GET['mo2f_tab'] : '2factor_setup';
16
+
17
+
18
+ ?>
19
+
20
+ <div id="tab">
21
+ <h2 class="nav-tab-wrapper">
22
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup" class="nav-tab <?php echo $mo2f_active_tab == '2factor_setup' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab1">
23
+ <?php if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ ?>User Profile <?php }else{ ?> Account Setup <?php } ?></a>
24
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure" class="nav-tab <?php echo $mo2f_active_tab == 'mobile_configure' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab3">Setup Two-Factor</a>
25
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_login' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab2">Login Settings</a>
26
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=advance_option" class="nav-tab <?php echo $mo2f_active_tab == 'advance_option' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab2">Premium Options</a>
27
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_pricing' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab6">Licensing Plans</a>
28
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_demo' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab4">How It Works</a>
29
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_help" class="nav-tab <?php echo $mo2f_active_tab == 'mo2f_help' ? 'nav-tab-active' : ''; ?>" id="mo2f_tab5">Help & Troubleshooting</a>
30
+
31
+ </h2>
32
+ </div>
33
+
34
+
35
+ <div class="mo2f_container">
36
+ <div id="messages"></div>
37
+ <table style="width:100%;">
38
+ <tr>
39
+ <td style="width:60%;vertical-align:top;">
40
+ <?php
41
+ /* to update the status of existing customers for adding their user registration status */
42
+ if(get_option( 'mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option( 'mo2f_miniorange_admin') == $current_user->ID ){
43
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
44
+ }
45
+ /* ----------------------------------------- */
46
+
47
+ if($mo2f_active_tab == 'mobile_configure') {
48
+
49
+ $mo2f_second_factor= mo2f_get_activated_second_factor($current_user);
50
+
51
+ mo2f_select_2_factor_method($current_user,$mo2f_second_factor); //Configure 2-Factor tab
52
+
53
+ ?>
54
+ <script>
55
+ jQuery(document).ready(function(){
56
+ jQuery("#mo2f_support_table").hide();
57
+ });
58
+ </script>
59
+ <?php
60
+ }else if($mo2f_active_tab == 'mo2f_help'){
61
+ unset($_SESSION[ 'mo2f_google_auth' ]);
62
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
63
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
64
+ mo2f_show_help_and_troubleshooting($current_user); //Help & Troubleshooting tab
65
+ }else if($mo2f_active_tab == 'mo2f_demo'){
66
+ unset($_SESSION[ 'mo2f_google_auth' ]);
67
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
68
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
69
+ show_2_factor_login_demo($current_user);
70
+ }else if(current_user_can( 'manage_options' ) && $mo2f_active_tab == 'mo2f_login'){
71
+ unset($_SESSION[ 'mo2f_google_auth' ]);
72
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
73
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
74
+ show_2_factor_login_settings($current_user); //Login Settings tab
75
+ }else if(current_user_can( 'manage_options' ) && $mo2f_active_tab == 'advance_option'){
76
+ unset($_SESSION[ 'mo2f_google_auth' ]);
77
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
78
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
79
+ show_2_factor_advanced_options($current_user); //Login Settings tab
80
+ }else if(current_user_can( 'manage_options' ) && $mo2f_active_tab == 'mo2f_pricing'){
81
+ unset($_SESSION[ 'mo2f_google_auth' ]);
82
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
83
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
84
+ show_2_factor_pricing_page($current_user); //Login Settings tab
85
+ }else{
86
+
87
+ unset($_SESSION[ 'mo2f_google_auth' ]);
88
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
89
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
90
+ if(get_option( 'mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option( 'mo2f_miniorange_admin') != $current_user->ID){
91
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE'){
92
+ mo2f_show_user_otp_validation_page(); // OTP over email validation page
93
+ } else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION'){ //displaying user profile
94
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
95
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor);
96
+ } else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
97
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
98
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor); //displaying user profile
99
+ }else{
100
+ show_user_welcome_page($current_user); //Landing page for additional admin for registration
101
+ }
102
+ }
103
+ else{
104
+
105
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_SUCCESS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_OTP_DELIVERED_FAILURE'){
106
+ mo2f_show_otp_validation_page($current_user); // OTP over email validation page for admin
107
+ } else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION'){ //displaying user profile
108
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
109
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor);
110
+ } else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
111
+ $mo2f_second_factor = mo2f_get_activated_second_factor($current_user);
112
+ mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor); //displaying user profile
113
+
114
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_VERIFY_CUSTOMER') {
115
+ mo2f_show_verify_password_page(); //verify password page
116
+ } else if(!mo2f_is_customer_registered()){
117
+ delete_option('password_mismatch');
118
+ mo2f_show_new_registration_page($current_user); //new registration page
119
+ }
120
+ }
121
+
122
+ }
123
+ ?>
124
+ </td>
125
+ <td style="vertical-align:top;padding-left:1%;" id="mo2f_support_table">
126
+ <?php if(!($mo2f_active_tab == 'mobile_configure' || $mo2f_active_tab == 'mo2f_pricing')) {echo mo2f_support(); }?>
127
+ </td>
128
+ </tr>
129
+ </table>
130
+ </div>
131
+ <?php
132
+ }
133
+
134
+ function mo2f_show_new_registration_page($current_user) {
135
+
136
+ ?>
137
+
138
+ <!-- Modal -->
139
+ <div id="clefMigration" class="mo2f_modal fade" role="dialog">
140
+ <div class="mo2f_modal-dialog">
141
+ <!-- Modal content-->
142
+ <div class="mo2f_modal-content" style="width:660px !important;">
143
+ <div class="mo2f_modal-header">
144
+ <button type="button" class="mo2f_close" data-dismiss="modal">&times;</button>
145
+ <h2 class="mo2f_modal-title">Follow these steps if you are migrating from Clef.</h2>
146
+ </div>
147
+ <div class="mo2f_modal-body">
148
+ <div class="mo2f_help_container">
149
+ <div id="myCarouse_first" class="mo2f_carousel slide" data-ride="carousel" >
150
+ <ol class="mo2f_carousel-indicators">
151
+ <li data-target="#myCarouse_first" data-slide-to="0" class="active"></li>
152
+ <li data-target="#myCarouse_first" data-slide-to="1"></li>
153
+ <li data-target="#myCarouse_first" data-slide-to="2"></li>
154
+ <li data-target="#myCarouse_first" data-slide-to="3"></li>
155
+ <li data-target="#myCarouse_first" data-slide-to="4"></li>
156
+ </ol>
157
+ <div class="mo2f_carousel-inner" role="listbox">
158
+ <div class="item active">
159
+ <center><p><b>Step 1.</b> Enter your Email to setup the QR Code.</p></center>
160
+ <img class="first-slide" style="padding-left:3%;" src="<?php echo plugins_url('includes/images/help/step1.png', __FILE__ ) ?>" alt="First slide">
161
+ </div>
162
+ <div class="item">
163
+ <center><p><b>Step 2.</b> Enter the OTP to verify your email</p></center>
164
+ <img class="first-slide" style="padding-left:3%;" src="<?php echo plugins_url('includes/images/help/step2.png', __FILE__ ) ?>" alt="First slide">
165
+ </div>
166
+ <div class="item">
167
+ <center><p><b>Step 3.</b> Select QR Code radio button to configure the authentication method</p></center>
168
+ <img class="first-slide" style="padding-left:3%;" src="<?php echo plugins_url('includes/images/help/step3.png', __FILE__ ) ?>" alt="First slide">
169
+ </div>
170
+ <div class="item">
171
+ <center><p><b>Step 4.</b> Downlaod the miniOrange Authenticator App and Click on Configure button</p></center>
172
+ <img class="first-slide" style="padding-left:3%;" src="<?php echo plugins_url('includes/images/help/step4.png', __FILE__ ) ?>" alt="First slide">
173
+ </div>
174
+ <div class="item">
175
+ <center><p><b>Step 5.</b> Scan the QR Code from miniOrange Authenticator App and you are done.</p></center>
176
+ <img class="first-slide" style="padding-left:3%;" src="<?php echo plugins_url('includes/images/help/step5.png', __FILE__ ) ?>" alt="First slide">
177
+ </div>
178
+ </div>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ <div class="mo2f_modal-footer">
183
+ <button type="button" class="button button-primary" data-dismiss="modal">Close</button>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+
190
+ <!--Register with miniOrange-->
191
+ <form name="f" method="post" action="">
192
+ <input type="hidden" name="option" value="mo_auth_register_customer" />
193
+ <div class="mo2f_table_layout">
194
+ <h3><span>Register with miniOrange</span><span style="float:right;color:red;"><button type="button" class="button button-primary button-large" data-toggle="modal" data-target="#clefMigration">Migrating From Clef?</button></span></h3><hr>
195
+ <div id="panel1">
196
+ <div><b>Please enter a valid email id that you have access to. You will be able to move forward after verifying an OTP that we will be sending to this email. <a href="#mo2f_account_exist">Already registered with miniOrange?</a></b></div>
197
+ <p class="float-right"><font color="#FF0000">*</font> Indicates Required Fields</p>
198
+ <table class="mo2f_settings_table">
199
+ <tr>
200
+ <td><b><font color="#FF0000">*</font>Email :</b></td>
201
+ <td><input class="mo2f_table_textbox" type="email" name="email" required placeholder="person@example.com" value="<?php if(get_option('mo2f_email')){echo get_option('mo2f_email');}else{echo $current_user->user_email;}?>"/></td>
202
+ </tr>
203
+ <tr>
204
+ <td><b><font color="#FF0000">*</font>Company/Organisation:</b></td>
205
+ <td><input class="mo2f_table_textbox" type="text" name="company"
206
+ required placeholder="Your company name"
207
+ value="<?php echo (get_option('mo2f_admin_company') == '') ? site_url() : get_option('mo2f_admin_company');?>" /></td>
208
+ </tr>
209
+ <tr>
210
+ <td><b>First Name:</b></td>
211
+ <td><input class="mo2f_table_textbox" type="text" name="first_name"
212
+ placeholder="First Name"
213
+ value="<?php echo (get_option('mo2f_admin_first_name') == '') ? $current_user->first_name : get_option('mo2f_admin_first_name');?>" /></td>
214
+ </tr>
215
+ <tr>
216
+ <td><b>Last Name:</b></td>
217
+ <td><input class="mo2f_table_textbox" type="text" name="last_name"
218
+ placeholder="Last Name"
219
+ value="<?php echo (get_option('mo2_admin_last_name') == '') ? $current_user->last_name : get_option('mo2_admin_last_name');?>" /></td>
220
+ </tr>
221
+
222
+ <tr>
223
+ <td><b>&nbsp;&nbsp;Phone number :</b></td>
224
+ <td><input class="mo2f_table_textbox" style="width:100% !important;" type="text" name="phone" pattern="[\+]?([0-9]{1,4})?\s?([0-9]{7,12})?" id="phone" autofocus="true" value="<?php echo get_user_meta($current_user->ID,'mo2f_user_phone',true);?>" />
225
+ This is an optional field. We will contact you only if you need support.</td>
226
+ </tr>
227
+
228
+ <tr>
229
+ <td><b><font color="#FF0000">*</font>Password :</b></td>
230
+ <td><input class="mo2f_table_textbox" type="password" required name="password" placeholder="Choose your password with minimun 6 characters" /></td>
231
+ </tr>
232
+ <tr>
233
+ <td><b><font color="#FF0000">*</font>Confirm Password :</b></td>
234
+ <td><input class="mo2f_table_textbox" type="password" required name="confirmPassword" placeholder="Confirm your password with minimum 6 characters" /></td>
235
+ </tr>
236
+ <tr><td>&nbsp;</td></tr>
237
+ <tr>
238
+ <td>&nbsp;</td>
239
+ <td><input type="submit" name="submit" value="Submit" class="button button-primary button-large" /></td>
240
+ </tr>
241
+ </table>
242
+ <br>
243
+
244
+ </div>
245
+ </div>
246
+ </form>
247
+ <form name="f" method="post" action="" id="mo2f_verify_customerform" >
248
+ <input type="hidden" name="option" value="mo2f_goto_verifycustomer">
249
+ </form>
250
+
251
+ <script>
252
+ jQuery("#phone").intlTelInput();
253
+ jQuery('a[href=\"#mo2f_account_exist\"]').click(function(e) {
254
+ jQuery('#mo2f_verify_customerform').submit();
255
+ });
256
+ </script>
257
+ <?php
258
+ }
259
+
260
+ function mo2f_show_otp_validation_page($current_user){
261
+ ?>
262
+ <!-- Enter otp -->
263
+
264
+ <div class="mo2f_table_layout">
265
+ <h3>Validate OTP</h3><hr>
266
+ <div id="panel1">
267
+ <table class="mo2f_settings_table">
268
+ <form name="f" method="post" id="mo_2f_otp_form" action="">
269
+ <input type="hidden" name="option" value="mo_2factor_validate_otp" />
270
+ <tr>
271
+ <td><b><font color="#FF0000">*</font>Enter OTP:</b></td>
272
+ <td colspan="2"><input class="mo2f_table_textbox" autofocus="true" type="text" name="otp_token" required placeholder="Enter OTP" style="width:95%;"/></td>
273
+ <td><a href="#resendotplink">Resend OTP ?</a></td>
274
+ </tr>
275
+
276
+ <tr>
277
+ <td>&nbsp;</td>
278
+ <td style="width:17%">
279
+ <input type="submit" name="submit" value="Validate OTP" class="button button-primary button-large" /></td>
280
+
281
+ </form>
282
+ <form name="f" method="post" action="">
283
+ <td>
284
+ <input type="hidden" name="option" value="mo_2factor_gobackto_registration_page"/>
285
+ <input type="submit" name="mo2f_goback" id="mo2f_goback" value="Back" class="button button-primary button-large" /></td>
286
+ </form>
287
+ </td>
288
+ </tr>
289
+ <form name="f" method="post" action="" id="resend_otp_form">
290
+ <input type="hidden" name="option" value="mo_2factor_resend_otp"/>
291
+ </form>
292
+
293
+ </table>
294
+ <br>
295
+ <hr>
296
+
297
+ <h3>I did not recieve any email with OTP . What should I do ?</h3>
298
+ <form id="phone_verification" method="post" action="">
299
+ <input type="hidden" name="option" value="mo_2factor_phone_verification" />
300
+ If you can't see the email from miniOrange in your mails, please check your <b>SPAM Folder</b>. If you don't see an email even in SPAM folder, verify your identity with our alternate method.
301
+ <br><br>
302
+ <b>Enter your valid phone number here and verify your identity using one time passcode sent to your phone.</b>
303
+ <br><br>
304
+ <table>
305
+ <tr>
306
+ <td>
307
+ <input class="mo2f_table_textbox" required autofocus="true" type="text" name="phone_number" id="phone" placeholder="Enter Phone Number" value="<?php echo get_user_meta( $current_user->ID,'mo2f_user_phone',true); ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" title="Enter phone number without any space or dashes."/>
308
+ </td>
309
+ <td>
310
+ <a href="#resendsmsotplink">Resend OTP ?</a>
311
+ </td>
312
+ </tr>
313
+ </table>
314
+ <br><input type="submit" value="Send OTP" class="button button-primary button-large" />
315
+
316
+ </form>
317
+ <br>
318
+ <h3>What is an OTP ?</h3>
319
+ <p>OTP is a one time passcode ( a series of numbers) that is sent to your email or phone number to verify that you have access to your email account or phone. </p>
320
+ </div>
321
+ <div>
322
+ <script>
323
+ jQuery("#phone").intlTelInput();
324
+ jQuery('a[href=\"#resendotplink\"]').click(function(e) {
325
+ jQuery('#resend_otp_form').submit();
326
+ });
327
+ jQuery('a[href=\"#resendsmsotplink\"]').click(function(e) {
328
+ jQuery('#phone_verification').submit();
329
+ });
330
+ </script>
331
+
332
+ <br><br>
333
+ </div>
334
+
335
+
336
+
337
+ </div>
338
+
339
+ <?php
340
+ }
341
+
342
+ function miniorange_2_factor_user_roles($current_user,$random_mo_key) {
343
+
344
+ global $wp_roles;
345
+ if (!isset($wp_roles))
346
+ $wp_roles = new WP_Roles();
347
+
348
+ print '<div>';
349
+ if($random_mo_key){
350
+ foreach($wp_roles->role_names as $id => $name) {
351
+ $setting = get_option('mo2fa_'.$id);
352
+ if($id == 'administrator'){ ?>
353
+ <input type="checkbox" name="<?php echo 'mo2fa_'.$id; ?>" value="1" <?php checked($setting == 1); if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> /><?php echo $name; ?><span style="float:right;">You can enable the following roles in the premium plugin.</span><br />
354
+ <?php }else{ ?>
355
+ <div class="mo2f_grayed_out">
356
+ <input type="checkbox" name="<?php echo 'mo2fa_'.$id; ?>" value="1" <?php checked($setting == 1); echo 'disabled' ?> /><?php echo $name; ?></div>
357
+ <?php }
358
+ }
359
+ }else{
360
+ foreach($wp_roles->role_names as $id => $name) {
361
+ $setting = get_option('mo2fa_'.$id);
362
+ ?>
363
+ <input type="checkbox" name="<?php echo 'mo2fa_'.$id; ?>" value="1" <?php checked($setting == 1); if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> /><?php echo $name; ?><br />
364
+ <?php
365
+ }
366
+ }
367
+ print '</div>';
368
+ }
369
+
370
+ function show_2_factor_login_settings($current_user) {
371
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
372
+ $random_mo_key = get_option('mo2f_new_customer');
373
+ ?>
374
+ <div class="mo2f_table_layout">
375
+ <?php echo mo2f_check_if_registered_with_miniorange($current_user); ?>
376
+
377
+ <form name="f" id="login_settings_form" method="post" action="">
378
+ <input type="hidden" name="option" value="mo_auth_login_settings_save" />
379
+ <span>
380
+ <h3>Select Roles to enable 2-Factor
381
+ <input type="submit" name="submit" value="Save Settings" style="float:right;" class="button button-primary button-large" <?php
382
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' ){ } else{ echo 'disabled' ; } ?> /></h3><span>
383
+ <hr><br>
384
+
385
+ <?php echo miniorange_2_factor_user_roles($current_user,$random_mo_key); ?>
386
+ <br>
387
+ <div id="mo2f_note"><b>Note:</b> Selecting the above roles will enable 2-Factor for all users associated with that role.Users of the selected role who have not setup their 2-Factor will be able to setup 2 factor during inline registration.</div>
388
+ <br>
389
+
390
+ <h3>Select the specific set of authentication methods for your users.<?php echo $random_mo_key ? '<span style="float:right;font-size: 13px;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing"><b>PREMIUM*</b></a></span>' : '' ?></h3><hr><br />
391
+
392
+ <div class="<?php echo $random_mo_key ? 'mo2f_grayed_out' : '' ?>">
393
+ <table><tbody>
394
+ <tr>
395
+ <td>
396
+ <input type='checkbox' name='mo2f_authmethods[]' value='OUT OF BAND EMAIL' <?php echo (in_array("OUT OF BAND EMAIL", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Email Verification&nbsp;&nbsp;
397
+ </td>
398
+ <td>
399
+ <input type='checkbox' name='mo2f_authmethods[]' value='SMS' <?php echo (in_array("SMS", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />OTP Over SMS&nbsp;&nbsp;
400
+ </td>
401
+ <td>
402
+ <input type='checkbox' name='mo2f_authmethods[]' value='PHONE VERIFICATION' <?php echo (in_array("PHONE VERIFICATION", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Phone Call Verification&nbsp;&nbsp;
403
+ </td>
404
+ </tr>
405
+
406
+ <tr>
407
+ <td>
408
+ <input type='checkbox' name='mo2f_authmethods[]' value='SOFT TOKEN' <?php echo (in_array("SOFT TOKEN", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Soft Token&nbsp;&nbsp;
409
+ </td>
410
+ <td>
411
+ <input type='checkbox' name='mo2f_authmethods[]' value='MOBILE AUTHENTICATION' <?php echo (in_array("MOBILE AUTHENTICATION", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />QR Code Authentication&nbsp;&nbsp;
412
+ </td>
413
+ <td>
414
+ <input type='checkbox' name='mo2f_authmethods[]' value='PUSH NOTIFICATIONS' <?php echo (in_array("PUSH NOTIFICATIONS", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Push Notifications&nbsp;&nbsp;
415
+ </td>
416
+ </tr>
417
+
418
+ <tr>
419
+ <td>
420
+ <input type='checkbox' name='mo2f_authmethods[]' value='GOOGLE AUTHENTICATOR' <?php echo (in_array("GOOGLE AUTHENTICATOR", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Google Authenticator&nbsp;&nbsp;
421
+ </td>
422
+ <td>
423
+ <input type='checkbox' name='mo2f_authmethods[]' value='AUTHY 2-FACTOR AUTHENTICATION' <?php echo (in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />AUTHY 2-FACTOR AUTHENTICATION&nbsp;&nbsp;
424
+ </td>
425
+ <td>
426
+ <input type='checkbox' name='mo2f_authmethods[]' value='KBA' <?php echo (in_array("KBA", $opt)) ? 'checked="checked"' : ''; if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Security Questions (KBA)&nbsp;&nbsp;
427
+ </td>
428
+ </tr>
429
+ </tbody>
430
+ </table>
431
+
432
+ <br><br><div id="mo2f_note"><b>Note:</b> You can select which Two Factor methods you want to enable for your users. By default all Two Factor methods are enabled for all users of the role you have selected above.</div>
433
+
434
+ </div>
435
+ <br>
436
+ <h3>Invoke Inline Registration to setup 2nd factor for users.<?php echo $random_mo_key ? '<span style="float:right;font-size: 13px;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing" ><b>PREMIUM*</b></a></span>' : ''; ?></h3><hr><br />
437
+
438
+ <div class="<?php echo $random_mo_key ? 'mo2f_grayed_out' : '' ?>">
439
+
440
+ <input type="radio" name="mo2f_inline_registration" value="1" <?php checked( get_option('mo2f_inline_registration') == 1 );
441
+ if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
442
+ Enforce 2 Factor registration for users at login time.&nbsp;&nbsp;
443
+ <input type="radio" name="mo2f_inline_registration" value="0" <?php checked( get_option('mo2f_inline_registration') == 0 );
444
+ if(!$random_mo_key && get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
445
+ Skip 2 Factor registration at login.
446
+ <br><br>
447
+ <div id="mo2f_note"><b>Note:</b> If this option is enabled then users have to setup their two-factor account forcefully during their login. By selecting second option, you will provide your users to skip their two-factor setup during login.</div>
448
+ </div>
449
+ <br />
450
+ <h3>Mobile Support</h3><hr>
451
+ <input type="checkbox" name="mo2f_enable_mobile_support" value="1" <?php checked( get_option('mo2f_enable_mobile_support') == 1 );
452
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
453
+ Enable Mobile Support for users.<br /><br />
454
+ <div id="mo2f_note"><b>Note:</b> If this option is enabled then Security Questions (KBA) will be invoked as 2nd factor during login through mobile browsers.</div>
455
+ <br />
456
+
457
+
458
+
459
+
460
+ <h3>Select Login Screen Options</h3><hr><br>
461
+ <input type="radio" name="mo2f_login_policy" value="1"
462
+ <?php checked( get_option('mo2f_login_policy'));
463
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
464
+ Login with password + 2nd Factor <span style="color:red">(Recommended)</span>&nbsp;&nbsp;
465
+ <br><br>
466
+ <div id="mo2f_note"><b>Note:</b> By default 2nd Factor is enabled after password authentication. If you do not want to remember passwords anymore and just login with 2nd Factor, please select 2nd option.</div>
467
+ <br>
468
+
469
+ <div style="margin-left:6%;" >
470
+ <input type="checkbox" id="mo2f_deviceid_enabled" name="mo2f_deviceid_enabled" value="1" <?php checked( get_option('mo2f_deviceid_enabled') == 1 );
471
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />Enable '<b>Remember device</b>' option <br /><span style="color:red;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Applicable only with <i>Login with password + 2nd Factor)</i></span><br />
472
+ <br />
473
+ <div id="mo2f_note"><b>Note:</b> Checking this option will display an option '<b>Remember this device</b>' on 2nd factor screen. In the next login from the same device, user will bypass 2nd factor, i.e. user will be logged in through username + password only.</div>
474
+ </div>
475
+
476
+ <br>
477
+
478
+ <input type="radio" name="mo2f_login_policy" value="0"
479
+ <?php checked( !get_option('mo2f_login_policy'));
480
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
481
+ Login with 2nd Factor only <span style="color:red">(No password required.)</span> &nbsp;<a class="btn btn-link" data-toggle="collapse" href="#preview1" aria-expanded="false">See preview</a>
482
+ <br>
483
+ <div class="mo2f_collapse" id="preview1" style="height:300px;">
484
+ <center><br>
485
+ <img style="height:300px;" src="https://auth.miniorange.com/moas/images/help/login-help-1.png" >
486
+ </center>
487
+ </div>
488
+ <br><div id="mo2f_note"><b>Note:</b> Checking this option will add login with your phone button below default login form. Click above link to see the preview.</div>
489
+ <div id="loginphonediv" hidden> <br>
490
+ <input type="checkbox" id="mo2f_loginwith_phone" name="mo2f_loginwith_phone" value="1" <?php checked( get_option('mo2f_show_loginwith_phone') == 1 );
491
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
492
+ I want to hide default login form. &nbsp;<a class="btn btn-link" data-toggle="collapse" href="#preview2" aria-expanded="false">See preview</a>
493
+ <br>
494
+ <div class="mo2f_collapse" id="preview2" style="height:300px;">
495
+ <center><br>
496
+ <img style="height:300px;" src="https://auth.miniorange.com/moas/images/help/login-help-3.png" >
497
+ </center>
498
+ </div>
499
+ <br><div id="mo2f_note"><b>Note:</b> Checking this option will hide default login form and just show login with your phone. Click above link to see the preview.</div>
500
+
501
+ </div>
502
+ <br>
503
+ <h3>What happens if my phone is lost, discharged or not with me</h3><hr>
504
+ <br>
505
+ <input type="checkbox" id="mo2f_forgotphone" name="mo2f_forgotphone" value="1" <?php checked( get_option('mo2f_enable_forgotphone') == 1 );
506
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
507
+ Enable Forgot Phone.<?php echo $random_mo_key ? '<span style="color:red;font-size:20px;"><b>**</b></span>' : '';?>
508
+ <span style="color:red;float:right;">( If you disable this checkbox, then users will not get this option.)</span><br />
509
+ <br /><div id="mo2f_note"><b>Note:</b>This option will provide you alternate way of login in case your phone is lost, discharged or not with you.</div>
510
+ <?php echo $random_mo_key ? '<span><b>**This option will make you login through backup method.In the free version of plugin, Security Questions (KBA) will be backup method. In the premium version of the plugin, Security Questions (KBA) and OTP over Email will be backup method.</b><span>' : '';?>
511
+ <br><br />
512
+
513
+ <h3>XML-RPC Settings</h3>
514
+ <hr>
515
+ Enabling this option will decrease your overall login security. Users will be able to login through external applications which support XML-RPC without authenticating from miniOrange. <b>Please keep it unchecked.</b><br /><br />
516
+ <input type="checkbox" id="mo2f_enable_xmlrpc" name="mo2f_enable_xmlrpc" value="1" <?php checked( get_option('mo2f_enable_xmlrpc') == 1 );
517
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
518
+ Enable XML-RPC Login.
519
+
520
+ <br /><br />
521
+
522
+ <h3>Enable Two-Factor plugin</h3>
523
+ <hr>
524
+ <br>
525
+ <input type="checkbox" id="mo2f_activate_plugin" name="mo2f_activate_plugin" value="1" <?php checked( get_option('mo2f_activate_plugin') == 1 );
526
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
527
+ Enable Two-Factor plugin. <span style="color:red;">( If you disable this checkbox, Two-Factor plugin will not invoke for any user during login.)</span><br />
528
+ <br /><div id="mo2f_note"><b>Note:</b> Disabling this option will allow all users to login with their username and password.Two-Factor will not invoke during login.</div>
529
+ <br>
530
+
531
+ <br>
532
+ <input type="submit" name="submit" value="Save Settings" class="button button-primary button-large" <?php
533
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' ){ } else{ echo 'disabled' ; } ?> />
534
+ <br /><br />
535
+ <?php echo $random_mo_key ? '<div><b>*</b>These are premium features. You need to upgrade the plugin to use these features.</div>' : '' ?>
536
+ <br /></br>
537
+ </form>
538
+ <script>
539
+
540
+ if(jQuery("input[name=mo2f_login_policy]:radio:checked").val() == 0){
541
+ jQuery('#loginphonediv').show();
542
+ }
543
+ jQuery("input[name=mo2f_login_policy]:radio").change(function () {
544
+ if (this.value == 1) {
545
+ jQuery('#loginphonediv').hide();
546
+ }else{
547
+ jQuery('#loginphonediv').show();
548
+ }
549
+ });
550
+
551
+ <?php
552
+ if( isset( $_REQUEST['true'] ) && get_option( 'mo2f_msg_counter') == 1 ){
553
+ $logouturl= wp_login_url() . '?action=logout';
554
+
555
+ ?>
556
+ jQuery("#messages").append("<div class='updated notice is-dismissible mo2f_success_container'> <p class='mo2f_msgs'>If you are OK with default settings. <a href=<?php echo $logouturl; ?>><b>Click Here</b></a> to logout and try login with 2-Factor.</p></div>");
557
+ <?php } ?>
558
+
559
+ </script>
560
+ </div>
561
+
562
+ <?php
563
+ }
564
+
565
+ function mo2f_show_verify_password_page() {
566
+ ?>
567
+ <!--Verify password with miniOrange-->
568
+ <form name="f" method="post" action="">
569
+ <input type="hidden" name="option" value="mo_auth_verify_customer" />
570
+ <div class="mo2f_table_layout">
571
+ <h3>Login with miniOrange</h3><hr>
572
+ <div id="panel1">
573
+ <p><b>It seems you already have an account with miniOrange. Please enter your miniOrange email and password. <a href="#forgot_password">Click here if you forgot your password ?</a></b></p>
574
+ <br/>
575
+ <table class="mo2f_settings_table">
576
+ <tr>
577
+ <td><b><font color="#FF0000">*</font>Email:</b></td>
578
+ <td><input class="mo2f_table_textbox" type="email" name="email" id="email" required placeholder="person@example.com" value="<?php echo get_option('mo2f_email');?>"/></td>
579
+ </tr>
580
+ <tr>
581
+ <td><b><font color="#FF0000">*</font>Password:</b></td>
582
+ <td><input class="mo2f_table_textbox" type="password" name="password" required placeholder="Enter your miniOrange password" /></td>
583
+ </tr>
584
+ <tr><td colspan="2">&nbsp;</td></tr>
585
+ <tr>
586
+ <td>&nbsp;</td>
587
+ <td>
588
+ <input type="button" name="mo2f_goback" id="mo2f_go_back" value="Back" class="button button-primary button-large" />
589
+
590
+ <input type="submit" name="submit" value="Submit" class="button button-primary button-large" /></td>
591
+
592
+ </tr>
593
+
594
+ </table>
595
+
596
+ </div><br><br>
597
+ </div>
598
+ </form>
599
+ <form name="f" method="post" action="" id="gobackform">
600
+ <input type="hidden" name="option" value="mo_2factor_gobackto_registration_page"/>
601
+ </form>
602
+ <form name="f" method="post" action="" id="forgotpasswordform">
603
+ <input type="hidden" name="email" id="hidden_email" />
604
+ <input type="hidden" name="option" value="mo_2factor_forgot_password"/>
605
+ </form>
606
+ <script>
607
+ jQuery('#mo2f_go_back').click(function(){
608
+ jQuery('#gobackform').submit();
609
+ });
610
+ jQuery('a[href=\"#forgot_password\"]').click(function(){
611
+ var email = jQuery('#email').val();
612
+ jQuery('#hidden_email').val(email);
613
+ jQuery('#forgotpasswordform').submit();
614
+ });
615
+ </script>
616
+ <?php }
617
+ ?>
miniorange_2_factor_demo.php ADDED
@@ -0,0 +1,523 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="mo2f_table_layout">
2
+ <?php echo mo2f_check_if_registered_with_miniorange($current_user); ?>
3
+
4
+ <h3>How to Setup OTP Over SMS ?
5
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
6
+ <div class="mo2f_help_container">
7
+ <div id="myCarousel8" class="mo2f_carousel slide" data-ride="carousel" >
8
+ <ol class="mo2f_carousel-indicators">
9
+ <li data-target="#myCarousel8" data-slide-to="0" class="active"></li>
10
+ <li data-target="#myCarousel8" data-slide-to="1"></li>
11
+ <li data-target="#myCarousel8" data-slide-to="2"></li>
12
+ <li data-target="#myCarousel8" data-slide-to="3"></li>
13
+
14
+
15
+ </ol>
16
+ <div class="mo2f_carousel-inner" role="listbox">
17
+ <div class="item active">
18
+ <center><p>Select OTP Over SMS from Setup Two-Factor Tab.</p></center>
19
+ <img class="first-slide" style="padding-left:3%;" src="https://auth.miniorange.com/moas/images/help/mo2f_sms1.png" alt="First slide">
20
+ </div>
21
+ <div class="item">
22
+ <center><p>Enter your phone number and click on verify button.</p></center>
23
+ <img class="first-slide" style="padding-left:13%;" src="https://auth.miniorange.com/moas/images/help/mo2f_sms2.png" alt="First slide">
24
+ </div>
25
+ <div class="item">
26
+ <p>A one time passcode is sent to your mobile number. Enter the one time passcode here and click on <b>Validate OTP</b> button.</p>
27
+ <img class="first-slide" style="padding-left:13%;" src="https://auth.miniorange.com/moas/images/help/mo2f_sms3.png" alt="First slide">
28
+ </div>
29
+ <div class="item">
30
+ <center><p>OTP Over SMS is all setup now.</p></center>
31
+ <img class="first-slide" style="padding-left:3%;" src="https://auth.miniorange.com/moas/images/help/mo2f_sms4.png" alt="First slide">
32
+ </div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </center>
37
+ <div id="demo1">
38
+ <br>
39
+ <h3>How to Setup Soft Token ?
40
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
41
+ <center>
42
+ <div class="mo2f_help_container">
43
+ <div id="myCarousel7" class="mo2f_carousel slide" data-ride="carousel" >
44
+ <ol class="mo2f_carousel-indicators">
45
+ <li data-target="#myCarousel7" data-slide-to="0" class="active"></li>
46
+ <li data-target="#myCarousel7" data-slide-to="1"></li>
47
+ <li data-target="#myCarousel7" data-slide-to="2"></li>
48
+ <li data-target="#myCarousel7" data-slide-to="3"></li>
49
+ <li data-target="#myCarousel7" data-slide-to="4"></li>
50
+ <li data-target="#myCarousel7" data-slide-to="5"></li>
51
+ <li data-target="#myCarousel7" data-slide-to="6"></li>
52
+ <li data-target="#myCarousel7" data-slide-to="7"></li>
53
+
54
+ </ol>
55
+ <div class="mo2f_carousel-inner" role="listbox">
56
+ <div class="item active">
57
+ <p>Select Soft Token from Setup Two-Factor Tab.</p>
58
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_1.png" alt="First slide">
59
+ </div>
60
+ <div class="item">
61
+ <p>Download the miniOrange Authenticator App on your phone. Then click on <b>Configure Your Phone</b> button.</p>
62
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_2.png" alt="First slide">
63
+ </div>
64
+ <div class="item">
65
+ <p>Scan the QR Code from your phone.</p>
66
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/user-register-4.png" alt="First slide">
67
+ </div>
68
+ <div class="item">
69
+ <p>Open your App and click on <b>Configure</b> button.</p>
70
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_3.png" alt="First slide">
71
+ </div>
72
+ <div class="item">
73
+ <p>Scan the QR Code by focusing the phone on QR Code.</p>
74
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_4.png" alt="First slide">
75
+ </div>
76
+ <div class="item">
77
+ <p>Registration successfully.</p>
78
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_5.png" alt="First slide">
79
+ </div>
80
+ <div class="item">
81
+ <p><br></p>
82
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/user-register-5.png" alt="First slide">
83
+ </div>
84
+ <div class="item">
85
+ <p>Soft Token is set now.</p>
86
+ <img class="first-slide" style="width:84%;" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_6.png" alt="First slide">
87
+ </div>
88
+
89
+ </div>
90
+ </div>
91
+ </div>
92
+ </center>
93
+ </div>
94
+ <div id="demo2">
95
+ <br>
96
+ <h3>How To Setup Phone Call Verification ?
97
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
98
+ <center>
99
+ <div class="mo2f_help_container">
100
+ <div id="myCarousel6" class="mo2f_carousel slide" data-ride="carousel" >
101
+ <ol class="mo2f_carousel-indicators">
102
+ <li data-target="#myCarousel6" data-slide-to="0" class="active"></li>
103
+ <li data-target="#myCarousel6" data-slide-to="1"></li>
104
+ <li data-target="#myCarousel6" data-slide-to="2"></li>
105
+ <li data-target="#myCarousel6" data-slide-to="3"></li>
106
+ </ol>
107
+ <div class="mo2f_carousel-inner" role="listbox">
108
+ <div class="item active">
109
+ <p>Select phone call verfication from Setup Two-Factor Tab.</p>
110
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_phone_1.png" alt="First slide">
111
+ </div>
112
+ <div class="item">
113
+ <p>Enter your phone number and click on verify button.You will receive a phone call on this number.</p>
114
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_sms2.png" alt="First slide">
115
+ </div>
116
+ <div class="item">
117
+ <p>Enter the one time passcode here and click on <b>Validate OTP</b> button.</p>
118
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_phone_2.png" alt="First slide">
119
+ </div>
120
+ <div class="item">
121
+ <p>Phone Call verification is set now.</p>
122
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_phone_3.png" alt="First slide">
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </center>
128
+ </div>
129
+ <div id="demo3">
130
+ <br>
131
+ <h3>How to Setup QR Code Authentication / Push Notification ?
132
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
133
+ <center>
134
+ <div class="mo2f_help_container">
135
+ <div id="myCarousel9" class="mo2f_carousel slide" data-ride="carousel" >
136
+ <ol class="mo2f_carousel-indicators">
137
+ <li data-target="#myCarousel9" data-slide-to="0" class="active"></li>
138
+ <li data-target="#myCarousel9" data-slide-to="1"></li>
139
+ <li data-target="#myCarousel9" data-slide-to="2"></li>
140
+ <li data-target="#myCarousel9" data-slide-to="3"></li>
141
+ <li data-target="#myCarousel9" data-slide-to="4"></li>
142
+ <li data-target="#myCarousel9" data-slide-to="5"></li>
143
+ <li data-target="#myCarousel9" data-slide-to="6"></li>
144
+ <li data-target="#myCarousel9" data-slide-to="7"></li>
145
+
146
+ </ol>
147
+ <div class="mo2f_carousel-inner" role="listbox">
148
+ <div class="item active">
149
+ <p>Select QR Code Authentication/Push Notifications from Setup Two-Factor Tab.</p>
150
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_qr_1.png" alt="First slide">
151
+ </div>
152
+ <div class="item">
153
+ <p>Download the miniOrange Authenticator App on your phone. Then click on <b>Configure Your Phone</b> button.</p>
154
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_2.png" alt="First slide">
155
+ </div>
156
+ <div class="item">
157
+ <p>Sacn the QR Code from your phone.</p>
158
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/user-register-4.png" alt="First slide">
159
+ </div>
160
+ <div class="item">
161
+ <p>Open your App and click on <b>Configure</b> button.</p>
162
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_3.png" alt="First slide">
163
+ </div>
164
+ <div class="item">
165
+ <p>Scan the QR Code by focusing the phone on QR Code.</p>
166
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_4.png" alt="First slide">
167
+ </div>
168
+ <div class="item">
169
+ <p>Registration successfully.</p>
170
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_softtoken_5.png" alt="First slide">
171
+ </div>
172
+ <div class="item">
173
+ <p><br></p>
174
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/user-register-5.png" alt="First slide">
175
+ </div>
176
+ <div class="item">
177
+ <p>QR Code Authentication/Push Notifications is all setup now.</p>
178
+ <img class="first-slide" style="width:84%;" src="https://auth.miniorange.com/moas/images/help/mo2f_qr_2.png" alt="First slide">
179
+ </div>
180
+
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </center>
185
+ </div>
186
+ <div id="demo5">
187
+ <br>
188
+ <h3>How to Setup Google Authenticator ?
189
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
190
+ <center>
191
+ <div class="mo2f_help_container">
192
+ <div id="myCarousel10" class="mo2f_carousel slide" data-ride="carousel" >
193
+ <ol class="mo2f_carousel-indicators">
194
+ <li data-target="#myCarousel10" data-slide-to="0" class="active"></li>
195
+ <li data-target="#myCarousel10" data-slide-to="1"></li>
196
+
197
+
198
+
199
+ </ol>
200
+ <div class="mo2f_carousel-inner" role="listbox">
201
+ <div class="item active">
202
+ <p>Select Google Authenticator from Setup Two-Factor Tab.</p>
203
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/google_app_setup-1.png" alt="First slide">
204
+ </div>
205
+ <div class="item">
206
+ <p>Download Google Authenticator App on your phone. Select your phone type on the screen.</p>
207
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/google_app_setup.png" alt="First slide">
208
+ </div>
209
+
210
+ </div>
211
+ </div>
212
+ </div>
213
+ </center>
214
+ </div>
215
+ <div id="demo6">
216
+ <br>
217
+ <h3>How to Setup Security Questions (KBA) ?
218
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
219
+ <center>
220
+ <div class="mo2f_help_container">
221
+ <div id="myCarousel12" class="mo2f_carousel slide" data-ride="carousel" >
222
+ <ol class="mo2f_carousel-indicators">
223
+ <li data-target="#myCarousel12" data-slide-to="0" class="active"></li>
224
+ <li data-target="#myCarousel12" data-slide-to="1"></li>
225
+ <li data-target="#myCarousel12" data-slide-to="2"></li>
226
+
227
+
228
+ </ol>
229
+ <div class="mo2f_carousel-inner" role="listbox">
230
+ <div class="item active">
231
+ <p>Select Security Questions from Setup Two-Factor Tab.</p>
232
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/kba-setup-1.png" alt="First slide">
233
+ </div>
234
+ <div class="item">
235
+ <p>Select 3 questions of your choice.</p>
236
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/kba-setup-2.png" alt="First slide">
237
+ </div>
238
+ <div class="item">
239
+ <p>Save your answers.</p>
240
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/kba-setup-3.png" alt="First slide">
241
+ </div>
242
+
243
+
244
+ </div>
245
+ </div>
246
+ </div>
247
+ </center>
248
+ </div>
249
+ <div id="demo4">
250
+ <h3>How to Test Soft Token
251
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
252
+ <center>
253
+ <div class="mo2f_help_container">
254
+ <div id="myCarousel15" class="mo2f_carousel slide" data-ride="carousel">
255
+ <!-- Indicators -->
256
+
257
+
258
+ <ol class="mo2f_carousel-indicators">
259
+ <li data-target="#myCarousel15" data-slide-to="0" class="active"></li>
260
+ <li data-target="#myCarousel15" data-slide-to="1"></li>
261
+ <li data-target="#myCarousel15" data-slide-to="2"></li>
262
+ <li data-target="#myCarousel15" data-slide-to="3"></li>
263
+
264
+ </ol>
265
+ <div class="mo2f_carousel-inner" role="listbox">
266
+
267
+
268
+ <div class="item active">
269
+ <p>Open miniOrange Authenticator app and click on settings icon on top right corner.</p><br>
270
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
271
+ </div>
272
+ <div class="item">
273
+ <p>Click on Sync button below to sync your time with miniOrange Servers. This is a one time sync to avoid otp validation failure.</p><br>
274
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-3.png" alt="First slide">
275
+ </div>
276
+ <div class="item">
277
+ <p>Go to Soft Token tab.</p><br>
278
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-2.png" alt="First slide">
279
+ </div>
280
+ <div class="item">
281
+ <p>Enter the one time passcode shown in miniOrange Authenticator app here.</p><br>
282
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_testsoft_1.png" alt="First slide">
283
+ </div>
284
+ </div>
285
+ </div>
286
+ </div>
287
+ </div>
288
+ <br />
289
+ <h3>How to Login with Password + Two-Factor ?
290
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
291
+ <center>
292
+ <div class="mo2f_help_container">
293
+
294
+ <div id="myCarousel4" class="mo2f_carousel slide" data-ride="carousel" >
295
+
296
+ <ol class="mo2f_carousel-indicators">
297
+ <li data-target="#myCarousel4" data-slide-to="0" class="active"></li>
298
+ <li data-target="#myCarousel4" data-slide-to="1"></li>
299
+ <li data-target="#myCarousel4" data-slide-to="2"></li>
300
+ <li data-target="#myCarousel4" data-slide-to="3"></li>
301
+ <li data-target="#myCarousel4" data-slide-to="4"></li>
302
+ <li data-target="#myCarousel4" data-slide-to="5"></li>
303
+ <li data-target="#myCarousel4" data-slide-to="6"></li>
304
+ </ol>
305
+ <div class="mo2f_carousel-inner" role="listbox">
306
+ <div class="item active">
307
+ <p>Enter your username and password and click on login button.</p>
308
+
309
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-4.png" alt="First slide">
310
+
311
+ </div>
312
+ <div class="item">
313
+ <p><br></p>
314
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
315
+
316
+ </div>
317
+ <div class="item">
318
+ <p>Open miniOrange Authenticator app and click on Authenticate.</p>
319
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
320
+
321
+ </div>
322
+ <div class="item">
323
+ <p><br></p>
324
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-3.png" alt="First slide">
325
+ </div>
326
+ <div class="item">
327
+ <p><br></p>
328
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-4.png" alt="First slide">
329
+ </div>
330
+ <div class="item">
331
+ <p><br></p>
332
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-5.png" alt="First slide">
333
+ </div>
334
+ <div class="item">
335
+ <p>Once you are authenticated, you will be logged in.</p>
336
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-2.png" alt="First slide" style="height:400px;">
337
+ </div>
338
+ </div>
339
+ </div>
340
+ </div>
341
+ </center>
342
+ <br>
343
+ <h3>How to login with 2nd Factor only (No password required)?
344
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
345
+ <center>
346
+ <div class="mo2f_help_container">
347
+ <div id="myCarousel1" class="mo2f_carousel slide" data-ride="carousel" >
348
+
349
+ <ol class="mo2f_carousel-indicators">
350
+ <li data-target="#myCarousel1" data-slide-to="0" class="active"></li>
351
+ <li data-target="#myCarousel1" data-slide-to="1"></li>
352
+ <li data-target="#myCarousel1" data-slide-to="2"></li>
353
+ <li data-target="#myCarousel1" data-slide-to="3"></li>
354
+ <li data-target="#myCarousel1" data-slide-to="4"></li>
355
+ <li data-target="#myCarousel1" data-slide-to="5"></li>
356
+ <li data-target="#myCarousel1" data-slide-to="6"></li>
357
+ </ol>
358
+ <div class="mo2f_carousel-inner" role="listbox">
359
+ <div class="item active">
360
+ <p>Enter your username and click on login with your phone.</p>
361
+ <p style="margin-left: -40px;" >Login Form Option 1<span style="margin-left:90px;">Login Form Option 2</span></p>
362
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-1.png" alt="First slide">
363
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-3.png" alt="First slide">
364
+ </div>
365
+ <div class="item">
366
+ <p><br></p>
367
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
368
+
369
+ </div>
370
+ <div class="item">
371
+ <p>Open miniOrange Authenticator app and click on Authenticate.</p>
372
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
373
+
374
+ </div>
375
+ <div class="item">
376
+ <p><br></p>
377
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-3.png" alt="First slide">
378
+ </div>
379
+ <div class="item">
380
+ <p><br></p>
381
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-4.png" alt="First slide">
382
+ </div>
383
+ <div class="item">
384
+ <p><br></p>
385
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-5.png" alt="First slide">
386
+ </div>
387
+ <div class="item">
388
+ <p>Once you are authenticated, you will be logged in.</p>
389
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-2.png" alt="First slide" style="height:400px;">
390
+ </div>
391
+ </div>
392
+ </div>
393
+ </div>
394
+ </center>
395
+ <br>
396
+ <h3>How to login in offline mode (no internet connectivity) ?
397
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
398
+ <center>
399
+ <div class="mo2f_help_container">
400
+ <div id="myCarousel2" class="mo2f_carousel slide" data-ride="carousel" >
401
+ <ol class="mo2f_carousel-indicators">
402
+ <li data-target="#myCarousel2" data-slide-to="0" class="active"></li>
403
+ <li data-target="#myCarousel2" data-slide-to="1"></li>
404
+ <li data-target="#myCarousel2" data-slide-to="2"></li>
405
+ <li data-target="#myCarousel2" data-slide-to="3"></li>
406
+ <li data-target="#myCarousel2" data-slide-to="4"></li>
407
+ <li data-target="#myCarousel2" data-slide-to="5"></li>
408
+ </ol>
409
+ <div class="mo2f_carousel-inner" role="listbox">
410
+
411
+ <div class="item active">
412
+ <p>Enter your username and click on login with your phone.</p>
413
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-1.png" alt="First slide">
414
+ </div>
415
+ <div class="item">
416
+ <p>Click on <b>Phone is Offline?</b> button.</p>
417
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
418
+ </div>
419
+
420
+ <div class="item">
421
+ <p>Open miniOrange Authenticator app and click on settings icon on top right corner.</p><br>
422
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
423
+ </div>
424
+ <div class="item">
425
+ <p>Click on Sync button below to sync your time with miniOrange Servers. This is a one time sync to avoid otp validation failure.</p><br>
426
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-3.png" alt="First slide">
427
+ </div>
428
+ <div class="item">
429
+ <p>Go to Soft Token tab.</p><br>
430
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-2.png" alt="First slide">
431
+ </div>
432
+ <div class="item">
433
+ <p>Enter the one time passcode shown in miniOrange Authenticator app here.</p><br>
434
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-4.png" alt="First slide">
435
+ </div>
436
+ </div>
437
+ </div>
438
+ </div>
439
+ </center>
440
+ <br>
441
+ <h3>How to login if your phone is not with you or lost/stolen/discharged ?
442
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
443
+ <center>
444
+ <div class="mo2f_help_container">
445
+ <div id="myCarousel3" class="mo2f_carousel slide" data-ride="carousel" >
446
+ <ol class="mo2f_carousel-indicators">
447
+ <li data-target="#myCarousel3" data-slide-to="0" class="active"></li>
448
+ <li data-target="#myCarousel3" data-slide-to="1"></li>
449
+ <li data-target="#myCarousel3" data-slide-to="2"></li>
450
+ <li data-target="#myCarousel3" data-slide-to="3"></li>
451
+ <li data-target="#myCarousel3" data-slide-to="4"></li>
452
+
453
+ </ol>
454
+ <div class="mo2f_carousel-inner" role="listbox">
455
+ <div class="item active">
456
+ <p>Enter your username and click on login with your phone.</p>
457
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-1.png" alt="First slide">
458
+ </div>
459
+ <div class="item">
460
+ <p>Click on <b>Forgot Phone?</b> button.</p>
461
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
462
+ </div>
463
+ <div class="item">
464
+ <p><br></p>
465
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-1.png" alt="First slide">
466
+ </div>
467
+ <div class="item">
468
+ <p>Check your email with which you registered and copy the one time passcode.</p><br>
469
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-2.png" alt="First slide">
470
+ </div>
471
+ <div class="item">
472
+ <p><br></p>
473
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-3.png" alt="First slide">
474
+ </div>
475
+ </div>
476
+ </div>
477
+ </div>
478
+ </center>
479
+
480
+ <br>
481
+ <?php if(current_user_can('manage_options')){ ?>
482
+ <h3 id="mo2f_user_reg">How will my users register for 2-Factor ?
483
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login">←Back</a></div></h3><hr>
484
+ <?php } else { ?>
485
+ <h3 id="mo2f_user_reg">How to register with miniOrange and configure 2-Factor ?
486
+ <div style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">←Back</a></div></h3><hr>
487
+ <?php } ?>
488
+ <center>
489
+ <div class="mo2f_help_container">
490
+ <div id="myCarousel5" class="mo2f_carousel slide" data-ride="carousel" >
491
+ <ol class="mo2f_carousel-indicators">
492
+ <li data-target="#myCarousel5" data-slide-to="0" class="active"></li>
493
+ <li data-target="#myCarousel5" data-slide-to="1"></li>
494
+ <li data-target="#myCarousel5" data-slide-to="2"></li>
495
+ <li data-target="#myCarousel5" data-slide-to="3"></li>
496
+
497
+ </ol>
498
+ <div class="mo2f_carousel-inner" role="listbox">
499
+ <div class="item active">
500
+ <p>If you have enabled 2-Factor for all users. They will login with their username and password and follow the steps after that :</p>
501
+
502
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/login-help-4.png" alt="First slide">
503
+
504
+ </div>
505
+ <div class="item">
506
+ <p>Enter a valid email Id and click on Get Started Button.</p>
507
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_user1.png" alt="First slide">
508
+ </div>
509
+ <div class="item">
510
+ <p>Enter the one time passcode sent to your email.</p>
511
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_user2.png" alt="First slide">
512
+ </div>
513
+ <div class="item">
514
+ <p>Email Verification will be set as default 2nd factor.Set another 2nd factor by clicking on radio buttons.</p>
515
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/mo2f_user3.png" alt="First slide">
516
+ </div>
517
+ </div>
518
+ </div>
519
+ </div>
520
+ </center>
521
+
522
+
523
+ </div>
miniorange_2_factor_frontend_shortcode.php ADDED
@@ -0,0 +1,543 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(mo2f_is_customer_registered()){
3
+
4
+ class MO2F_ShortCode {
5
+
6
+ public function mo2FAFormShortCode(){
7
+
8
+ if( ! is_user_logged_in() ) {
9
+ $html = '';
10
+ $html .="<link rel='stylesheet' id='bootstrap_style-css' href='". plugins_url('includes/css/bootstrap.min.css?version=3.4', __FILE__) ."' type='text/css' media='all' />
11
+ <link rel='stylesheet' id='2fa_login_style-css' href='".plugins_url('includes/css/front_end_login.css?version=3.4', __FILE__)."' type='text/css' media='all' />";
12
+
13
+ $login_status = isset($_SESSION[ 'mo_2factor_login_status' ]) ? $_SESSION[ 'mo_2factor_login_status' ] : null;
14
+
15
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS' || $login_status == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL'){
16
+
17
+ $html .= "<div class='mo2f_modal' tabindex='-1' role='dialog' id='mo2f-modal1'><div class='mo2f-modal-backdrop'></div>
18
+ <div class='mo2f_modal-dialog'>
19
+ <div class='mo2f_modal-content'>
20
+ <div class='mo2f_modal-header'>
21
+ <button type='button' class='mo2f_close' data-dismiss='modal' aria-label='Close' onclick='mologinback();'><span aria-hidden='true'>&times;</span></button>
22
+ </div>
23
+ <div class='mo2f_modal-body center'>
24
+
25
+ <div id='otpMessage' >
26
+ <p class='mo2fa_display_message_frontend'>" . $_SESSION['mo2f-login-message'] . "</p>
27
+ </div>
28
+
29
+ <div id='mo_2_factor_push_page'>
30
+ <center>
31
+ <div id='pushSection'>
32
+
33
+ <a href='#showPushHelp' id='pushHelpLink' class='mo2f-link'>See How It Works ?</a>
34
+ <br>
35
+
36
+ <h4>Waiting for your approval...</h4>
37
+
38
+ <div id='showPushImage' style='margin-bottom:10%;'>
39
+
40
+ <img src='". plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ )."' style='display:inline!important;'/>
41
+
42
+ </div>
43
+ <div style='display:table-row;' >";
44
+ if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS'){
45
+ if(get_option('mo2f_enable_forgotphone')){
46
+
47
+ $html .= "<a name='miniorange_login_forgotphone' onclick='mologinforgotphone();' id='miniorange_login_forgotphone' class='mo2f-link' >Forgot Phone?</a>";
48
+ }
49
+ $html .= " &nbsp;&nbsp;&nbsp;&nbsp;
50
+ <a name='miniorange_login_offline' onclick='mologinoffline();' id='miniorange_login_offline' class='mo2f-link' >Phone is Offline?</a>";
51
+
52
+ }
53
+ $html .= " </div>
54
+ <br>
55
+
56
+ </div>
57
+ </center>
58
+ <div id='showPushHelp' class='showPushHelp' hidden>
59
+ <br>
60
+ <center><a href='#showPushHelp' id='pushLink' class='mo2f-link'>←Go Back.</a>
61
+ <br>
62
+ <div id='myCarousel' class='mo2f_carousel slide' data-ride='carousel'>
63
+ <ol class='mo2f_carousel-indicators'>
64
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
65
+ <li data-target='#myCarousel' data-slide-to='1'></li>
66
+ <li data-target='#myCarousel' data-slide-to='2'></li>
67
+ </ol>
68
+ <div class='mo2f_carousel-inner' role='listbox'>";
69
+ if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL') {
70
+
71
+ $html .= " <div class='item active'>
72
+
73
+ <img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-1.png' alt='First slide'>
74
+ </div>
75
+ <div class='item'>
76
+ <p>Click on Accept Transaction link to verify your email .</p><br>
77
+ <img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-2.png' alt='First slide'>
78
+
79
+ </div>
80
+ <div class='item'>
81
+ <img class='first-slide' src='http://miniorange.com/images/help/email-with-link-login-flow-3.png' alt='First slide'>
82
+ </div>";
83
+ }
84
+ else {
85
+
86
+ $html .= " <div class='item active'>
87
+ <p>You will receive a notification on your phone.</p><br>
88
+ <img class='first-slide' src='http://miniorange.com/images/help/push-login-flow.png' alt='First slide'>
89
+ </div>
90
+ <div class='item'>
91
+ <p>Open the notification and click on accept button.</p><br>
92
+ <img class='first-slide' src='http://miniorange.com/images/help/push-login-flow-1.png' alt='First slide'>
93
+
94
+ </div>
95
+ <div class='item'>
96
+ <img class='first-slide' src='http://miniorange.com/images/help/push-login-flow-2.png' alt='First slide'>
97
+ </div>";
98
+ }
99
+ $html .= "</div>
100
+ </div>
101
+ </center>
102
+ </div>
103
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
104
+ <?php if(get_option('mo2f_enable_custom_poweredby')!=1){?>}
105
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('/miniorange-2-factor-authentication/includes/images/miniOrange2.png');'></div></a></div>
106
+ <?php }else{
107
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('".site_url()."/wp-content/uploads/custom.png');'></div></a></div>
108
+ }?>
109
+ <?php }?>
110
+ </div>
111
+
112
+ </div><!-- /.modal-content -->
113
+ </div><!-- /.modal-dialog -->
114
+ </div><!-- /.modal -->
115
+ <script>
116
+ jQuery('#mo2f-modal1').modal('show');
117
+
118
+ var timeout;
119
+ pollPushValidation();
120
+ function pollPushValidation()
121
+ {
122
+ var transId = '". $_SESSION[ 'mo2f-login-transactionId' ] ."';
123
+
124
+ var jsonString = '{\"txId\":\"'+ transId + '\"}';
125
+ var postUrl = '". get_option('mo2f_host_name') ."/moas/api/auth/auth-status';
126
+
127
+ jQuery.ajax({
128
+ url: postUrl,
129
+ type : 'POST',
130
+ dataType : 'json',
131
+ data : jsonString,
132
+ contentType : 'application/json; charset=utf-8',
133
+ success : function(result) {
134
+ var status = JSON.parse(JSON.stringify(result)).status;
135
+
136
+ if (status == 'SUCCESS') {
137
+
138
+ jQuery('#mo2f_mobile_validation_form').submit();
139
+ } else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {
140
+
141
+ jQuery('#mo2f_2fa_form_close').submit();
142
+ } else {
143
+ timeout = setTimeout(pollPushValidation, 3000);
144
+ }
145
+ }
146
+ });
147
+ }
148
+ jQuery('#myCarousel').carousel('pause');
149
+ jQuery('#pushHelpLink').click(function() {
150
+ jQuery('#showPushHelp').show();
151
+ jQuery('#pushSection').hide();
152
+
153
+ jQuery('#myCarousel').carousel(0);
154
+ });
155
+ jQuery('#pushLink').click(function() {
156
+ jQuery('#showPushHelp').hide();
157
+ jQuery('#pushSection').show();
158
+ jQuery('#myCarousel').carousel('pause');
159
+ });
160
+ function mologinback(){
161
+ jQuery('#mo2f_2fa_form_close').submit();
162
+ }
163
+ function mologinoffline(){
164
+ jQuery('#mo2f_show_softtoken_loginform').submit();
165
+ }
166
+ function mologinforgotphone(){
167
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
168
+ }
169
+ </script>
170
+ ";
171
+ }
172
+
173
+ if($login_status == 'MO_2_FACTOR_CHALLENGE_MOBILE_AUTHENTICATION'){
174
+
175
+ $html .= " <div class='mo2f_modal' tabindex='-1' role='dialog' id='mo2f-modal2'>
176
+ <div class='mo2f-modal-backdrop'></div>
177
+ <div class='mo2f_modal-dialog'>
178
+ <div class='mo2f_modal-content'>
179
+ <div class='mo2f_modal-header'>
180
+ <button type='button' class='mo2f_close' data-dismiss='modal' aria-label='Close' onclick='mologinback();'><span aria-hidden='true'>&times;</span></button>
181
+ </div>
182
+ <div class='mo2f_modal-body center'>";
183
+
184
+ if(isset($_SESSION['mo2f-login-message']) && $_SESSION['mo2f-login-message'] == 'Error:OTP over Email'){
185
+ $html .= "
186
+ <div id='otpMessage'>
187
+ <p class='mo2fa_display_message_frontend'>Error occurred while sending OTP over email. Please try again. </p>
188
+ </div>";
189
+ }
190
+ $html .= " <div id='scanQRSection'>
191
+ <p>Identify yourself by scanning the QR code with miniOrange Authenticator app.</p>
192
+ <a href='#showQRHelp' id='helpLink' class='mo2f-link'>See How It Works ?</a>
193
+ <br><br>
194
+ <div id='showQrCode' style='margin-bottom:10%;'>
195
+ <center> <img src='data:image/jpg;base64," . $_SESSION[ 'mo2f-login-qrCode' ] . "' /> </center>
196
+ </div>";
197
+
198
+ if(get_option('mo2f_enable_forgotphone')){
199
+ $html .= " <a name='miniorange_login_forgotphone' onclick='mologinforgotphone();' id='miniorange_login_forgotphone' class='mo2f-link' >Forgot Phone?</a>";
200
+ }
201
+
202
+ $html .= " &nbsp;&nbsp;&nbsp;&nbsp;
203
+ <a name='miniorange_login_offline' onclick='mologinoffline();' id='miniorange_login_offline' class='mo2f-link' >Phone is Offline?</a>
204
+
205
+
206
+ </div>
207
+ <div id='showQRHelp' class='showQRHelp' hidden>
208
+ <br>
209
+ <center><a href='#showQRHelp' id='qrLink' class='mo2f-link'>←Back to Scan QR Code.</a>
210
+ <br>
211
+ <div id='myCarousel' class='mo2f_carousel slide' data-ride='carousel'>
212
+ <!-- Indicators -->
213
+ <ol class='mo2f_carousel-indicators'>
214
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
215
+ <li data-target='#myCarousel' data-slide-to='1'></li>
216
+ <li data-target='#myCarousel' data-slide-to='2'></li>
217
+ <li data-target='#myCarousel' data-slide-to='3'></li>
218
+ <li data-target='#myCarousel' data-slide-to='4'></li>
219
+ </ol>
220
+ <div class='mo2f_carousel-inner' role='listbox'>
221
+ <div class='item active'>
222
+ <img class='first-slide' src='http://miniorange.com/images/help/qr-help-1.png' alt='First slide'>
223
+ </div>
224
+ <div class='item'>
225
+ <p>Open miniOrange Authenticator app and click on Authenticate.</p><br>
226
+ <img class='first-slide' src='http://miniorange.com/images/help/qr-help-2.png' alt='First slide'>
227
+
228
+ </div>
229
+ <div class='item'>
230
+ <img class='first-slide' src='http://miniorange.com/images/help/qr-help-3.png' alt='First slide'>
231
+ </div>
232
+ <div class='item'>
233
+ <img class='first-slide' src='http://miniorange.com//images/help/qr-help-4.png' alt='First slide'>
234
+ </div>
235
+ <div class='item'>
236
+ <img class='first-slide' src='http://miniorange.com/images/help/qr-help-5.png' alt='First slide'>
237
+ </div>
238
+ </div>
239
+ </div>
240
+ </center>
241
+ </div>
242
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
243
+ <?php if(get_option('mo2f_enable_custom_poweredby')!=1){?>}
244
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('/miniorange-2-factor-authentication/includes/images/miniOrange2.png');'></div></a></div>
245
+ <?php }else{
246
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('".site_url()."/wp-content/uploads/custom.png');'></div></a></div>
247
+ }?>
248
+ <?php }?>
249
+ </div>
250
+ </div><!-- /.modal-content -->
251
+ </div><!-- /.modal-dialog -->
252
+ </div><!-- /.modal -->
253
+ <script>
254
+
255
+ jQuery('#mo2f-modal2').modal('show');
256
+
257
+ var timeout;
258
+ pollMobileValidation();
259
+ function pollMobileValidation()
260
+ {
261
+ var transId = '". $_SESSION[ 'mo2f-login-transactionId' ] ."';
262
+ var jsonString = '{\"txId\":\"'+ transId + '\"}';
263
+ var postUrl = '". get_option('mo2f_host_name') ."/moas/api/auth/auth-status';
264
+ jQuery.ajax({
265
+ url: postUrl,
266
+ type : 'POST',
267
+ dataType : 'json',
268
+ data : jsonString,
269
+ contentType : 'application/json; charset=utf-8',
270
+ success : function(result) {
271
+ var status = JSON.parse(JSON.stringify(result)).status;
272
+ if (status == 'SUCCESS') {
273
+ var content = '<div id=\"success\"><center><img src=\"". plugins_url( 'includes/images/right.png' , __FILE__ ) ."\" /></center></div>';
274
+ jQuery('#showQrCode').empty();
275
+ jQuery('#showQrCode').append(content);
276
+ setTimeout(function(){jQuery('#mo2f_mobile_validation_form').submit();}, 100);
277
+ } else if (status == 'ERROR' || status == 'FAILED') {
278
+ var content = '<div id=\"error\"><center><img src=\"". plugins_url( 'includes/images/wrong.png' , __FILE__ ) ."\" /></center></div>';
279
+ jQuery('#showQrCode').empty();
280
+ jQuery('#showQrCode').append(content);
281
+ setTimeout(function(){jQuery('#mo2f_2fa_form_close').submit();}, 1000);
282
+ } else {
283
+ timeout = setTimeout(pollMobileValidation, 3000);
284
+ }
285
+ }
286
+ });
287
+ }
288
+ jQuery('#myCarousel').carousel('pause');
289
+ jQuery('#helpLink').click(function() {
290
+ jQuery('#showQRHelp').show();
291
+ jQuery('#scanQRSection').hide();
292
+
293
+ jQuery('#myCarousel').carousel(0);
294
+ });
295
+ jQuery('#qrLink').click(function() {
296
+ jQuery('#showQRHelp').hide();
297
+ jQuery('#scanQRSection').show();
298
+ jQuery('#myCarousel').carousel('pause');
299
+ });
300
+ function mologinback(){
301
+ jQuery('#mo2f_2fa_form_close').submit();
302
+ }
303
+ function mologinoffline(){
304
+ jQuery('#mo2f_show_softtoken_loginform').submit();
305
+ }
306
+ function mologinforgotphone(){
307
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
308
+ }
309
+ </script>
310
+ ";
311
+ }
312
+
313
+ 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'){
314
+
315
+ $html .= " <div class='mo2f_modal' tabindex='-1' role='dialog' id='mo2f-modal3'>
316
+ <div class='mo2f-modal-backdrop'></div>
317
+ <div class='mo2f_modal-dialog'>
318
+ <div class='mo2f_modal-content'>
319
+ <div class='mo2f_modal-header'>
320
+ <button type='button' class='mo2f_close' data-dismiss='modal' aria-label='Close' onclick='mologinback();'><span aria-hidden='true'>&times;</span></button>
321
+ </div>
322
+ <div class='mo2f_modal-body center'>
323
+
324
+
325
+ <div id='otpMessage'>
326
+ <p class='mo2fa_display_message_frontend' >". $_SESSION['mo2f-login-message'] . "</p>
327
+ </div>
328
+
329
+ <div id='showOTP'>
330
+ <div class='mo2f-login-container'>";
331
+ if($_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION'){
332
+ $html .= " <a href='#showOTPHelp' id='otpHelpLink' class='mo2f-link'>See How It Works ?</a>";
333
+ }
334
+
335
+
336
+ $html .= " <input type='text' name='mo2fa_softtokenkey' placeholder='Enter one time passcode' id='mo2fa_softtokenkey' required='true' class='mo2f-textbox' autofocus='true' pattern='[0-9]{4,8}' title='Only digits within range 4-8 are allowed.'/>
337
+
338
+ <input type='button' name='miniorange_soft_token_submit' onclick='mootploginsubmit();' id='miniorange_soft_token_submit' class='mo2f-button' value='Validate' />
339
+ <br><br>";
340
+
341
+ if(get_option('mo2f_enable_forgotphone') && isset($_SESSION[ 'mo_2factor_login_status' ] ) && $_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL'){
342
+
343
+ $html .= "<a name='miniorange_login_forgotphone' onclick='mologinforgotphone();' id='miniorange_login_forgotphone' class='mo2f-link' >Forgot Phone ?</a>";
344
+
345
+ }
346
+
347
+ $html .= " <br><br>
348
+ </div>
349
+ </div>
350
+ <div id='showOTPHelp' class='showOTPHelp' hidden>
351
+ <br>
352
+ <center><a href='#showOTP' id='otpLink' class='mo2f-link'>←Go Back</a>
353
+ <br>
354
+ <div id='myCarousel' class='mo2f_carousel slide' data-ride='carousel'> ";
355
+
356
+ if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN'){
357
+
358
+ $html .= " <ol class='mo2f_carousel-indicators'>
359
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
360
+ <li data-target='#myCarousel' data-slide-to='1'></li>
361
+ <li data-target='#myCarousel' data-slide-to='2'></li>
362
+ <li data-target='#myCarousel' data-slide-to='3'></li>
363
+
364
+ </ol>
365
+ <div class='mo2f_carousel-inner' role='listbox'>
366
+
367
+
368
+ <div class='item active'>
369
+ <p>Open miniOrange Authenticator app and click on settings icon on top right corner.</p><br>
370
+ <img class='first-slide' src='http://miniorange.com/images/help/qr-help-2.png' alt='First slide'>
371
+ </div>
372
+ <div class='item'>
373
+ <p>Click on Sync button below to sync your time with miniOrange Servers. This is a one time sync to avoid otp validation failure.</p><br>
374
+ <img class='first-slide' src='http://miniorange.com/images/help/token-help-3.png' alt='First slide'>
375
+ </div>
376
+ <div class='item'>
377
+ <p>Go to Soft Token tab.</p><br>
378
+ <img class='first-slide' src='http://miniorange.com/images/help/token-help-2.png' alt='First slide'>
379
+ </div>
380
+ <div class='item'>
381
+ <p>Enter the one time passcode shown in miniOrange Authenticator app here.</p><br>
382
+ <img class='first-slide' src='http://miniorange.com/images/help/token-help-4.png' alt='First slide'>
383
+ </div>
384
+ </div>";
385
+
386
+ } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL') {
387
+
388
+ $html .= " <ol class='mo2f_carousel-indicators'>
389
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
390
+ <li data-target='#myCarousel' data-slide-to='1'></li>
391
+ <li data-target='#myCarousel' data-slide-to='2'></li>
392
+
393
+ </ol>
394
+ <div class='mo2f_carousel-inner' role='listbox'>
395
+ <div class='item active'>
396
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-help-1.png' alt='First slide'>
397
+ </div>
398
+ <div class='item'>
399
+ <p>Check your email with which you registered and copy the one time passcode.</p><br>
400
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-help-2.png' alt='First slide'>
401
+ </div>
402
+ <div class='item'>
403
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-help-3.png' alt='First slide'>
404
+ </div>
405
+ </div>";
406
+
407
+ } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS') {
408
+
409
+ $html .= "<ol class='mo2f_carousel-indicators'>
410
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
411
+ <li data-target='#myCarousel' data-slide-to='1'></li>
412
+ <li data-target='#myCarousel' data-slide-to='2'></li>
413
+
414
+ </ol>
415
+ <div class='mo2f_carousel-inner' role='listbox'>
416
+ <div class='item active'>
417
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-over-sms-login-flow-1.png' alt='First slide'>
418
+ </div>
419
+ <div class='item'>
420
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-over-sms-login-flow-2.png' alt='First slide'>
421
+ </div>
422
+ <div class='item'>
423
+ <img class='first-slide' src='http://miniorange.com/images/help/otp-over-sms-login-flow-3.png' alt='First slide'>
424
+ </div>
425
+ </div>";
426
+ } else {
427
+ $html .= "<!-- phone call verification -->
428
+ <ol class='mo2f_carousel-indicators'>
429
+ <li data-target='#myCarousel' data-slide-to='0' class='active'></li>
430
+ <li data-target='#myCarousel' data-slide-to='1'></li>
431
+
432
+
433
+ </ol>
434
+ <div class='mo2f_carousel-inner' role='listbox'>
435
+ <div class='item active'>
436
+ <p>You will receive a phone call. Pick up the call and listen to the one time passcode carefully. </p>
437
+ <img class='first-slide' src='http://miniorange.com/images/help/phone-call-login-flow-2.png' alt='First slide'>
438
+ </div>
439
+ <div class='item'>
440
+ <p>Enter the one time passcode here and click on validate button to login.</p><br>
441
+ <img class='first-slide' src='http://miniorange.com/images/help/phone-call-login-flow.png' alt='First slide'>
442
+ </div>
443
+
444
+ </div>";
445
+ }
446
+
447
+ $html .= "</div>
448
+ </div>
449
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
450
+ <?php if(get_option('mo2f_enable_custom_poweredby')!=1){?>}
451
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('/miniorange-2-factor-authentication/includes/images/miniOrange2.png');'></div></a></div>
452
+ <?php }else{
453
+ <div class='mo2f_powered_by_div'><a target='_blank' href='http://miniorange.com/2-factor-authentication'><div class='mo2f_powered_by_miniorange' style='background-image: url('".site_url()."/wp-content/uploads/custom.png');'></div></a></div>
454
+ }?>
455
+ <?php }?>
456
+ </div>
457
+
458
+
459
+ </div><!-- /.modal-content -->
460
+ </div><!-- /.modal-dialog -->
461
+ </div><!-- /.modal -->
462
+
463
+ <script>
464
+
465
+ jQuery('#mo2f-modal3').modal('show');
466
+ jQuery('#otpHelpLink').click(function() {
467
+ jQuery('#showOTPHelp').show();
468
+ jQuery('#showOTP').hide();
469
+ jQuery('#otpMessage').hide();
470
+ });
471
+ jQuery('#otpLink').click(function() {
472
+ jQuery('#showOTPHelp').hide();
473
+ jQuery('#showOTP').show();
474
+ jQuery('#otpMessage').show();
475
+ });
476
+
477
+ function mologinback(){
478
+ jQuery('#mo2f_2fa_form_close').submit();
479
+ }
480
+ function mologinforgotphone(){
481
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
482
+ }
483
+ function mootploginsubmit(){
484
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
485
+ document.getElementById('mo2f_submitotp_loginform').elements[0].value = otpkey;
486
+ jQuery('#mo2f_submitotp_loginform').submit();
487
+
488
+ }
489
+
490
+ jQuery('#mo2fa_softtokenkey').keypress(function(e){
491
+ if(e.which == 13){//Enter key pressed
492
+ e.preventDefault();
493
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
494
+ document.getElementById('mo2f_submitotp_loginform').elements[0].value = otpkey;
495
+ jQuery('#mo2f_submitotp_loginform').submit();
496
+ }
497
+
498
+ });
499
+
500
+
501
+
502
+ </script>
503
+ ";
504
+ }
505
+
506
+ $html .= "<form name='f' id='mo2f_show_softtoken_loginform' method='post' action='' style='display:none;'>
507
+ <input type='hidden' name='miniorange_softtoken' value='". wp_create_nonce('miniorange-2-factor-softtoken') . "' />
508
+ </form>
509
+ <form name='f' id='mo2f_show_forgotphone_loginform' method='post' action='' style='display:none;'>
510
+ <input type='hidden' name='miniorange_forgotphone' value='" . wp_create_nonce('miniorange-2-factor-forgotphone') . "' />
511
+ </form>
512
+ <form name='f' id='mo2f_2fa_form_close' method='post' style='display:none;'>
513
+ <input type='hidden' name='miniorange_mobile_validation_failed_nonce' value='" . wp_create_nonce('miniorange-2-factor-mobile-validation-failed-nonce') ."' />
514
+ </form>
515
+ <form name='f' id='mo2f_mobile_validation_form' method='post' action='' style='display:none;'>
516
+ <input type='hidden' name='miniorange_mobile_validation_nonce' value='" . wp_create_nonce('miniorange-2-factor-mobile-validation-nonce') ."' />
517
+ </form>
518
+ <form name='f' id='mo2f_submitotp_loginform' method='post' action='' style='display:none;'>
519
+ <input type='text' name='mo2fa_softtoken' id='mo2fa_softtoken' hidden/>
520
+ <input type='hidden' name='miniorange_soft_token_nonce' value='" . wp_create_nonce('miniorange-2-factor-soft-token-nonce') ."' />
521
+ </form>";
522
+
523
+ return $html;
524
+
525
+ }
526
+
527
+ }
528
+
529
+ public function mo2FALoginFormShortCode(){
530
+ if( ! is_user_logged_in() ) {
531
+
532
+ $html = '';
533
+ $html .= "<input type='hidden' name='miniorange_login_nonce' value='". wp_create_nonce('miniorange-2-factor-login-nonce') ."' />";
534
+ return $html;
535
+ }
536
+
537
+ }
538
+
539
+
540
+ }
541
+
542
+ }
543
+ ?>
miniorange_2_factor_mobile_configuration.php ADDED
@@ -0,0 +1,1893 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function mo2f_check_if_registered_with_miniorange($current_user){
4
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'){
5
+ ?>
6
+ <br />
7
+ <div style="display:block;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">Please <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">click here</a> to setup Two-Factor.</div>
8
+ <?php
9
+ }else if(!(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS')) { ?>
10
+ <br/><div style="display:block;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">Please <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup">Register with miniOrange</a> to configure miniOrange 2 Factor plugin.</div>
11
+ <?php }
12
+ }
13
+
14
+ function mo2f_get_activated_second_factor($current_user){
15
+ if(get_user_meta($current_user->ID,'mo_2factor_mobile_registration_status',true) == 'MO_2_FACTOR_SUCCESS'){
16
+ //checking this option for existing users
17
+ update_user_meta($current_user->ID,'mo2f_mobile_registration_status',true);
18
+ $mo2f_second_factor = 'MOBILE AUTHENTICATION';
19
+ return $mo2f_second_factor;
20
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
21
+ return 'NONE';
22
+ }else{
23
+ //for new users
24
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && get_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange',true) == 'SUCCESS'){
25
+ $enduser = new Two_Factor_Setup();
26
+ $userinfo = json_decode($enduser->mo2f_get_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
27
+ if(json_last_error() == JSON_ERROR_NONE){
28
+ if($userinfo['status'] == 'ERROR'){
29
+ update_option( 'mo2f_message', $userinfo['message']);
30
+ $mo2f_second_factor = 'NONE';
31
+ }else if($userinfo['status'] == 'SUCCESS'){
32
+ $mo2f_second_factor = $userinfo['authType'];
33
+ }else if($userinfo['status'] == 'FAILED'){
34
+ $mo2f_second_factor = 'NONE';
35
+ update_option( 'mo2f_message','Your account has been removed.Please contact your administrator.');
36
+ }else{
37
+ $mo2f_second_factor = 'NONE';
38
+ }
39
+ }else{
40
+ update_option( 'mo2f_message','Invalid Request. Please try again.');
41
+ $mo2f_second_factor = 'NONE';
42
+ }
43
+ }else{
44
+ $mo2f_second_factor = 'NONE';
45
+ }
46
+ return $mo2f_second_factor;
47
+ }
48
+ }
49
+
50
+ function mo_2factor_is_curl_installed() {
51
+ if (in_array ('curl', get_loaded_extensions())) {
52
+ return 1;
53
+ } else
54
+ return 0;
55
+ }
56
+
57
+ function show_user_welcome_page($current_user){
58
+ ?>
59
+ <form name="f" method="post" action="">
60
+ <div class="mo2f_table_layout">
61
+ <div><center><p style="font-size:17px;">A new security system has been enabled to better protect your account. Please configure your Two-Factor Authentication method by setting up your account.</p></center></div>
62
+ <div id="panel1">
63
+ <table class="mo2f_settings_table">
64
+
65
+ <tr>
66
+ <td><center><div class="alert-box"><input type="email" autofocus="true" name="mo_useremail" style="width:48%;text-align: center;height: 40px;font-size:18px;border-radius:5px;" required placeholder="person@example.com" value="<?php echo $current_user->user_email;?>"/></div></center></td>
67
+ </tr>
68
+ <tr>
69
+ <td><center><p>Please enter a valid email id that you have access to. You will be able to move forward after verifying an OTP that we will be sending to this email.</p></center></td>
70
+ </tr>
71
+ <tr><td></td></tr>
72
+ <tr><td></td></tr>
73
+ <tr><td></td></tr>
74
+ <tr><td></td></tr>
75
+ <tr><td></td></tr>
76
+ <tr><td></td></tr>
77
+ <tr><td></td></tr>
78
+ <tr><td></td></tr>
79
+ <tr>
80
+ <td><input type="hidden" name="miniorange_user_reg_nonce" value="<?php echo wp_create_nonce('miniorange-2-factor-user-reg-nonce'); ?>" />
81
+ <center><input type="submit" name="miniorange_get_started" id="miniorange_get_started" class="button button-primary button-large extra-large" value="Get Started" /></center> </td>
82
+ </tr>
83
+ </table>
84
+ </div>
85
+ </div>
86
+ </form>
87
+ <?php
88
+ }
89
+
90
+ function show_2_factor_advanced_options($current_user){
91
+ $random_mo_key = get_option('mo2f_new_customer');
92
+ ?>
93
+ <div class="mo2f_table_layout">
94
+ <?php echo mo2f_check_if_registered_with_miniorange($current_user); ?>
95
+ <form name="f" id="advance_options_form" method="post" action="">
96
+ <?php if(current_user_can('manage_options')){ ?>
97
+ <input type="hidden" name="option" value="mo_auth_advanced_options_save" />
98
+
99
+ <span>
100
+
101
+ <h3>Enable Two-Factor for Woocommerce Front End Login.
102
+ <input type="submit" name="submit" value="Save Settings" style="float:right;" class="button button-primary button-large" <?php
103
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ } else{ echo 'disabled' ; } ?> />
104
+ </h3></span><hr>
105
+ <br>
106
+
107
+ <div>
108
+ <input type="checkbox" id="mo2f_enable_2fa_for_woocommerce" name="mo2f_enable_2fa_for_woocommerce" value="1" <?php checked( get_option('mo2f_enable_2fa_for_woocommerce') == 1 );
109
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){}else{ echo 'disabled';} ?> />
110
+
111
+ Enable Two-Factor for Woocommerce Front End Login.<br />
112
+ <br /><div id="mo2f_note"><b>Note:</b> Checking this option will enable two factor for woocommerce front end login theme.</div><br>
113
+ </div>
114
+
115
+ <h3>Device Profile View</h3><hr>
116
+ <p>You can manage trusted devices which you have stored during login by remembering devices.</p>
117
+ <a class="button button-primary button-large" onclick="mo2fLoginMiniOrangeDashboard()" <?php if(mo2f_is_customer_registered()){}else{ echo 'disabled style="pointer-events: none;cursor: default;"';} ?> >View Profiles</a>
118
+ <br><br />
119
+
120
+ <h3>Customize Security Questions (KBA)*</h3><hr>
121
+ <p>Administrator can choose the list of questions to show the question list to all users during KBA setup. Administrator can also decide how many default questions user can see during KBA setup and how many custom questions, user can add their own.</p>
122
+
123
+ <br>
124
+
125
+ <h3>MultiSite Support*</h3><hr>
126
+ <p>Just One time Setup. User has to setup his 2nd factor only once, no matter, in how many sites he exists. Ease of use.</p>
127
+ <br />
128
+ <h3>Custom Email and SMS Templates*</h3><hr>
129
+ You can change the templates for Email and SMS as per your requirement.<br />
130
+ <a href = "javascript:void(0)" class="button button-primary button-large" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">Customize Templates</a>
131
+ <div id="light" class="white_content">
132
+ <div style="height:80%;background-color:rgba(128, 128, 128, 0.05);padding:10px;">
133
+ <a href = "javascript:void(0)" style="float:right;" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'">Close</a>
134
+ <br/>This is a premium feature. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing">Click here</a> to upgrade the plugin.
135
+ </div>
136
+ </div>
137
+ <div id="fade" class="black_overlay"></div>
138
+ <h3>Custom Redirection*</h3><hr>
139
+ This option will allow the users during login to redirect on the specific page role wise.
140
+ <br>
141
+
142
+ <?php if(get_option('mo2f_enable_custom')==1 || $random_mo_key){?>
143
+ <h3>Customize 'powered by' Logo*</h3><hr>
144
+ <div class="<?php echo ($random_mo_key) ?' mo2f_grayed_out':""?> ">
145
+ <input type="checkbox" id="mo2f_disable_poweredby" name="mo2f_disable_poweredby" value="1" <?php checked( get_option('mo2f_disable_poweredby') == 1 );
146
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && !$random_mo_key){}else{ echo 'disabled';} ?> />
147
+ Remove 'Powered By' option from the Login Screens. <br />
148
+ <br /><div id="mo2f_note"><b>Note:</b> Checking this option will remove 'Powered By' from the Login Screens.</div>
149
+ <br>
150
+ <input type="checkbox" id="mo2f_enable_custom_poweredby" name="mo2f_enable_custom_poweredby" value="1" <?php checked( get_option('mo2f_enable_custom_poweredby') == 1 );
151
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && !$random_mo_key){}else{ echo 'disabled';} ?> />
152
+
153
+ Enable Custom 'Powered By' option for the Login Screens. <br><br>
154
+ <div id="mo2f_note"><b>Instructions:</b>
155
+ Go to /wp-content/uploads folder and upload a .png image with the name "custom".
156
+ </div>
157
+ </div>
158
+ <br>
159
+
160
+ <h3>Customize Plugin Icon*</h3><hr>
161
+ <div class="<?php echo ($random_mo_key) ?' mo2f_grayed_out':""?> ">
162
+ <input type="checkbox" id="mo2f_enable_custom_icon" name="mo2f_enable_custom_icon" value="1" <?php checked( get_option('mo2f_enable_custom_icon') == 1 );
163
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && !$random_mo_key){}else{ echo 'disabled';} ?> />
164
+
165
+ Change Plugin Icon <br><br>
166
+ <div id="mo2f_note"><b>Instructions:</b>
167
+ Go to /wp-content/uploads folder and upload a .png image with the name "plugin_icon".
168
+ </div>
169
+ </div>
170
+ <br>
171
+
172
+ <h3>Customize Plugin Name*</h3><hr>
173
+ <div class="<?php echo ($random_mo_key) ?' mo2f_grayed_out':""?> ">
174
+ Change Plugin Name: <br><br>
175
+ <input type="text" class="mo2f_table_textbox" id="mo2f_custom_plugin_name" name="mo2f_custom_plugin_name" <?php if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' && !$random_mo_key){}else{ echo 'disabled';} ?> value="<?php echo get_option('mo2f_custom_plugin_name')?>" placeholder="Enter a custom Plugin Name." />
176
+ <br><br>
177
+ <div id="mo2f_note"><b>Note:</b>
178
+ This will be the Plugin Name You and your Users see in WordPress Dashboard$.
179
+ </div>
180
+ </div>
181
+ <br>
182
+ <?php } ?>
183
+ <br /><br/><div><b>*</b>These are premium features. You need to upgrade the plugin to use these features.</div><br /><br />
184
+ <?php
185
+
186
+ }
187
+ ?>
188
+ </form>
189
+ <form style="display:none;" id="mo2fa_loginform" action="<?php echo get_option( 'mo2f_host_name').'/moas/login'; ?>"
190
+ target="_blank" method="post">
191
+ <input type="email" name="username" value="<?php echo get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true); ?>" />
192
+ <input type="text" name="redirectUrl" value="<?php echo get_option('mo2f_host_name') . '/moas/viewrbaprofile';?>" />
193
+ </form>
194
+ <script>
195
+ function mo2fLoginMiniOrangeDashboard(){
196
+ jQuery('#mo2fa_loginform').submit();
197
+ }
198
+ </script>
199
+
200
+ </div>
201
+ <?php
202
+ }
203
+
204
+ function mo2f_show_user_otp_validation_page(){
205
+ ?>
206
+ <!-- Enter otp -->
207
+
208
+ <div class="mo2f_table_layout">
209
+ <h3>Validate OTP</h3><hr>
210
+ <div id="panel1">
211
+ <table class="mo2f_settings_table">
212
+ <form name="f" method="post" id="mo_2f_otp_form" action="">
213
+ <input type="hidden" name="option" value="mo_2factor_validate_user_otp" />
214
+ <tr>
215
+ <td><b><font color="#FF0000">*</font>Enter OTP:</b></td>
216
+ <td colspan="2"><input class="mo2f_table_textbox" autofocus="true" type="text" name="otp_token" required placeholder="Enter OTP" style="width:95%;"/></td>
217
+ <td><a href="#resendotplink">Resend OTP ?</a></td>
218
+ </tr>
219
+
220
+ <tr>
221
+ <td>&nbsp;</td>
222
+ <td style="width:17%">
223
+ <input type="submit" name="submit" value="Validate OTP" class="button button-primary button-large" /></td>
224
+
225
+ </form>
226
+ <form name="f" method="post" action="">
227
+ <td>
228
+ <input type="hidden" name="option" value="mo_2factor_backto_user_registration"/>
229
+ <input type="submit" name="mo2f_goback" id="mo2f_goback" value="Back" class="button button-primary button-large" /></td>
230
+ </form>
231
+ </td>
232
+ </tr>
233
+ <form name="f" method="post" action="" id="resend_otp_form">
234
+ <input type="hidden" name="option" value="mo_2factor_resend_user_otp"/>
235
+ </form>
236
+
237
+ </table>
238
+ </div>
239
+ <div>
240
+ <script>
241
+ jQuery('a[href=\"#resendotplink\"]').click(function(e) {
242
+ jQuery('#resend_otp_form').submit();
243
+ });
244
+ </script>
245
+
246
+ <br><br>
247
+ </div>
248
+
249
+
250
+
251
+ </div>
252
+
253
+ <?php
254
+ }
255
+
256
+ function show_2_factor_login_demo($current_user){
257
+ include_once('miniorange_2_factor_demo.php');
258
+ }
259
+ function mo2f_show_instruction_to_allusers($current_user,$mo2f_second_factor){
260
+ if($mo2f_second_factor == 'OUT OF BAND EMAIL'){
261
+ $mo2f_second_factor = 'Email Verification';
262
+ }else if($mo2f_second_factor == 'SMS'){
263
+ $mo2f_second_factor = 'OTP over SMS';
264
+ }else if($mo2f_second_factor == 'PHONE VERIFICATION'){
265
+ $mo2f_second_factor = 'Phone Call Verification';
266
+ }else if($mo2f_second_factor == 'SOFT TOKEN'){
267
+ $mo2f_second_factor = 'Soft Token';
268
+ }else if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
269
+ $mo2f_second_factor = 'QR Code Authentication';
270
+ }else if($mo2f_second_factor == 'PUSH NOTIFICATIONS'){
271
+ $mo2f_second_factor = 'Push Notification';
272
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
273
+ $app_type = get_user_meta($current_user->ID,'mo2f_external_app_type',true);
274
+ if($app_type == 'GOOGLE AUTHENTICATOR'){
275
+ $mo2f_second_factor = 'Google Authenticator';
276
+ }else if($app_type == 'AUTHY 2-FACTOR AUTHENTICATION'){
277
+ $mo2f_second_factor = 'Authy 2-Factor Authentication';
278
+ }else{
279
+ $mo2f_second_factor = 'Google Authenticator';
280
+ update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
281
+ }
282
+ }
283
+ ?>
284
+
285
+ <div class="mo2f_table_layout">
286
+ <?php
287
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'){
288
+ ?>
289
+ <br />
290
+ <div style="display:block;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">Please <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure">click here</a> to setup Two-Factor.</div>
291
+ <?php }
292
+ ?>
293
+ <h4>Thank you for registering with us.</h4>
294
+ <h3>Your Profile</h3>
295
+ <table border="1" style="background-color:#FFFFFF; border:1px solid #CCCCCC; border-collapse: collapse; padding:0px 0px 0px 10px; margin:2px; width:100%">
296
+ <tr>
297
+ <td style="width:45%; padding: 10px;"><b>2 Factor Registered Email</b></td>
298
+ <td style="width:55%; padding: 10px;"><?php echo get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true); echo ' (' . $current_user->user_login . ')';?>
299
+ </td>
300
+ </tr>
301
+ <tr>
302
+ <td style="width:45%; padding: 10px;"><b>Activated 2nd Factor</b></td>
303
+ <td style="width:55%; padding: 10px;"><?php echo $mo2f_second_factor;?>
304
+ </td>
305
+ </tr>
306
+ <?php if(current_user_can('manage_options')){ ?>
307
+ <tr>
308
+ <td style="width:45%; padding: 10px;"><b>miniOrange Customer Email</b></td>
309
+ <td style="width:55%; padding: 10px;"><?php echo get_option('mo2f_email');?></td>
310
+ </tr>
311
+ <tr>
312
+ <td style="width:45%; padding: 10px;"><b>Customer ID</b></td>
313
+ <td style="width:55%; padding: 10px;"><?php echo get_option('mo2f_customerKey');?></td>
314
+ </tr>
315
+ <tr>
316
+ <td style="width:45%; padding: 10px;"><b>API Key</b></td>
317
+ <td style="width:55%; padding: 10px;"><?php echo get_option('mo2f_api_key');?></td>
318
+ </tr>
319
+ <tr>
320
+ <td style="width:45%; padding: 10px;"><b>Token Key</b></td>
321
+ <td style="width:55%; padding: 10px;"><?php echo get_option('mo2f_customer_token');?></td>
322
+ </tr>
323
+ <?php if(get_option('mo2f_app_secret')){ ?>
324
+ <tr>
325
+ <td style="width:45%; padding: 10px;"><b>App Secret</b></td>
326
+ <td style="width:55%; padding: 10px;"><?php echo get_option('mo2f_app_secret');?></td>
327
+ </tr>
328
+ <?php
329
+ }
330
+ ?>
331
+ <tr style="height:40px;">
332
+ <td style="border-right-color:white;"><a href="#mo_registered_forgot_password"><b>Click Here</b></a> if you forgot your password ?</td>
333
+ <td></td>
334
+
335
+ </tr>
336
+ <?php
337
+ }
338
+ ?>
339
+ </table><br>
340
+ <form name="f" method="post" action="" id="forgotpasswordform">
341
+ <input type="hidden" name="email" id="hidden_email" value="<?php echo get_option('mo2f_email'); ?>" />
342
+ <input type="hidden" name="option" value="mo_2factor_forgot_password"/>
343
+ </form>
344
+ <script>
345
+ jQuery('a[href=\"#mo_registered_forgot_password\"]').click(function(){
346
+ jQuery('#forgotpasswordform').submit();
347
+ });
348
+ </script>
349
+
350
+ </div>
351
+
352
+ <br><br>
353
+
354
+ <?php
355
+ }
356
+
357
+ function instruction_for_mobile_registration($current_user){
358
+ if(!get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) {
359
+ download_instruction_for_mobile_app($current_user);
360
+ }
361
+ ?><div>
362
+ <h3>Step-2 : Scan QR code</h3><hr>
363
+
364
+ <form name="f" method="post" action="">
365
+ <input type="hidden" name="option" value="mo_auth_refresh_mobile_qrcode" />
366
+ <?php if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) { ?>
367
+ <div id="reconfigurePhone">
368
+ <a data-toggle="collapse" href="#mo2f_show_download_app" aria-expanded="false" >Click here to see Authenticator App download instructions.</a>
369
+ <div id="mo2f_show_download_app" class="mo2f_collapse">
370
+ <?php download_instruction_for_mobile_app($current_user); ?>
371
+ </div>
372
+ <br>
373
+ <h4>Please click on 'Reconfigure your phone' button below to see QR Code.</h4>
374
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
375
+ <input type="submit" name="submit" class="button button-primary button-large" value="Reconfigure your phone" />
376
+ </div>
377
+
378
+ <?php } else {?>
379
+ <div id="configurePhone"><h4>Please click on 'Configure your phone' button below to see QR Code.</h4>
380
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
381
+ <input type="submit" name="submit" class="button button-primary button-large" value="Configure your phone" />
382
+ </div>
383
+ <?php } ?>
384
+ </form>
385
+
386
+ <?php
387
+ if(isset($_SESSION[ 'mo2f_show_qr_code' ]) && $_SESSION[ 'mo2f_show_qr_code' ] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['option']) && $_POST['option'] == 'mo_auth_refresh_mobile_qrcode'){
388
+ initialize_mobile_registration();
389
+ if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) { ?>
390
+ <script>jQuery("#mo2f_app_div").show();</script>
391
+ <?php
392
+ } else{ ?>
393
+ <script>jQuery("#mo2f_app_div").hide();</script>
394
+ <?php
395
+ }
396
+ } else{
397
+ ?><br><br>
398
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
399
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
400
+
401
+ </form>
402
+
403
+ <script>
404
+ jQuery('#back_btn').click(function() {
405
+ jQuery('#mo2f_cancel_form').submit();
406
+ });
407
+ </script>
408
+ <?php } ?>
409
+
410
+
411
+ <?php }
412
+
413
+ function download_instruction_for_mobile_app($current_user){ ?>
414
+ <div id="mo2f_app_div" class="mo_margin_left">
415
+ <?php if(!get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) { ?>
416
+ <a class="mo_app_link" data-toggle="collapse" href="#mo2f_sub_header_app" aria-expanded="false" ><h3 class="mo2f_authn_header">Step-1 : Download the <span style="color: #F78701;">miniOrange Authenticator</span> App</h3></a><hr class="mo_hr">
417
+
418
+ <div class="mo2f_collapse in" id="mo2f_sub_header_app">
419
+ <?php } ?>
420
+ <table width="100%;" id="mo2f_inline_table">
421
+ <tr id="mo2f_inline_table">
422
+
423
+ <td>
424
+ <h4 id="mo2f_phone_id"><b>iPhone Users</b></h4>
425
+ <ol>
426
+ <li>Go to App Store</li>
427
+ <li>Search for <b>miniOrange</b></li>
428
+ <li>Download and install <span style="color: #F78701;"><b>miniOrange Authenticator</b></span> app (<b>NOT MOAuth</b>)</li>
429
+ </ol>
430
+ <span><a target="_blank" href="https://itunes.apple.com/us/app/miniorange-authenticator/id796303566?ls=1"><img src="<?php echo plugins_url( 'includes/images/appstore.png' , __FILE__ );?>" style="width:120px; height:45px; margin-left:6px;"></a></span>
431
+ </td>
432
+ <td>
433
+ <h4 id="mo2f_phone_id"><b>Android Users</b></h4>
434
+ <ol>
435
+ <li> Go to Google Play Store.</li>
436
+ <li> Search for <b>miniOrange.</b></li>
437
+ <li>Download and install miniOrange <span style="color: #F78701;"><b>miniOrange Authenticator</b></span> app (<b>NOT MOAuth </b>)</li>
438
+ </ol>
439
+ <a target="_blank" href="https://play.google.com/store/apps/details?id=com.miniorange.authbeta"><img src="<?php echo plugins_url( 'includes/images/playStore.png' , __FILE__ );?>" style="width:120px; height:=45px; margin-left:6px;"></a>
440
+ </td>
441
+
442
+ </tr>
443
+ </table>
444
+ <?php if(!get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) { ?> </div> <?php
445
+ }
446
+ ?>
447
+ </div>
448
+ <?php
449
+ }
450
+ function mo2f_configure_kba_questions(){ ?>
451
+ <div class="mo2f_kba_header">Please choose 3 questions</div>
452
+ <br>
453
+ <table class="mo2f_kba_table" >
454
+ <tr class="mo2f_kba_header">
455
+ <td>
456
+ Sr. No.
457
+ </td>
458
+ <td class="mo2f_kba_tb_data">
459
+ Questions
460
+ </td>
461
+ <td>
462
+ Answers
463
+ </td>
464
+ </tr>
465
+ <tr class="mo2f_kba_body">
466
+ <td>
467
+ <center>1.</center>
468
+ </td>
469
+ <td class="mo2f_kba_tb_data">
470
+ <select name="mo2f_kbaquestion_1" id="mo2f_kbaquestion_1" class="mo2f_kba_ques" required="true" onchange="mo_option_hide(1)">
471
+ <option value="" selected="selected">-------------------------Select your question-------------------------</option>
472
+ <option id="mq1_1" value="What is your first company name?">What is your first company name?</option>
473
+ <option id="mq2_1" value="What was your childhood nickname?">What was your childhood nickname?</option>
474
+ <option id="mq3_1" value="In what city did you meet your spouse/significant other?">In what city did you meet your spouse/significant other?</option>
475
+ <option id="mq4_1" value="What is the name of your favorite childhood friend?">What is the name of your favorite childhood friend?</option>
476
+ <option id="mq5_1" value="What school did you attend for sixth grade?">What school did you attend for sixth grade?</option>
477
+ <option id="mq6_1" value="In what city or town was your first job?">In what city or town was your first job?</option>
478
+ <option id="mq7_1" value="What is your favourite sport?">What is your favourite sport?</option>
479
+ <option id="mq8_1" value="Who is your favourite sports player?">Who is your favourite sports player?</option>
480
+ <option id="mq9_1" value="What is your grandmother's maiden name?">What is your grandmother's maiden name?</option>
481
+ <option id="mq10_1" value="What was your first vehicle's registration number?">What was your first vehicle's registration number?</option>
482
+ </select>
483
+ </td>
484
+ <td>
485
+ <input class="mo2f_table_textbox" type="text" name="mo2f_kba_ans1" id="mo2f_kba_ans1" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" required="true" autofocus="true" placeholder="Enter your answer" />
486
+ </td>
487
+ </tr>
488
+ <tr class="mo2f_kba_body">
489
+ <td>
490
+ <center>2.</center>
491
+ </td>
492
+ <td class="mo2f_kba_tb_data">
493
+ <select name="mo2f_kbaquestion_2" id="mo2f_kbaquestion_2" class="mo2f_kba_ques" required="true" onchange="mo_option_hide(2)">
494
+ <option value="" selected="selected">-------------------------Select your question-------------------------</option>
495
+ <option id="mq1_2" value="What is your first company name?">What is your first company name?</option>
496
+ <option id="mq2_2" value="What was your childhood nickname?">What was your childhood nickname?</option>
497
+ <option id="mq3_2" value="In what city did you meet your spouse/significant other?">In what city did you meet your spouse/significant other?</option>
498
+ <option id="mq4_2" value="What is the name of your favorite childhood friend?">What is the name of your favorite childhood friend?</option>
499
+ <option id="mq5_2" value="What school did you attend for sixth grade?">What school did you attend for sixth grade?</option>
500
+ <option id="mq6_2" value="In what city or town was your first job?">In what city or town was your first job?</option>
501
+ <option id="mq7_2" value="What is your favourite sport?">What is your favourite sport?</option>
502
+ <option id="mq8_2" value="Who is your favourite sports player?">Who is your favourite sports player?</option>
503
+ <option id="mq9_2" value="What is your grandmother's maiden name?">What is your grandmother's maiden name?</option>
504
+ <option id="mq10_2" value="What was your first vehicle's registration number?">What was your first vehicle's registration number?</option>
505
+ </select>
506
+ </td>
507
+ <td>
508
+ <input class="mo2f_table_textbox" type="text" name="mo2f_kba_ans2" id="mo2f_kba_ans2" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" required="true" placeholder="Enter your answer" />
509
+ </td>
510
+ </tr>
511
+ <tr class="mo2f_kba_body">
512
+ <td>
513
+ <center>3.</center>
514
+ </td>
515
+ <td class="mo2f_kba_tb_data">
516
+ <input class="mo2f_kba_ques" type="text" name="mo2f_kbaquestion_3" id="mo2f_kbaquestion_3" required="true" placeholder="Enter your custom question here"/>
517
+ </td>
518
+ <td>
519
+ <input class="mo2f_table_textbox" type="text" name="mo2f_kba_ans3" id="mo2f_kba_ans3" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" required="true" placeholder="Enter your answer"/>
520
+ </td>
521
+ </tr>
522
+ </table>
523
+ <script>
524
+ //hidden element in dropdown list 1
525
+ var mo_option_to_hide1;
526
+ //hidden element in dropdown list 2
527
+ var mo_option_to_hide2;
528
+
529
+ function mo_option_hide(list) {
530
+ //grab the team selected by the user in the dropdown list
531
+ var list_selected = document.getElementById("mo2f_kbaquestion_" + list).selectedIndex;
532
+ //if an element is currently hidden, unhide it
533
+ if (typeof (mo_option_to_hide1) != "undefined" && mo_option_to_hide1 !== null && list == 2) {
534
+ mo_option_to_hide1.style.display = 'block';
535
+ } else if (typeof (mo_option_to_hide2) != "undefined" && mo_option_to_hide2 !== null && list == 1) {
536
+ mo_option_to_hide2.style.display = 'block';
537
+ }
538
+ //select the element to hide and then hide it
539
+ if (list == 1) {
540
+ if(list_selected != 0){
541
+ mo_option_to_hide2 = document.getElementById("mq" + list_selected + "_2");
542
+ mo_option_to_hide2.style.display = 'none';
543
+ }
544
+ }
545
+ if (list == 2) {
546
+ if(list_selected != 0){
547
+ mo_option_to_hide1 = document.getElementById("mq" + list_selected + "_1");
548
+ mo_option_to_hide1.style.display = 'none';
549
+ }
550
+ }
551
+ }
552
+ </script>
553
+ <?php if(isset($_SESSION['mo2f_mobile_support']) && $_SESSION['mo2f_mobile_support'] == 'MO2F_EMAIL_BACKUP_KBA'){
554
+ ?>
555
+ <input type="hidden" name="mobile_kba_option" value="mo2f_request_for_kba_as_emailbackup" />
556
+ <?php
557
+ }
558
+ }
559
+ function mo2f_configure_for_mobile_suppport_kba($current_user){
560
+ ?>
561
+
562
+ <h3>Configure Second Factor - KBA (Security Questions)</h3><hr />
563
+ <form name="f" method="post" action="" id="mo2f_kba_setup_form">
564
+ <?php mo2f_configure_kba_questions(); ?>
565
+ <br />
566
+ <input type="hidden" name="option" value="mo2f_save_kba" />
567
+ <table>
568
+ <tr>
569
+ <td></td>
570
+ <td>
571
+ <input type="submit" id="mo2f_kba_submit_btn" name="submit" value="Save" class="button button-primary button-large" style="width:100px;line-height:30px;"/>
572
+ </form>
573
+ </td>
574
+ <td>
575
+
576
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
577
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
578
+ <input type="submit" name="back" id="back_btn" class="button button-primary button-large" value="Back" style="width:100px;line-height:30px;" />
579
+ </form>
580
+
581
+ </td>
582
+ </tr>
583
+ </table>
584
+ <script>
585
+
586
+ jQuery('#mo2f_kba_submit_btn').click(function() {
587
+ jQuery('#mo2f_kba_setup_form').submit();
588
+ });
589
+ </script>
590
+ <?php
591
+ }
592
+
593
+ function mo2f_select_2_factor_method($current_user,$mo2f_second_factor){
594
+
595
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
596
+ $random_mo_key = get_option('mo2f_new_customer');
597
+ $selectedMethod = $mo2f_second_factor;
598
+ if($mo2f_second_factor == 'OUT OF BAND EMAIL'){
599
+ $selectedMethod = "Email Verification";
600
+ } else if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
601
+ $selectedMethod = "QR Code Authentication";
602
+ }else if($mo2f_second_factor == 'SMS'){
603
+ $selectedMethod = "OTP Over SMS";
604
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
605
+ $app_type = get_user_meta($current_user->ID,'mo2f_external_app_type',true);
606
+ if($app_type == 'GOOGLE AUTHENTICATOR'){
607
+ $selectedMethod = 'GOOGLE AUTHENTICATOR';
608
+ }else if($app_type == 'AUTHY 2-FACTOR AUTHENTICATION'){
609
+ $selectedMethod = 'AUTHY 2-FACTOR AUTHENTICATION';
610
+ }else{
611
+ $selectedMethod = 'GOOGLE AUTHENTICATOR';
612
+ update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
613
+ }
614
+ }?>
615
+ <div class="mo2f_table_layout">
616
+ <?php
617
+
618
+ if( get_user_meta($current_user->ID,'mo2f_configure_test_option',true) == 'MO2F_CONFIGURE'){
619
+
620
+ $current_selected_method = get_user_meta($current_user->ID,'mo2f_selected_2factor_method',true);
621
+ if($current_selected_method == 'MOBILE AUTHENTICATION' || $current_selected_method == 'SOFT TOKEN' || $current_selected_method == 'PUSH NOTIFICATIONS'){
622
+ instruction_for_mobile_registration($current_user);
623
+ }else if($current_selected_method == 'SMS' || $current_selected_method == 'PHONE VERIFICATION'){
624
+ show_verify_phone_for_otp($current_user);
625
+ }else if($current_selected_method == 'GOOGLE AUTHENTICATOR' ){
626
+ mo2f_configure_google_authenticator($current_user);
627
+ }else if($current_selected_method == 'AUTHY 2-FACTOR AUTHENTICATION' ){
628
+ mo2f_configure_authy_authenticator($current_user);
629
+ }else if($current_selected_method == 'KBA' ){
630
+ mo2f_configure_for_mobile_suppport_kba($current_user);
631
+ }else{
632
+ test_out_of_band_email($current_user);
633
+ }
634
+ } else if( get_user_meta($current_user->ID,'mo2f_configure_test_option',true) == 'MO2F_TEST') {
635
+
636
+ $current_selected_method = get_user_meta($current_user->ID,'mo2f_selected_2factor_method',true);
637
+
638
+ if($current_selected_method == 'MOBILE AUTHENTICATION') {
639
+ test_mobile_authentication();
640
+ }else if($current_selected_method == 'PUSH NOTIFICATIONS'){
641
+ test_push_notification();
642
+ }else if($current_selected_method == 'SOFT TOKEN'){
643
+ test_soft_token();
644
+ }else if ($current_selected_method == 'SMS' || $current_selected_method == 'PHONE VERIFICATION'){
645
+ test_otp_over_sms($current_user);
646
+ }else if($current_selected_method == 'GOOGLE AUTHENTICATOR' || $current_selected_method == 'AUTHY 2-FACTOR AUTHENTICATION' ){
647
+ test_google_authenticator($current_selected_method);
648
+ }else if( $current_selected_method == 'KBA' ){
649
+ test_kba_authentication($current_user);
650
+ }else {
651
+ test_out_of_band_email($current_user);
652
+ }
653
+
654
+ }else{
655
+
656
+ if(!get_user_meta($current_user->ID,'mo2f_kba_registration_status',true) && ((get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') || (get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'))){
657
+
658
+ ?>
659
+
660
+ <div style="display:block;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);" class="error notice is-dismissible"><a href="#mo2f_kba_config">Click Here</a> to configure Security Questions (KBA) as alternate 2 factor method so that you are not locked out of your account in case you lost or forgot your phone. </div>
661
+
662
+ <?php
663
+
664
+ }else if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'){
665
+ ?>
666
+ <br />
667
+ <div style="display:block;color:red;background-color:rgba(251, 232, 0, 0.15);padding:5px;border:solid 1px rgba(255, 0, 9, 0.36);">Please configure your 2nd factor here to complete the Two-Factor setup..</div>
668
+ <?php
669
+ }
670
+ ?>
671
+ <h3>Setup Two-Factor<span style="font-size:15px;color:rgb(24, 203, 45);padding-left:250px;">Active Method - <?php echo $selectedMethod; ?></span><span style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=2factor_setup" >Need Support?</a></span></h3><hr>
672
+ <p><b>Select any Two-Factor of your choice below and complete its setup. <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo">Click here to see How To Setup ?</a></b>
673
+ </p>
674
+ <form name="f" method="post" action="" id="mo2f_2factor_form">
675
+ <table style="width:100%;">
676
+ <tr>
677
+ <td>
678
+ <span class="color-icon selectedMethod"></span> - Active Method
679
+ <span class="color-icon activeMethod"></span> - Configured Method
680
+ <span class="color-icon inactiveMethod"></span> - Unconfigured Method
681
+ </td>
682
+ </tr>
683
+ </table><br>
684
+ <table>
685
+ <tr>
686
+ <td class="<?php if(!current_user_can('manage_options') && !(in_array("OUT OF BAND EMAIL", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
687
+ <div class="mo2f_thumbnail">
688
+ <label title="Supported in Desktops, Laptops, Smartphones.">
689
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="OUT OF BAND EMAIL" <?php checked($mo2f_second_factor == 'OUT OF BAND EMAIL');
690
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
691
+ } else{ echo 'disabled'; } ?> />
692
+ Email Verification
693
+ </label><hr>
694
+ <p>
695
+ You will receive an email with link. You have to click the ACCEPT or DENY link to verify your email. Supported in Desktops, Laptops, Smartphones.
696
+ </p>
697
+
698
+ <?php if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
699
+ if(!get_user_meta($current_user->ID,'mo2f_email_verification_status',true)){
700
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
701
+ }
702
+ ?>
703
+ <div class="configuredLaptop" id="OUT_OF_BAND_EMAIL" title="Supported in Desktops, Laptops, Smartphones">
704
+ <a href="#test" data-method="OUT OF BAND EMAIL" <?php checked($mo2f_second_factor == 'OUT OF BAND EMAIL'); ?> >Test</a>
705
+ </div>
706
+ <?php } else { ?>
707
+
708
+ <div class="notConfiguredLaptop" style="padding:20px;" id="OUT_OF_BAND_EMAIL" title="Supported in Desktops, Laptops, Smartphones."></div>
709
+ <?php } ?>
710
+ </div>
711
+
712
+
713
+ </td>
714
+ <td class="<?php if(!current_user_can('manage_options') && !(in_array("SMS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
715
+ <div class="mo2f_thumbnail">
716
+ <label title="Supported in Smartphones, Feature Phones.">
717
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="SMS" <?php checked($mo2f_second_factor == 'SMS');
718
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
719
+ } else{ echo 'disabled'; } ?> />
720
+ OTP Over SMS<?php echo $random_mo_key ? '*<span style="float:right;"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing" ><b>PREMIUM**</b></a></span>' :'';?>
721
+ </label><hr>
722
+ <p>
723
+ You will receive a one time passcode via SMS on your phone. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones.
724
+ </p>
725
+ <?php if(get_user_meta($current_user->ID,'mo2f_otp_registration_status',true)){ ?>
726
+ <div class="configuredBasic" id="SMS" title="supported in smartphone,feature phone">
727
+ <a href="#reconfigure" data-method="SMS" >Reconfigure</a> | <a href="#test" data-method="SMS">Test</a>
728
+ </div>
729
+ <?php } else { ?>
730
+ <div class="notConfiguredBasic" title="Supported in Smartphones, Feature Phones."><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo">How To Setup ?</a></div>
731
+ <?php } ?>
732
+ </div>
733
+ </td >
734
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("PHONE VERIFICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>">
735
+ <div><div class="mo2f_grayed_out_link"><?php echo $random_mo_key ? '<span style="float:right;" title="This feature is avialable in premium version of plugin"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_pricing" ><b>PREMIUM**</b></a></span>' :'';?></div>
736
+ <div class="mo2f_thumbnail<?php echo $random_mo_key ? " mo2f_grayed_out" : '';?>" >
737
+ <label title="Supported in Landline phones, Smartphones, Feature phones.">
738
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="PHONE VERIFICATION" <?php checked($mo2f_second_factor == 'PHONE VERIFICATION');
739
+ if(!$random_mo_key && (get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR') ){
740
+ } else{ echo 'disabled'; } ?> />
741
+ Phone Call Verification
742
+ </label><hr>
743
+ <p>
744
+ You will receive a phone call telling a one time passcode. You have to enter the one time passcode to login. Supported in Landlines, Smartphones, Feature phones.
745
+ </p>
746
+ <?php if(get_user_meta($current_user->ID,'mo2f_otp_registration_status',true)){ ?>
747
+ <div class="configuredLandline" id="PHONE_VERIFICATION" title="Supported in Landline phones, Smartphones, Feature phones.">
748
+ <a href="#reconfigure" data-method="PHONE VERIFICATION" >Reconfigure</a> | <a href="#test" data-method="PHONE VERIFICATION">Test</a>
749
+ </div>
750
+ <?php } else { ?>
751
+ <div class="notConfiguredLandline" title="supported in Landline phone,smartphone,feature phone"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo2">How To Setup ?</a></div>
752
+ <?php } ?>
753
+ </div>
754
+ </div>
755
+ </td>
756
+ </tr>
757
+ <tr>
758
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("SOFT TOKEN", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
759
+ <div class="mo2f_thumbnail">
760
+ <label title="Supported in Smartphones only" >
761
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="SOFT TOKEN" <?php checked($mo2f_second_factor == 'SOFT TOKEN');
762
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
763
+ } else{ echo 'disabled'; } ?> />
764
+ Soft Token
765
+ </label><hr>
766
+ <p>
767
+ You have to enter 6 digits code generated by miniOrange Authenticator App like Google Authenticator code to login. Supported in Smartphones only.
768
+ </p>
769
+ <?php if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)){ ?>
770
+ <div class="configuredSmart" id="SOFT_TOKEN" title="Supported in Smartphones only">
771
+ <a href="#reconfigure" data-method="SOFT TOKEN" >Reconfigure</a> | <a href="#test" data-method="SOFT TOKEN">Test</a>
772
+ </div>
773
+ <?php } else { ?>
774
+ <div class="notConfiguredSmart" title="supported in smartphone"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo1">How To Setup ?</a></div>
775
+ <?php } ?>
776
+ </div>
777
+ </td>
778
+
779
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("MOBILE AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
780
+ <div class="mo2f_thumbnail">
781
+ <label title="Supported in Smartphones only.">
782
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="MOBILE AUTHENTICATION" <?php checked($mo2f_second_factor == 'MOBILE AUTHENTICATION');
783
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
784
+ } else{ echo 'disabled'; } ?> />
785
+ QR Code Authentication
786
+ </label><hr>
787
+ <p>
788
+ You have to scan the QR Code from your phone using miniOrange Authenticator App to login. Supported in Smartphones only.
789
+ </p>
790
+ <?php if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true) ){ ?>
791
+ <div class="configuredSmart" id="MOBILE_AUTHENTICATION" title="Supported in Smartphones only.">
792
+ <a href="#reconfigure" data-method="MOBILE AUTHENTICATION">Reconfigure</a> | <a href="#test" data-method="MOBILE AUTHENTICATION">Test</a>
793
+ </div>
794
+ <?php } else { ?>
795
+ <div class="notConfiguredSmart" title="Supported in Smartphones only"><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo3">How To Setup ?</a></div>
796
+ <?php } ?>
797
+ </div>
798
+ </td>
799
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("PUSH NOTIFICATIONS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
800
+ <div class="mo2f_thumbnail">
801
+ <label title="Supported in Smartphones only">
802
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="PUSH NOTIFICATIONS" <?php checked($mo2f_second_factor == 'PUSH NOTIFICATIONS');
803
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
804
+ } else{ echo 'disabled'; } ?> />
805
+ Push Notification
806
+ </label><hr>
807
+ <p>
808
+ You will receive a push notification on your phone. You have to ACCEPT or DENY it to login. Supported in Smartphones only.
809
+ </p>
810
+ <?php if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)){ ?>
811
+ <div class="configuredSmart" id="PUSH_NOTIFICATIONS" title="supported in smartphone">
812
+ <a href="#reconfigure" data-method="PUSH NOTIFICATIONS" >Reconfigure</a> | <a href="#test" data-method="PUSH NOTIFICATIONS">Test</a>
813
+ </div>
814
+ <?php } else { ?>
815
+ <div class="notConfiguredSmart" title="Supported in Smartphones only."><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo3">How To Setup ?</a></div>
816
+ <?php } ?>
817
+ </div>
818
+ </td>
819
+ </tr>
820
+ <tr>
821
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("GOOGLE AUTHENTICATOR", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
822
+
823
+ <div class="mo2f_thumbnail">
824
+ <label title="Supported in Smartphones only">
825
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="GOOGLE AUTHENTICATOR" <?php checked($selectedMethod == 'GOOGLE AUTHENTICATOR');
826
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
827
+ } else{ echo 'disabled'; } ?> />
828
+ Google Authenticator
829
+ </label><hr>
830
+ <p>
831
+ You have to enter 6 digits code generated by Google Authenticator App to login. Supported in Smartphones only.
832
+ </p>
833
+ <?php if(get_user_meta($current_user->ID,'mo2f_google_authentication_status',true)){ ?>
834
+ <div class="configuredSmart" id="GOOGLE_AUTHENTICATOR" title="supported in smartphone">
835
+ <a href="#reconfigure" data-method="GOOGLE AUTHENTICATOR" >Reconfigure</a> | <a href="#test" data-method="GOOGLE AUTHENTICATOR">Test</a>
836
+ </div>
837
+ <?php } else { ?>
838
+ <div class="notConfiguredSmart" title="Supported in Smartphones only."><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo5">How To Setup ?</a></div>
839
+ <?php } ?>
840
+ </div>
841
+ </td>
842
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
843
+
844
+ <div class="mo2f_thumbnail">
845
+ <label title="Supported in Smartphones only">
846
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="AUTHY 2-FACTOR AUTHENTICATION" <?php checked($selectedMethod == 'AUTHY 2-FACTOR AUTHENTICATION');
847
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
848
+ } else{ echo 'disabled'; } ?> />
849
+ Authy 2-Factor Authentication
850
+ </label><hr>
851
+ <p>
852
+ You have to enter 6 digits code generated by Authy 2-Factor Authentication App to login. Supported in Smartphones only.
853
+ </p>
854
+ <?php if(get_user_meta($current_user->ID,'mo2f_authy_authentication_status',true)){ ?>
855
+ <div class="configuredSmart" id="GOOGLE_AUTHENTICATOR" title="supported in smartphone">
856
+ <a href="#reconfigure" data-method="AUTHY 2-FACTOR AUTHENTICATION" >Reconfigure</a> | <a href="#test" data-method="AUTHY 2-FACTOR AUTHENTICATION">Test</a>
857
+ </div>
858
+ <?php } else { ?>
859
+ <div class="notConfiguredSmart" title="Supported in Smartphones only."><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo5">How To Setup ?</a></div>
860
+ <?php } ?>
861
+ </div>
862
+ </td>
863
+ <td class="<?php if( !current_user_can('manage_options') && !(in_array("KBA", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
864
+
865
+ <div class="mo2f_thumbnail">
866
+ <label title="Supported in DeskTops,Laptops and Smartphones.">
867
+ <input type="radio" name="mo2f_selected_2factor_method" style="margin:5px;" value="KBA" <?php checked($mo2f_second_factor == 'KBA');
868
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR' ){
869
+ } else{ echo 'disabled'; } ?> />
870
+ Security Questions( KBA )
871
+ </label><hr>
872
+ <p>
873
+ You have to answers some knowledge based security questions which are only known to you to authenticate yourself. Supported in Desktops,Laptops,Smartphones.
874
+ </p>
875
+ <?php if(get_user_meta($current_user->ID,'mo2f_kba_registration_status',true)) { ?>
876
+ <div class="configuredLaptop" id="KBA" title="Supported in Desktops, Laptops, Smartphones">
877
+ <a href="#reconfigure" data-method="KBA" >Reconfigure</a> | <a href="#test" data-method="KBA">Test</a>
878
+ </div>
879
+ <?php } else { ?>
880
+ <div class="notConfiguredLaptop" style="padding:10px !important;"title="Supported in Desktops, Laptops, Smartphones."><a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo6">How To Setup ?</a></div>
881
+ <?php } ?>
882
+
883
+ </div>
884
+ </td>
885
+ </tr>
886
+
887
+ </table>
888
+ <?php echo $random_mo_key ? '<h4>*10 free transactions of OTP over SMS are provided in the free version of the plugin. </h4><h4>
889
+ **These authentication methods are provided in premium plugin.</h4>' : ''; ?>
890
+ <input type="hidden" name="option" value="mo2f_save_2factor_method" />
891
+ </form>
892
+ <form name="f" method="post" action="" id="mo2f_2factor_save_form">
893
+ <input type="hidden" name="option" value="mo2f_update_2factor_method" />
894
+ <input type="hidden" name="mo2f_selected_2factor_method" id="mo2f_selected_2factor_method" />
895
+ </form>
896
+ <form name="f" method="post" action="" id="mo2f_2factor_reconfigure_form">
897
+ <input type="hidden" name="mo2f_selected_2factor_method" id="mo2f_reconfigure_2factor_method" />
898
+ <input type="hidden" name="option" value="mo2f_save_2factor_method" />
899
+ </form>
900
+ <form name="f" method="post" action="" id="mo2f_2factor_test_mobile_form">
901
+ <input type="hidden" name="option" value="mo_2factor_test_mobile_authentication" />
902
+ </form>
903
+ <form name="f" method="post" action="" id="mo2f_2factor_test_softtoken_form">
904
+ <input type="hidden" name="option" value="mo_2factor_test_soft_token" />
905
+ </form>
906
+ <form name="f" method="post" action="" id="mo2f_2factor_test_smsotp_form">
907
+ <input type="hidden" name="mo2f_selected_2factor_method" id="mo2f_test_2factor_method" />
908
+ <input type="hidden" name="option" value="mo_2factor_test_otp_over_sms" />
909
+ </form>
910
+ <form name="f" method="post" action="" id="mo2f_2factor_test_push_form">
911
+ <input type="hidden" name="option" value="mo_2factor_test_push_notification" />
912
+ </form>
913
+ <form name="f" method="post" action="" id="mo2f_2factor_test_out_of_band_email_form">
914
+ <input type="hidden" name="option" value="mo_2factor_test_out_of_band_email" />
915
+ </form>
916
+ <form name="f" method="post" action="" id="mo2f_2factor_test_google_auth_form" >
917
+ <input type="hidden" name="option" value="mo_2factor_test_google_auth" />
918
+ </form>
919
+ <form name="f" method="post" action="" id="mo2f_2factor_test_authy_app_form" >
920
+ <input type="hidden" name="option" value="mo_2factor_test_authy_auth" />
921
+ </form>
922
+ <form name="f" method="post" action="" id="mo2f_2factor_test_kba_form" >
923
+ <input type="hidden" name="option" value="mo2f_2factor_test_kba" />
924
+ </form>
925
+ <form name="f" method="post" action="" id="mo2f_2factor_configure_kba_backup_form" >
926
+ <input type="hidden" name="option" value="mo2f_2factor_configure_kba_backup" />
927
+ </form>
928
+
929
+ <script>
930
+
931
+ jQuery('a[href=\"#mo2f_kba_config\"]').click(function() {
932
+ jQuery('#mo2f_2factor_configure_kba_backup_form').submit();
933
+ });
934
+
935
+ jQuery('input:radio[name=mo2f_selected_2factor_method]').click(function() {
936
+ var selectedMethod = jQuery(this).val();
937
+ <?php if(get_user_meta($current_user->ID,'mo2f_mobile_registration_status',true)) { ?>
938
+ if(selectedMethod == 'MOBILE AUTHENTICATION' || selectedMethod == 'SOFT TOKEN' || selectedMethod == 'PUSH NOTIFICATIONS' ){
939
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
940
+ jQuery('#mo2f_2factor_save_form').submit();
941
+ }
942
+ <?php } else{ ?>
943
+ if(selectedMethod == 'MOBILE AUTHENTICATION' || selectedMethod == 'SOFT TOKEN' || selectedMethod == 'PUSH NOTIFICATIONS' ){
944
+ jQuery('#mo2f_2factor_form').submit();
945
+ }
946
+ <?php } if(get_user_meta($current_user->ID,'mo2f_email_verification_status',true)) { ?>
947
+ if(selectedMethod == 'OUT OF BAND EMAIL' ){
948
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
949
+ jQuery('#mo2f_2factor_save_form').submit();
950
+ }
951
+ <?php } else{ ?>
952
+ if(selectedMethod == 'OUT OF BAND EMAIL' ){
953
+ jQuery('#mo2f_2factor_form').submit();
954
+ }
955
+ <?php } if(get_user_meta($current_user->ID,'mo2f_otp_registration_status',true)) { ?>
956
+ if(selectedMethod == 'SMS' || selectedMethod == 'PHONE VERIFICATION'){
957
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
958
+ jQuery('#mo2f_2factor_save_form').submit();
959
+ }
960
+
961
+ <?php } else{ ?>
962
+ if(selectedMethod == 'SMS' || selectedMethod == 'PHONE VERIFICATION'){
963
+
964
+ jQuery('#mo2f_2factor_form').submit();
965
+ }
966
+
967
+ <?php } if(get_user_meta($current_user->ID,'mo2f_google_authentication_status',true)) { ?>
968
+ if(selectedMethod == 'GOOGLE AUTHENTICATOR' ){
969
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
970
+ jQuery('#mo2f_2factor_save_form').submit();
971
+ }
972
+ <?php } else{ ?>
973
+ if(selectedMethod == 'GOOGLE AUTHENTICATOR' ){
974
+ jQuery('#mo2f_2factor_form').submit();
975
+ }
976
+ <?php } if(get_user_meta($current_user->ID,'mo2f_authy_authentication_status',true)) { ?>
977
+ if(selectedMethod == 'AUTHY 2-FACTOR AUTHENTICATION' ){
978
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
979
+ jQuery('#mo2f_2factor_save_form').submit();
980
+ }
981
+ <?php } else{ ?>
982
+ if(selectedMethod == 'AUTHY 2-FACTOR AUTHENTICATION' ){
983
+ jQuery('#mo2f_2factor_form').submit();
984
+ }
985
+ <?php } if(get_user_meta($current_user->ID,'mo2f_kba_registration_status',true)) { ?>
986
+ if(selectedMethod == 'KBA' ){
987
+ jQuery('#mo2f_selected_2factor_method').val(selectedMethod);
988
+ jQuery('#mo2f_2factor_save_form').submit();
989
+ }
990
+ <?php } else{ ?>
991
+ if(selectedMethod == 'KBA' ){
992
+ jQuery('#mo2f_2factor_form').submit();
993
+ }
994
+ <?php }?>
995
+
996
+
997
+ });
998
+ jQuery('a[href=\"#reconfigure\"]').click(function() {
999
+ var reconfigureMethod = jQuery(this).data("method");
1000
+ jQuery('#mo2f_reconfigure_2factor_method').val(reconfigureMethod);
1001
+ jQuery('#mo2f_2factor_reconfigure_form').submit();
1002
+ });
1003
+ jQuery('a[href=\"#test\"]').click(function() {
1004
+ var currentMethod = jQuery(this).data("method");
1005
+
1006
+ if(currentMethod == 'MOBILE AUTHENTICATION'){
1007
+ jQuery('#mo2f_2factor_test_mobile_form').submit();
1008
+ }else if(currentMethod == 'PUSH NOTIFICATIONS'){
1009
+ jQuery('#mo2f_2factor_test_push_form').submit();
1010
+ }else if(currentMethod == 'SOFT TOKEN'){
1011
+ jQuery('#mo2f_2factor_test_softtoken_form').submit();
1012
+ }else if(currentMethod == 'SMS' || currentMethod == 'PHONE VERIFICATION'){
1013
+ jQuery('#mo2f_test_2factor_method').val(currentMethod);
1014
+ jQuery('#mo2f_2factor_test_smsotp_form').submit();
1015
+ }else if(currentMethod == 'GOOGLE AUTHENTICATOR' ){
1016
+ jQuery('#mo2f_2factor_test_google_auth_form').submit();
1017
+ }else if(currentMethod == 'AUTHY 2-FACTOR AUTHENTICATION'){
1018
+ jQuery('#mo2f_2factor_test_authy_app_form').submit();
1019
+ }else if(currentMethod == 'OUT OF BAND EMAIL'){
1020
+ jQuery('#mo2f_2factor_test_out_of_band_email_form').submit();
1021
+ }else if(currentMethod == 'KBA' ){
1022
+ jQuery('#mo2f_2factor_test_kba_form').submit();
1023
+ }
1024
+ });
1025
+ <?php if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ ?>
1026
+ var currentSecondFactor = jQuery('input[name=mo2f_selected_2factor_method][type=radio]:checked').val();
1027
+ var selectedMethod = currentSecondFactor.replace(/ /g, "_");
1028
+ jQuery("#" + selectedMethod).addClass('selectedMethod');
1029
+ <?php } ?>
1030
+ </script>
1031
+ <?php } ?>
1032
+
1033
+ <br><br>
1034
+ </div>
1035
+ <?php
1036
+ }
1037
+
1038
+ function mo2f_configure_authy_authenticator($current_user){
1039
+ $mo2f_authy_auth = isset($_SESSION['mo2f_authy_keys']) ? $_SESSION['mo2f_authy_keys'] : null;
1040
+ $data = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_qrCode'] : null;
1041
+ $authy_secret = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_secret'] : null;
1042
+ ?>
1043
+ <table>
1044
+ <tr>
1045
+ <td style="vertical-align:top;width:26%;padding-right:15px">
1046
+ <h3>Step-1: Configure with Authy</h3><h3>2-Factor Authentication App.</h3><hr />
1047
+ <form name="f" method="post" id="mo2f_app_type_ga_form" action="" >
1048
+ <br /><input type="submit" name="mo2f_authy_configure" class="button button-primary button-large" style="width:45%;" value="Next >>" /><br /><br />
1049
+ <input type="hidden" name="option" value="mo2f_configure_authy_app" />
1050
+ </form>
1051
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1052
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1053
+ <input type="submit" name="back" id="back_btn" class="button button-primary button-large" style="width:45%;" value="Back" />
1054
+ </form>
1055
+ </td>
1056
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
1057
+ <td style="width:46%;padding-right:15px;vertical-align:top;">
1058
+ <h3>Step-2: Set up Authy 2-Factor Authentication App</h3><h3>&nbsp; </h3><hr>
1059
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
1060
+ <h4>Install the Authy 2-Factor Authentication App.</h4>
1061
+ <h4>Now open and configure Authy 2-Factor Authentication App.</h4>
1062
+ <h4> Tap on Add Account and then tap on SCAN QR CODE in your App and scan the qr code.</h4>
1063
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
1064
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_a" aria-expanded="false" ><b>Can't scan the QR Code? </b></a></div>
1065
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_a">
1066
+ <ol>
1067
+ <li>In Authy 2-Factor Authentication App, tap on ENTER KEY MANUALLY."</li>
1068
+ <li>In "Adding New Account" type your secret key:</li>
1069
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1070
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1071
+ <?php echo $authy_secret; ?>
1072
+ </div>
1073
+ <div style="font-size: 80%;color: #666666;">
1074
+ Spaces don't matter.
1075
+ </div>
1076
+ </div>
1077
+ <li>Tap OK.</li>
1078
+ </ol>
1079
+ </div>
1080
+ </div>
1081
+ </td>
1082
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
1083
+ <td style="vertical-align:top;width:30%">
1084
+ <h3>Step-3: Verify and Save</h3><h3>&nbsp;</h3><hr>
1085
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
1086
+ <h4>Once you have scanned the qr code, enter the verification code generated by the Authenticator app</h4><br/>
1087
+ <form name="f" method="post" action="" >
1088
+ <span><b>Code: </b>
1089
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" required="true" type="text" name="authy_token" placeholder="Enter OTP" style="width:95%;"/></span><br /><br/>
1090
+ <input type="hidden" name="option" value="mo2f_validate_authy_auth" />
1091
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" style="margin-left:12%;"value="Verify and Save" />
1092
+ </form>
1093
+ </div>
1094
+ </td>
1095
+ </tr><br>
1096
+ </table>
1097
+ <script>
1098
+ jQuery('html,body').animate({scrollTop: jQuery(document).height()}, 600);
1099
+ </script>
1100
+ <?php
1101
+ }
1102
+
1103
+ function mo2f_configure_google_authenticator($current_user){
1104
+ $mo2f_google_auth = isset($_SESSION['mo2f_google_auth']) ? $_SESSION['mo2f_google_auth'] : null;
1105
+ $data = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_qrCode'] : null;
1106
+ $ga_secret = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_secret'] : null;
1107
+ ?>
1108
+ <table>
1109
+ <tr>
1110
+ <td style="vertical-align:top;width:22%;padding-right:15px">
1111
+ <h3>Step-1: Select phone Type</h3><hr />
1112
+ <form name="f" method="post" id="mo2f_app_type_ga_form" action="" >
1113
+ <input type="radio" name="mo2f_app_type_radio" value="android" <?php checked( $mo2f_google_auth['ga_phone'] == 'android' ); ?> /> <b>Android</b><br /><br />
1114
+ <input type="radio" name="mo2f_app_type_radio" value="iphone" <?php checked( $mo2f_google_auth['ga_phone'] == 'iphone' ); ?> /> <b>iPhone</b><br /><br />
1115
+ <input type="radio" name="mo2f_app_type_radio" value="blackberry" <?php checked( $mo2f_google_auth['ga_phone'] == 'blackberry' ); ?> /> <b>BlackBerry / Windows</b><br /><br />
1116
+ <input type="hidden" name="option" value="mo2f_configure_google_auth_phone_type" />
1117
+ </form>
1118
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1119
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1120
+ <input type="submit" name="back" id="back_btn" class="button button-primary button-large" style="width:45%;" value="Back" />
1121
+ </form>
1122
+ </td>
1123
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
1124
+ <td style="width:46%;padding-right:15px;vertical-align:top;">
1125
+ <h3>Step-2: Set up Google Authenticator</h3><hr>
1126
+ <div id="mo2f_android_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'android' ? 'display:block' : 'display:none'; ?>" >
1127
+ <h4>Install the Google Authenticator App for Android.</h4>
1128
+ <ol>
1129
+ <li>On your phone,Go to Google Play Store.</li>
1130
+ <li>Search for <b>Google Authenticator.</b>
1131
+ <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Download from the Google Play Store and install the application.</a>
1132
+ </li>
1133
+
1134
+ </ol>
1135
+ <h4>Now open and configure Google Authenticator.</h4>
1136
+ <ol>
1137
+ <li>In Google Authenticator, touch Menu and select "Set up account."</li>
1138
+ <li>Select "Scan a barcode". Use your phone's camera to scan this barcode.</li>
1139
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
1140
+
1141
+ </ol>
1142
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_a" aria-expanded="false" ><b>Can't scan the barcode? </b></a></div>
1143
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_a">
1144
+ <ol>
1145
+ <li>In Google Authenticator, touch Menu and select "Set up account."</li>
1146
+ <li>Select "Enter provided key"</li>
1147
+ <li>In "Enter account name" type your full email address.</li>
1148
+ <li>In "Enter your key" type your secret key:</li>
1149
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1150
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1151
+ <?php echo $ga_secret; ?>
1152
+ </div>
1153
+ <div style="font-size: 80%;color: #666666;">
1154
+ Spaces don't matter.
1155
+ </div>
1156
+ </div>
1157
+ <li>Key type: make sure "Time-based" is selected.</li>
1158
+ <li>Tap Add.</li>
1159
+ </ol>
1160
+ </div>
1161
+ </div>
1162
+
1163
+ <div id="mo2f_iphone_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'iphone' ? 'display:block' : 'display:none'; ?>" >
1164
+ <h4>Install the Google Authenticator app for iPhone.</h4>
1165
+ <ol>
1166
+ <li>On your iPhone, tap the App Store icon.</li>
1167
+ <li>Search for <b>Google Authenticator.</b>
1168
+ <a href="http://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8" target="_blank">Download from the App Store and install it</a>
1169
+ </li>
1170
+ </ol>
1171
+ <h4>Now open and configure Google Authenticator.</h4>
1172
+ <ol>
1173
+ <li>In Google Authenticator, tap "+", and then "Scan Barcode."</li>
1174
+ <li>Use your phone's camera to scan this barcode.
1175
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
1176
+ </li>
1177
+ </ol>
1178
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_i" aria-expanded="false" ><b>Can't scan the barcode? </b></a></div>
1179
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_i" >
1180
+ <ol>
1181
+ <li>In Google Authenticator, tap +.</li>
1182
+ <li>Key type: make sure "Time-based" is selected.</li>
1183
+ <li>In "Account" type your full email address.</li>
1184
+ <li>In "Key" type your secret key:</li>
1185
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1186
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1187
+ <?php echo $ga_secret; ?>
1188
+ </div>
1189
+ <div style="font-size: 80%;color: #666666;">
1190
+ Spaces don't matter.
1191
+ </div>
1192
+ </div>
1193
+ <li>Tap Add.</li>
1194
+ </ol>
1195
+ </div>
1196
+ </div>
1197
+
1198
+ <div id="mo2f_blackberry_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'blackberry' ? 'display:block' : 'display:none'; ?>" >
1199
+ <h4>Install the Google Authenticator app for BlackBerry</h4>
1200
+ <ol>
1201
+ <li>On your phone, open a web browser.Go to <b>m.google.com/authenticator.</b></li>
1202
+ <li>Download and install the Google Authenticator application.</li>
1203
+ </ol>
1204
+ <h4>Now open and configure Google Authenticator.</h4>
1205
+ <ol>
1206
+ <li>In Google Authenticator, select Manual key entry.</li>
1207
+ <li>In "Enter account name" type your full email address.</li>
1208
+ <li>In "Enter key" type your secret key:</li>
1209
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1210
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1211
+ <?php echo $ga_secret; ?>
1212
+ </div>
1213
+ <div style="font-size: 80%;color: #666666;">
1214
+ Spaces don't matter.
1215
+ </div>
1216
+ </div>
1217
+ <li>Choose Time-based type of key.</li>
1218
+ <li>Tap Save.</li>
1219
+ </ol>
1220
+ </div>
1221
+
1222
+ </td>
1223
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
1224
+ <td style="vertical-align:top;width:30%">
1225
+ <h3>Step-3: Verify and Save</h3><hr>
1226
+ <div style="<?php echo isset($_SESSION['mo2f_google_auth']) ? 'display:block' : 'display:none'; ?>">
1227
+ <div>Once you have scanned the barcode, enter the 6-digit verification code generated by the Authenticator app</div><br/>
1228
+ <form name="f" method="post" action="" >
1229
+ <span><b>Code: </b>
1230
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" required="true" type="text" name="google_token" placeholder="Enter OTP" style="width:95%;"/></span><br /><br/>
1231
+ <input type="hidden" name="option" value="mo2f_validate_google_auth" />
1232
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" style="margin-left:12%;"value="Verify and Save" />
1233
+ </form>
1234
+ </div>
1235
+ </td>
1236
+ </tr><br>
1237
+ <a data-toggle="collapse" href="#mo2f_question" aria-expanded="false" ><b>How miniOrange Authenticator is better than Google Authenticator ?</b></a>
1238
+ <div id="mo2f_question" class="mo2f_collapse"><p>
1239
+ miniOrange Authenticator manages the Google Authenticator keys better and easier by providing these extra features:<br>
1240
+ 1. miniOrange <b>encrypts all data</b>, whereas Google Authenticator stores data in plain text.<br>
1241
+ 2. miniOrange Authenticator app has in-build <b>Pin-Protection</b> so you can protect your google authenticator keys or whole app using pin whereas Google Authenticator is not protected at all.<br>
1242
+ 3. No need to type in the code at all. Contact us to get <b>miniOrange Autofill Plugin</b>, it can seamlessly connect your computer to your phone. Code will get auto filled and saved.</p>
1243
+ </div><br><br>
1244
+ </table>
1245
+ <script>
1246
+ jQuery('input[type=radio][name=mo2f_app_type_radio]').change(function() {
1247
+ jQuery('#mo2f_app_type_ga_form').submit();
1248
+ });
1249
+ jQuery('html,body').animate({scrollTop: jQuery(document).height()}, 600);
1250
+ </script>
1251
+ <?php
1252
+ }
1253
+
1254
+ function show_verify_phone_for_otp($current_user){
1255
+ ?>
1256
+ <h3>Verify Your Phone</h3><hr>
1257
+ <form name="f" method="post" action="" id="mo2f_verifyphone_form">
1258
+ <input type="hidden" name="option" value="mo2f_verify_phone" />
1259
+
1260
+ <div style="display:inline;">
1261
+ <input class="mo2f_table_textbox" style="width:200px;" type="text" name="verify_phone" id="phone"
1262
+ value="<?php if( isset($_SESSION['mo2f_phone'])){ echo $_SESSION['mo2f_phone'];} else echo get_user_meta($current_user->ID,'mo2f_user_phone',true); ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" title="Enter phone number without any space or dashes" /><br>
1263
+ <input type="submit" name="verify" id="verify" class="button button-primary button-large" value="Verify" />
1264
+ </div>
1265
+ </form>
1266
+ <form name="f" method="post" action="" id="mo2f_validateotp_form">
1267
+ <input type="hidden" name="option" value="mo2f_validate_otp" />
1268
+ <p>Enter One Time Passcode</p>
1269
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" type="text" name="otp_token" placeholder="Enter OTP" style="width:95%;"/>
1270
+ <?php if (get_user_meta($current_user->ID, 'mo2f_selected_2factor_method',true) == 'SMS'){ ?>
1271
+ <a href="#resendsmslink">Resend OTP ?</a>
1272
+ <?php } else {?>
1273
+ <a href="#resendsmslink">Call Again ?</a>
1274
+ <?php } ?><br><br>
1275
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
1276
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Validate OTP" />
1277
+ </form><br>
1278
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1279
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1280
+ </form>
1281
+ <script>
1282
+ jQuery("#phone").intlTelInput();
1283
+ jQuery('#back_btn').click(function() {
1284
+ jQuery('#mo2f_cancel_form').submit();
1285
+ });
1286
+ jQuery('a[href=\"#resendsmslink\"]').click(function(e) {
1287
+ jQuery('#mo2f_verifyphone_form').submit();
1288
+ });
1289
+
1290
+ </script>
1291
+ <?php
1292
+ }
1293
+
1294
+ function initialize_mobile_registration() {
1295
+ $data = $_SESSION[ 'mo2f_qrCode' ];
1296
+ $url = get_option('mo2f_host_name');
1297
+ ?>
1298
+
1299
+ <p>Open your <b>miniOrange Authenticator</b> app and click on <b>Configure button</b> to scan the QR Code. Your phone should have internet connectivity to scan QR code.</p>
1300
+ <div style="color:red;">
1301
+ <p>I am not able to scan the QR code, <a data-toggle="collapse" href="#mo2f_scanqrcode" aria-expanded="false" >click here </a></p></div>
1302
+ <div class="mo2f_collapse" id="mo2f_scanqrcode">
1303
+ Follow these instructions below and try again.
1304
+ <ol>
1305
+ <li>Make sure your desktop screen has enough brightness.</li>
1306
+ <li>Open your app and click on Configure button to scan QR Code again.</li>
1307
+ <li>If you get cross mark on QR Code then click on 'Refresh QR Code' link.</li>
1308
+ </ol>
1309
+ </div>
1310
+
1311
+ <table class="mo2f_settings_table">
1312
+ <a href="#refreshQRCode">Click here to Refresh QR Code.</a>
1313
+ <div id="displayQrCode" style="margin-left:250px;"><br /> <?php echo '<img style="width:200px;" src="data:image/jpg;base64,' . $data . '" />'; ?>
1314
+ </div>
1315
+ </table>
1316
+ <br />
1317
+ <div id="mobile_registered" >
1318
+ <form name="f" method="post" id="mobile_register_form" action="" style="display:none;">
1319
+ <input type="hidden" name="option" value="mo_auth_mobile_registration_complete" />
1320
+ </form>
1321
+ </div>
1322
+ <form name="f" method="post" action="" id="mo2f_cancel_form" style="display:none;">
1323
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1324
+ </form >
1325
+ <form name="f" method="post" id="mo2f_refresh_qr_form" action="" style="display:none;">
1326
+ <input type="hidden" name="option" value="mo_auth_refresh_mobile_qrcode" />
1327
+ </form >
1328
+
1329
+ <input type="button" name="back" id="back_to_methods" class="button button-primary button-large" value="Back" />
1330
+
1331
+ <br /><br />
1332
+
1333
+ <script>
1334
+ jQuery('#back_to_methods').click(function(e) {
1335
+ jQuery('#mo2f_cancel_form').submit();
1336
+ });
1337
+ jQuery('a[href=\"#refreshQRCode\"]').click(function(e) {
1338
+ jQuery('#mo2f_refresh_qr_form').submit();
1339
+ });
1340
+ jQuery("#configurePhone").hide();
1341
+ jQuery("#reconfigurePhone").hide();
1342
+ var timeout;
1343
+ pollMobileRegistration();
1344
+ function pollMobileRegistration()
1345
+ {
1346
+ var transId = "<?php echo $_SESSION[ 'mo2f_transactionId' ]; ?>";
1347
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
1348
+ var postUrl = "<?php echo $url; ?>" + "/moas/api/auth/registration-status";
1349
+ jQuery.ajax({
1350
+ url: postUrl,
1351
+ type : "POST",
1352
+ dataType : "json",
1353
+ data : jsonString,
1354
+ contentType : "application/json; charset=utf-8",
1355
+ success : function(result) {
1356
+ var status = JSON.parse(JSON.stringify(result)).status;
1357
+ if (status == 'SUCCESS') {
1358
+ var content = "<br/><div id='success'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></div>";
1359
+ jQuery("#displayQrCode").empty();
1360
+ jQuery("#displayQrCode").append(content);
1361
+ setTimeout(function(){jQuery("#mobile_register_form").submit();}, 1000);
1362
+ } else if (status == 'ERROR' || status == 'FAILED') {
1363
+ var content = "<br/><div id='error'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></div>";
1364
+ jQuery("#displayQrCode").empty();
1365
+ jQuery("#displayQrCode").append(content);
1366
+ jQuery("#messages").empty();
1367
+
1368
+ jQuery("#messages").append("<div class='error mo2f_error_container'> <p class='mo2f_msgs'>An Error occured processing your request. Please try again to configure your phone.</p></div>");
1369
+ } else {
1370
+ timeout = setTimeout(pollMobileRegistration, 3000);
1371
+ }
1372
+ }
1373
+ });
1374
+ }
1375
+ jQuery('html,body').animate({scrollTop: jQuery(document).height()}, 800);
1376
+ </script>
1377
+ <?php
1378
+ }
1379
+
1380
+ function test_mobile_authentication() {
1381
+ ?>
1382
+
1383
+ <h3>Test QR Code Authentication</h3><hr>
1384
+ <p>Open your <b>miniOrange Authenticator App</b> and click on <b>Green button</b> to scan the QR code. Your phone should have internet connectivity to scan QR code.</p>
1385
+
1386
+ <div style="color:red;"><b>I am not able to scan the QR code, <a data-toggle="collapse" href="#mo2f_testscanqrcode" aria-expanded="false" >click here </a></b></div>
1387
+ <div class="mo2f_collapse" id="mo2f_testscanqrcode">
1388
+ <br />Follow these instructions below and try again.
1389
+ <ol>
1390
+ <li>Make sure your desktop screen has enough brightness.</li>
1391
+ <li>Open your app and click on Green button (your registered email is displayed on the button) to scan QR Code.</li>
1392
+ <li>If you get cross mark on QR Code then click on 'Back' button and again click on 'Test' link.</li>
1393
+ </ol>
1394
+ </div>
1395
+ <br /><br />
1396
+ <table class="mo2f_settings_table">
1397
+ <div id="qr-success" ></div>
1398
+ <div id="displayQrCode" style="margin-left:250px;"><br/><?php echo '<img style="width:165px;" src="data:image/jpg;base64,' . $_SESSION[ 'mo2f_qrCode' ] . '" />'; ?>
1399
+ </div>
1400
+
1401
+ </table>
1402
+
1403
+ <div id="mobile_registered" >
1404
+ <form name="f" method="post" id="mo2f_mobile_authenticate_success_form" action="">
1405
+ <input type="hidden" name="option" value="mo2f_mobile_authenticate_success" />
1406
+ </form>
1407
+ <form name="f" method="post" id="mo2f_mobile_authenticate_error_form" action="">
1408
+ <input type="hidden" name="option" value="mo2f_mobile_authenticate_error" />
1409
+ </form>
1410
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1411
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1412
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Back" />
1413
+ </form>
1414
+ </div>
1415
+
1416
+
1417
+ <script>
1418
+ var timeout;
1419
+ pollMobileValidation();
1420
+ function pollMobileValidation()
1421
+ {
1422
+ var transId = "<?php echo $_SESSION[ 'mo2f_transactionId' ]; ?>";
1423
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
1424
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
1425
+
1426
+ jQuery.ajax({
1427
+ url: postUrl,
1428
+ type : "POST",
1429
+ dataType : "json",
1430
+ data : jsonString,
1431
+ contentType : "application/json; charset=utf-8",
1432
+ success : function(result) {
1433
+ var status = JSON.parse(JSON.stringify(result)).status;
1434
+ if (status == 'SUCCESS') {
1435
+ var content = "<br /><div id='success'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></div>";
1436
+ jQuery("#displayQrCode").empty();
1437
+ jQuery("#displayQrCode").append(content);
1438
+ setTimeout(function(){jQuery('#mo2f_mobile_authenticate_success_form').submit();}, 1000);
1439
+
1440
+ } else if (status == 'ERROR' || status == 'FAILED') {
1441
+ var content = "<br /><div id='error'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></div>";
1442
+ jQuery("#displayQrCode").empty();
1443
+ jQuery("#displayQrCode").append(content);
1444
+ setTimeout(function(){jQuery('#mo2f_mobile_authenticate_error_form').submit();}, 1000);
1445
+ } else {
1446
+ timeout = setTimeout(pollMobileValidation, 3000);
1447
+ }
1448
+ }
1449
+ });
1450
+ }
1451
+ jQuery('html,body').animate({scrollTop: jQuery(document).height()}, 600);
1452
+ </script>
1453
+ <?php
1454
+ }
1455
+ function test_soft_token(){ ?>
1456
+ <h3>Test Soft Token</h3><hr>
1457
+ <p>Open your <b>miniOrange Authenticator App</b> and click on <b>Soft Token Tab</b>. Enter the <b>one time passcode</b> shown in App in the textbox below.</p>
1458
+ <form name="f" method="post" action="" id="mo2f_test_token_form">
1459
+ <input type="hidden" name="option" value="mo2f_validate_soft_token" />
1460
+
1461
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" type="text" name="otp_token" required placeholder="Enter OTP" style="width:95%;"/>
1462
+ <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#demo4">Click here to see How It Works ?</a><br><br>
1463
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
1464
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Validate OTP" />
1465
+
1466
+ </form>
1467
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1468
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1469
+ </form>
1470
+ <script>
1471
+ jQuery('#back_btn').click(function() {
1472
+ jQuery('#mo2f_cancel_form').submit();
1473
+ });
1474
+ </script>
1475
+ <?php }
1476
+
1477
+ function test_google_authenticator($method){
1478
+ if($method == 'GOOGLE AUTHENTICATOR'){ ?>
1479
+ <h3>Test Google Authenticator</h3><hr>
1480
+ <p><b>Enter verification code</b></p>
1481
+ <p>Get a verification code from "Google Authenticator" app</p>
1482
+ <?php }else{ ?>
1483
+ <h3>Test Authy 2-Factor Authentication</h3><hr>
1484
+ <p><b>Enter verification code</b></p>
1485
+ <p>Get a verification code from "Authy 2-Factor Authentication" app</p>
1486
+ <?php } ?>
1487
+ <form name="f" method="post" action="" >
1488
+ <input type="hidden" name="option" value="mo2f_validate_google_auth_test" />
1489
+
1490
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" type="text" name="otp_token" required placeholder="Enter OTP" style="width:95%;"/>
1491
+ <br><br>
1492
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
1493
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Validate OTP" />
1494
+
1495
+ </form>
1496
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1497
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1498
+ </form>
1499
+ <script>
1500
+ jQuery('#back_btn').click(function() {
1501
+ jQuery('#mo2f_cancel_form').submit();
1502
+ });
1503
+ </script>
1504
+
1505
+ <?php
1506
+ }
1507
+
1508
+ function test_otp_over_sms($current_user){
1509
+
1510
+ if (get_user_meta($current_user->ID, 'mo2f_selected_2factor_method',true) == 'SMS'){ ?>
1511
+ <h3>Test OTP Over SMS</h3><hr>
1512
+ <p>Enter the one time passcode sent to your registered mobile number.</p>
1513
+ <?php } else { ?>
1514
+ <h3>Test Phone Call Verification</h3><hr>
1515
+ <p>You will receive a phone call now. Enter the one time passcode here.</p>
1516
+ <?php } ?>
1517
+
1518
+ <form name="f" method="post" action="" id="mo2f_test_token_form">
1519
+ <input type="hidden" name="option" value="mo2f_validate_otp_over_sms" />
1520
+
1521
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" type="text" name="otp_token" required placeholder="Enter OTP" style="width:95%;"/>
1522
+ <?php if (get_user_meta($current_user->ID, 'mo2f_selected_2factor_method',true) == 'SMS'){ ?>
1523
+ <a href="#resendsmslink">Resend OTP ?</a>
1524
+ <?php } else {?>
1525
+ <a href="#resendsmslink">Call Again ?</a>
1526
+ <?php } ?>
1527
+ <br><br>
1528
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
1529
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Validate OTP" />
1530
+
1531
+ </form>
1532
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1533
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1534
+ </form>
1535
+ <form name="f" method="post" action="" id="mo2f_test_smsotp_form">
1536
+ <input type="hidden" name="option" value="mo_2factor_test_otp_over_sms" />
1537
+ <input type="hidden" name="mo2f_selected_2factor_method" value="<?php echo get_user_meta($current_user->ID, 'mo2f_selected_2factor_method',true); ?>"
1538
+ id="mo2f_test_2factor_method" />
1539
+ </form>
1540
+
1541
+ <script>
1542
+ jQuery('#back_btn').click(function() {
1543
+ jQuery('#mo2f_cancel_form').submit();
1544
+ });
1545
+ jQuery('a[href=\"#resendsmslink\"]').click(function(e) {
1546
+ jQuery('#mo2f_test_smsotp_form').submit();
1547
+ });
1548
+ </script>
1549
+
1550
+ <?php }
1551
+ function test_push_notification() {?>
1552
+
1553
+ <h3>Test Push Notification</h3><hr>
1554
+ <div >
1555
+ <br><br>
1556
+ <center>
1557
+ <h3>A Push Notification has been sent to your phone. <br>We are waiting for your approval...</h3>
1558
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" />
1559
+ </center>
1560
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" style="margin-top:100px;margin-left:10px;"/>
1561
+ <br><br>
1562
+ </div>
1563
+
1564
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1565
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1566
+ </form>
1567
+ <form name="f" method="post" id="mo2f_push_success_form" action="">
1568
+ <input type="hidden" name="option" value="mo2f_out_of_band_success" />
1569
+ </form>
1570
+ <form name="f" method="post" id="mo2f_push_error_form" action="">
1571
+ <input type="hidden" name="option" value="mo2f_out_of_band_error" />
1572
+ </form>
1573
+
1574
+ <script>
1575
+ jQuery('#back_btn').click(function() {
1576
+ jQuery('#mo2f_cancel_form').submit();
1577
+ });
1578
+
1579
+ var timeout;
1580
+ pollMobileValidation();
1581
+ function pollMobileValidation()
1582
+ {
1583
+ var transId = "<?php echo $_SESSION[ 'mo2f_transactionId' ]; ?>";
1584
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
1585
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
1586
+
1587
+ jQuery.ajax({
1588
+ url: postUrl,
1589
+ type : "POST",
1590
+ dataType : "json",
1591
+ data : jsonString,
1592
+ contentType : "application/json; charset=utf-8",
1593
+ success : function(result) {
1594
+ var status = JSON.parse(JSON.stringify(result)).status;
1595
+ if (status == 'SUCCESS') {
1596
+ jQuery('#mo2f_push_success_form').submit();
1597
+ } else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {
1598
+ jQuery('#mo2f_push_error_form').submit();
1599
+ } else {
1600
+ timeout = setTimeout(pollMobileValidation, 3000);
1601
+ }
1602
+ }
1603
+ });
1604
+ }
1605
+
1606
+ </script>
1607
+
1608
+ <?php } function test_out_of_band_email($current_user) {?>
1609
+
1610
+ <h3>Test Email Verification</h3><hr>
1611
+ <div>
1612
+ <br><br>
1613
+ <center>
1614
+ <h3>A verification email is sent to your registered email. <br>
1615
+ We are waiting for your approval...</h3>
1616
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" />
1617
+ </center>
1618
+
1619
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" style="margin-top:100px;margin-left:10px;"/>
1620
+ </div>
1621
+
1622
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1623
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1624
+ </form>
1625
+ <form name="f" method="post" id="mo2f_out_of_band_success_form" action="">
1626
+ <input type="hidden" name="option" value="mo2f_out_of_band_success" />
1627
+ </form>
1628
+ <form name="f" method="post" id="mo2f_out_of_band_error_form" action="">
1629
+ <input type="hidden" name="option" value="mo2f_out_of_band_error" />
1630
+ </form>
1631
+
1632
+ <script>
1633
+ jQuery('#back_btn').click(function() {
1634
+ jQuery('#mo2f_cancel_form').submit();
1635
+ });
1636
+
1637
+ var timeout;
1638
+ pollMobileValidation();
1639
+ function pollMobileValidation()
1640
+ {
1641
+ var transId = "<?php echo $_SESSION[ 'mo2f_transactionId' ]; ?>";
1642
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
1643
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
1644
+
1645
+ jQuery.ajax({
1646
+ url: postUrl,
1647
+ type : "POST",
1648
+ dataType : "json",
1649
+ data : jsonString,
1650
+ contentType : "application/json; charset=utf-8",
1651
+ success : function(result) {
1652
+ var status = JSON.parse(JSON.stringify(result)).status;
1653
+ if (status == 'SUCCESS') {
1654
+ jQuery('#mo2f_out_of_band_success_form').submit();
1655
+ } else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {
1656
+ jQuery('#mo2f_out_of_band_error_form').submit();
1657
+ } else {
1658
+ timeout = setTimeout(pollMobileValidation, 3000);
1659
+ }
1660
+ }
1661
+ });
1662
+ }
1663
+
1664
+ </script>
1665
+
1666
+ <?php }
1667
+
1668
+ function test_kba_authentication($current_user){ ?>
1669
+
1670
+ <h3>Test Security Questions( KBA )</h3><hr>
1671
+ <p>Please answer the following question.</p>
1672
+
1673
+ <form name="f" method="post" action="" id="mo2f_test_kba_form">
1674
+ <input type="hidden" name="option" value="mo2f_validate_kba_details" />
1675
+
1676
+ <div id="mo2f_kba_content">
1677
+ <?php if(isset($_SESSION['mo_2_factor_kba_questions'])){
1678
+ echo $_SESSION['mo_2_factor_kba_questions'][0];
1679
+ ?>
1680
+ <br />
1681
+ <input class="mo2f_table_textbox" style="width:227px;" type="text" name="mo2f_answer_1" id="mo2f_answer_1" required="true" autofocus="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." autocomplete="off" ><br /><br />
1682
+ <?php
1683
+ echo $_SESSION['mo_2_factor_kba_questions'][1];
1684
+ ?>
1685
+ <br />
1686
+ <input class="mo2f_table_textbox" style="width:227px;" type="text" name="mo2f_answer_2" id="mo2f_answer_2" required="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." autocomplete="off" ><br /><br />
1687
+ <?php
1688
+ }
1689
+ ?>
1690
+ </div>
1691
+ <input type="button" name="back" id="back_btn" class="button button-primary button-large" value="Back" />
1692
+ <input type="submit" name="validate" id="validate" class="button button-primary button-large" value="Validate Answers" />
1693
+
1694
+ </form>
1695
+ <form name="f" method="post" action="" id="mo2f_cancel_form">
1696
+ <input type="hidden" name="option" value="mo2f_cancel_configuration" />
1697
+ </form>
1698
+ <script>
1699
+ jQuery('#back_btn').click(function() {
1700
+ jQuery('#mo2f_cancel_form').submit();
1701
+ });
1702
+ </script>
1703
+ <?php
1704
+ }
1705
+
1706
+ function show_2_factor_pricing_page($current_user) { ?>
1707
+ <div class="mo2f_table_layout">
1708
+ <?php echo mo2f_check_if_registered_with_miniorange($current_user); ?>
1709
+ <table class="mo2f_pricing_table">
1710
+ <h2>Licensing Plans
1711
+ <span style="float:right"><input type="button" name="ok_btn" id="ok_btn" class="button button-primary button-large" value="OK, Got It" onclick="window.location.href='admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mobile_configure'" /></span>
1712
+ </h2><hr>
1713
+ <tr style="vertical-align:top;">
1714
+ <td><div class="mo2f_thumbnail mo2f_pricing_free_tab" >
1715
+ <h3 class="mo2f_pricing_header">Free</h3>
1716
+ <h4 class="mo2f_pricing_sub_header" style="padding-bottom:16px !important;">( You are automatically on this plan )</h4>
1717
+ <hr>
1718
+ <p class="mo2f_pricing_text">For 1 user - Forever</p><hr>
1719
+ <p class="mo2f_pricing_text" style="padding-bottom:8px;">$0 - Subscription Fees<br /><br /></p>
1720
+ <hr>
1721
+ <p class="mo2f_pricing_text">Features:</p>
1722
+ <p class="mo2f_pricing_text">Limited Authentication Methods<br />
1723
+ Remember Device<br>
1724
+ Two-Factor for Woocommerce Front End Login<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
1725
+ <hr>
1726
+ <p class="mo2f_pricing_text">Backup Method:<br />
1727
+ Security Questions (KBA)<br/><br />
1728
+ </p><hr>
1729
+ <p class="mo2f_pricing_text">Basic Support by Email</p>
1730
+ </div></td>
1731
+ <td><div class="mo2f_thumbnail mo2f_pricing_paid_tab">
1732
+ <h3 class="mo2f_pricing_header">Do it yourself</h3>
1733
+ <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
1734
+ onclick="mo2f_upgradeform('wp_2fa_basic_plan')" >Click here to upgrade</a>*</h4>
1735
+ <hr>
1736
+ <p class="mo2f_pricing_text">For 1+ user</p><hr>
1737
+ <p class="mo2f_pricing_text">Yearly Subscription Fees**
1738
+ <select class="form-control" style="border-radius:5px;width:250px;">
1739
+ <option > 5 users - $15 per year </option>
1740
+ <option > 10 users - $30 per year </option>
1741
+ <option > 20 users - $45 per year </option>
1742
+ <option > 30 users - $60 per year </option>
1743
+ <option > 40 users - $75 per year </option>
1744
+ <option > 50 users - $90 per year </option>
1745
+ <option > 60 users - $100 per year </option>
1746
+ <option > 70 users - $110 per year </option>
1747
+ <option > 80 users - $120 per year </option>
1748
+ <option > 90 users - $130 per year </option>
1749
+ <option > 100 users - $140 per year </option>
1750
+ <option > 150 users - $177.5 per year </option>
1751
+ <option > 200 users - $215 per year </option>
1752
+ <option > 250 users - $245 per year </option>
1753
+ <option > 300 users - $275 per year </option>
1754
+ <option > 350 users - $300 per year </option>
1755
+ <option > 400 users - $325 per year </option>
1756
+ <option > 450 users - $347.5 per year </option>
1757
+ <option > 500 users - $370 per year </option>
1758
+ <option > 600 users - $395 per year </option>
1759
+ <option > 700 users - $420 per year </option>
1760
+ <option > 800 users - $445 per year </option>
1761
+ <option > 900 users - $470 per year </option>
1762
+ <option > 1000 users - $495 per year </option>
1763
+ <option > 2000 users - $549 per year </option>
1764
+ <option > 3000 users - $599 per year </option>
1765
+ <option > 4000 users - $649 per year </option>
1766
+ <option > 5000 users - $699 per year </option>
1767
+ <option > 10000 users - $799 per year </option>
1768
+ <option > 20000 users - $999 per year </option>
1769
+ <option > Unlimited users - contact us </option>
1770
+ </select>
1771
+ </p>
1772
+ <hr>
1773
+ <p class="mo2f_pricing_text">Features:</p>
1774
+ <p class="mo2f_pricing_text">All Authentication Methods<br />
1775
+ Remember Device<br>
1776
+ Two-Factor for Woocommerce Front End Login<br>
1777
+ Enforce 2FA registration for users<br />
1778
+ Manage Registered Device Profiles<br />
1779
+ Multi-Site Support <br />
1780
+ Custom Redirection<br />
1781
+ Customize Email Templates<br />
1782
+ Customize SMS Templates<br/>
1783
+ Customize Powered By logo<br />
1784
+ Customize Security Questions (KBA)<br />
1785
+ Enable 2 Factor with various login forms***<br><br>
1786
+ </p><hr>
1787
+ <p class="mo2f_pricing_text">Backup Method:<br />
1788
+ Security Questions (KBA)<br />
1789
+ OTP over EMAIL</p>
1790
+ <hr>
1791
+ <p class="mo2f_pricing_text">Basic Support By Email</p>
1792
+ </div></td>
1793
+ </td>
1794
+ <td><div class="mo2f_thumbnail mo2f_pricing_free_tab">
1795
+ <h3 class="mo2f_pricing_header">Premium</h3>
1796
+ <h4 class="mo2f_pricing_sub_header" style="padding-bottom:8px !important;"><a class="button button-primary button-large"
1797
+ onclick="mo2f_upgradeform('wp_2fa_premium_plan')" >Click here to upgrade</a>*</h4>
1798
+ <hr>
1799
+ <p class="mo2f_pricing_text">For 1+ user, Setup and Custom Work</p><hr>
1800
+ <p class="mo2f_pricing_text">Yearly Subscription Fees**
1801
+ <select class="form-control" style="border-radius:5px;width:250px;">
1802
+ <option > 5 users - $15 per year </option>
1803
+ <option > 10 users - $30 per year </option>
1804
+ <option > 20 users - $45 per year </option>
1805
+ <option > 30 users - $60 per year </option>
1806
+ <option > 40 users - $75 per year </option>
1807
+ <option > 50 users - $90 per year </option>
1808
+ <option > 60 users - $100 per year </option>
1809
+ <option > 70 users - $110 per year </option>
1810
+ <option > 80 users - $120 per year </option>
1811
+ <option > 90 users - $130 per year </option>
1812
+ <option > 100 users - $140 per year </option>
1813
+ <option > 150 users - $177.5 per year </option>
1814
+ <option > 200 users - $215 per year </option>
1815
+ <option > 250 users - $245 per year </option>
1816
+ <option > 300 users - $275 per year </option>
1817
+ <option > 350 users - $300 per year </option>
1818
+ <option > 400 users - $325 per year </option>
1819
+ <option > 450 users - $347.5 per year </option>
1820
+ <option > 500 users - $370 per year </option>
1821
+ <option > 600 users - $395 per year </option>
1822
+ <option > 700 users - $420 per year </option>
1823
+ <option > 800 users - $445 per year </option>
1824
+ <option > 900 users - $470 per year </option>
1825
+ <option > 1000 users - $495 per year </option>
1826
+ <option > 2000 users - $549 per year </option>
1827
+ <option > 3000 users - $599 per year </option>
1828
+ <option > 4000 users - $649 per year </option>
1829
+ <option > 5000 users - $699 per year </option>
1830
+ <option > 10000 users - $799 per year </option>
1831
+ <option > 20000 users - $999 per year </option>
1832
+ <option > Unlimited users - contact us </option>
1833
+ </select></p>
1834
+ <hr>
1835
+ <p class="mo2f_pricing_text">Features:</p>
1836
+ <p class="mo2f_pricing_text">All Authentication Methods<br />
1837
+ Remember Device<br>
1838
+ Two-Factor for Woocommerce Front End Login<br>
1839
+ Enforce 2FA registration for users<br />
1840
+ Manage Registered Device Profiles<br />
1841
+ Multi-Site Support <br />
1842
+ Custom Redirection<br />
1843
+ Customize Email Templates<br />
1844
+ Customize SMS Templates<br/>
1845
+ Customize Powered By logo<br />
1846
+ Customize Security Questions (KBA)<br />
1847
+ Enable 2 Factor with various login forms***<br />
1848
+ End to End 2FA Integration****<br>
1849
+ </p><hr>
1850
+ <p class="mo2f_pricing_text">Backup Method:<br />
1851
+ Security Questions (KBA)<br />
1852
+ OTP over EMAIL</p>
1853
+ <hr>
1854
+ <p class="mo2f_pricing_text">Premium Support Plans Available</p>
1855
+ </div></td>
1856
+ </td>
1857
+ </tr>
1858
+
1859
+ </table>
1860
+ <br>
1861
+ <h3>* Steps to upgrade to premium plugin -</h3>
1862
+ <p>1. You will be redirected to miniOrange Login Console. Enter your password with which you created an account with us and verify your 2nd factor. After that you will be redirected to payment page.</p>
1863
+ <p>2. Enter you card details and complete the payment. On successful payment completion, you will see the link to download the premium plugin.</p>
1864
+ <p>3. Once you download the premium plugin, just unzip it and replace the folder with existing plugin. </p>
1865
+ <b>Note: Delete the Free plugin from the Wordpress Admin Panel and upload the plugin using zip.</b>
1866
+ <p>4. From this point on, do not update the plugin from the Wordpress store. </p>
1867
+
1868
+ <h3>** If you don't find the number of users in the dropdown then check the price for exact number of users by clicking on 'Click here to upgrade' button.</h3>
1869
+ <p>You can mail us at <a href="mailto:info@miniorange.com"><b>info@miniorange.com</b></a> or submit the support form under User Profile tab to contact us.</p>
1870
+ <p>*** 2 Factor will work with various login forms like Woocommerce, Theme My Login and many more. We are not claiming that 2 Factor will work with all the customized login forms. In such case, custom work is needed to integrate two factor with your customized login page.</p>
1871
+
1872
+ <h3>**** End to End 2FA Integration - We will setup a Conference Call / Gotomeeting and do end to end setup for you. We provide services to do the setup on your behalf.
1873
+ <h3>10 Days Return Policy -</h3>
1874
+
1875
+ <div>At miniOrange, we want to ensure you are 100% happy with your purchase. If the premium plugin you purchased is not working as advertised and you've attempted to resolve any issues with our support team, which couldn't get resolved then we will refund the whole amount within 10 days of the purchase. Please email us at <a href="mailto:info@miniorange.com"><i>info@miniorange.com</i></a> for any queries regarding the return policy.<br />
1876
+ If you have any doubts regarding the licensing plans, you can mail us at <a href="mailto:info@miniorange.com"><i>info@miniorange.com</i></a> or submit a query using the support form.</div><br /><br />
1877
+
1878
+
1879
+ </div>
1880
+ <form style="display:none;" id="mo2fa_loginform" action="<?php echo get_option( 'mo2f_host_name').'/moas/login'; ?>"
1881
+ target="_blank" method="post">
1882
+ <input type="email" name="username" value="<?php echo get_option('mo2f_email'); ?>" />
1883
+ <input type="text" name="redirectUrl" value="<?php echo get_option( 'mo2f_host_name').'/moas/initializepayment'; ?>" />
1884
+ <input type="text" name="requestOrigin" id="requestOrigin" />
1885
+ </form>
1886
+ <script>
1887
+ function mo2f_upgradeform(planType){
1888
+ jQuery('#requestOrigin').val(planType);
1889
+ jQuery('#mo2fa_loginform').submit();
1890
+ }
1891
+ </script>
1892
+
1893
+ <?php } ?>
miniorange_2_factor_settings.php ADDED
@@ -0,0 +1,1760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: miniOrange 2 Factor Authentication
4
+ * Plugin URI: http://miniorange.com
5
+ * Description: This plugin provides various two-factor authentication methods as an additional layer of security for wordpress login. We Support Phone Call, SMS, Email Verification, QR Code, Push, Soft Token, Google Authenticator, Authy, Security Questions(KBA), Woocommerce front-end login, Shortcodes for custom login pages.
6
+ * Version: 4.3.4
7
+ * Author: miniOrange
8
+ * Author URI: http://miniorange.com
9
+ * License: GPL2
10
+ */
11
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_configuration.php';
12
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_mobile_configuration.php';
13
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_troubleshooting.php';
14
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_frontend_shortcode.php';
15
+ include_once dirname( __FILE__ ) . '/class-rba-attributes.php';
16
+ include_once dirname( __FILE__ ) . '/class-two-factor-setup.php';
17
+ include_once dirname( __FILE__ ) . '/class-customer-setup.php';
18
+ require('class-utility.php');
19
+ require('class-miniorange-2-factor-login.php');
20
+ require('miniorange_2_factor_support.php');
21
+ require('class-miniorange-2-factor-user-registration.php');
22
+ require('class-miniorange-2-factor-pass2fa-login.php');
23
+ require('miniorange_2_factor_woocommerce_login.php');
24
+ define('MOAUTH_PATH', plugins_url(__FILE__));
25
+
26
+ class Miniorange_Authentication {
27
+
28
+ private $defaultCustomerKey = "16555";
29
+ private $defaultApiKey = "fFd2XcvTGDemZvbw1bcUesNJWEqKbbUq";
30
+
31
+ function __construct() {
32
+
33
+ $mo2f_auth_types = array('OUT OF BAND EMAIL','SMS','PHONE VERIFICATION','SOFT TOKEN','MOBILE AUTHENTICATION','PUSH NOTIFICATIONS','GOOGLE AUTHENTICATOR','AUTHY 2-FACTOR AUTHENTICATION','KBA');
34
+ add_option( 'mo2f_auth_methods_for_users' ,$mo2f_auth_types);
35
+ add_option( 'mo2f_inline_registration',0);
36
+ add_option( 'mo2f_enable_mobile_support', 1);
37
+ add_option( 'mo2f_activate_plugin', 1 );
38
+ add_option( 'mo2f_login_policy', 1 );
39
+ add_option( 'mo2f_msg_counter', 1 );
40
+ add_option( 'mo2f_enable_forgotphone', 1);
41
+ add_option( 'mo2f_enable_xmlrpc', 0);
42
+ add_option( 'mo2f_disable_poweredby',0);
43
+ add_option( 'mo2f_custom_plugin_name', 'miniOrange 2-Factor');
44
+ add_action( 'admin_menu', array( $this, 'miniorange_auth_menu' ) );
45
+ add_action( 'admin_init', array( $this, 'miniorange_auth_save_settings' ) );
46
+ register_deactivation_hook(__FILE__, array( $this, 'mo_auth_deactivate'));
47
+ add_action( 'admin_enqueue_scripts', array( $this, 'plugin_settings_style' ) );
48
+ add_action( 'admin_enqueue_scripts', array( $this, 'plugin_settings_script' ) );
49
+ remove_action( 'admin_notices', array( $this, 'mo_auth_success_message') );
50
+ remove_action( 'admin_notices', array( $this, 'mo_auth_error_message') );
51
+ add_action('wp_logout', array( $this, 'mo_2_factor_endsession'));
52
+
53
+ global $wp_roles;
54
+ if (!isset($wp_roles))
55
+ $wp_roles = new WP_Roles();
56
+ if(get_option('mo2f_admin_disabled_status') == 1 || get_option('mo2f_admin_disabled_status') == 0){
57
+ if(get_option('mo2f_admin_disabled_status') == 1){
58
+ add_option('mo2fa_administrator',1);
59
+ }else{
60
+ foreach($wp_roles->role_names as $id => $name) {
61
+ add_option('mo2fa_'.$id, 1);
62
+ }
63
+ }
64
+ delete_option('mo2f_admin_disabled_status');
65
+ }else{
66
+ foreach($wp_roles->role_names as $id => $name) {
67
+ add_option('mo2fa_'.$id, 1);
68
+ }
69
+ }
70
+
71
+ if( get_option('mo2f_activate_plugin') == 1){
72
+ if(get_option('mo2f_login_policy')){ //password + 2nd factor enabled
73
+ if(get_option( 'mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' ){
74
+
75
+ $pass2fa_login = new Miniorange_Password_2Factor_Login();
76
+ remove_filter('authenticate', 'wp_authenticate_username_password',20);
77
+ add_filter('authenticate', array($pass2fa_login, 'mo2f_check_username_password'),99999,3);
78
+ add_action( 'init', array( $pass2fa_login, 'miniorange_pass2login_redirect'));
79
+ add_action( 'login_form', array( $pass2fa_login, 'miniorange_pass2login_form_fields' ),10 );
80
+ add_action( 'login_footer', array( $pass2fa_login, 'miniorange_pass2login_footer_form' ));
81
+ add_action( 'login_enqueue_scripts', array( $pass2fa_login,'mo_2_factor_enable_jquery_default_login') );
82
+
83
+ //add shortcode
84
+
85
+ add_shortcode( 'MO_2FA_FORM', array($this, 'mo_get_2fa_shorcode') );
86
+ add_shortcode( 'MO_2FA_LOGIN_FORM', array($this, 'mo_get_login_form_shortcode') );
87
+
88
+
89
+ if(get_option('mo2f_enable_2fa_for_woocommerce') == 1){
90
+ add_action( 'woocommerce_before_customer_login_form', array( $pass2fa_login, 'miniorange_pass2login_form_fields_frontend' ),10 );
91
+ add_action( 'woocommerce_before_customer_login_form', array( $pass2fa_login, 'miniorange_pass2login_footer_form' ) );
92
+ add_action( 'woocommerce_login_form_end', array( $pass2fa_login, 'mo_2_factor_pass2login_show_wp_login_form' ) );
93
+ add_action( 'wp_enqueue_scripts', array( $this, 'mo_2_factor_enable_frontend_style' ) );
94
+ add_action( 'wp_enqueue_scripts', array( $pass2fa_login,'mo_2_factor_enable_jquery'),5 );
95
+
96
+ }
97
+ }
98
+ }else{ //login with phone enabled
99
+ if(get_option( 'mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS'){
100
+
101
+ $mobile_login = new Miniorange_Mobile_Login();
102
+ add_action( 'login_form', array( $mobile_login, 'miniorange_login_form_fields' ),10 );
103
+ add_action( 'login_footer', array( $mobile_login, 'miniorange_login_footer_form' ));
104
+ add_action( 'init', array( $mobile_login, 'my_login_redirect') );
105
+ remove_action('login_enqueue_scripts', array( $mobile_login, 'mo_2_factor_hide_login'));
106
+ add_action( 'login_enqueue_scripts', array( $mobile_login,'mo_2_factor_hide_login') );
107
+ add_action( 'login_enqueue_scripts', array( $mobile_login,'custom_login_enqueue_scripts') );
108
+ remove_filter('authenticate', 'wp_authenticate_username_password',20);
109
+ add_filter('authenticate', array($mobile_login, 'mo2fa_default_login'),20,3);
110
+ }
111
+ }
112
+ }
113
+ }
114
+
115
+ function mo_2_factor_endsession() {
116
+ update_option('mo2f-login-message','You are now logged out');
117
+ session_start();
118
+ $_SESSION = array();
119
+ session_destroy();
120
+ }
121
+
122
+ public function mo_auth_deactivate() {
123
+ delete_option('mo2f_email');
124
+ delete_option('mo2f_host_name');
125
+ delete_option('mo2f_phone');
126
+ delete_option('mo2f_customerKey');
127
+ delete_option('mo2f_api_key');
128
+ delete_option('mo2f_customer_token');
129
+ delete_option('mo_2factor_admin_registration_status');
130
+ delete_option('mo2f_miniorange_admin');
131
+ global $current_user;
132
+
133
+ delete_user_meta($current_user->ID,'mo_2factor_user_registration_status');
134
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
135
+ delete_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange');
136
+ delete_user_meta($current_user->ID,'mo_2factor_map_id_with_email');
137
+ delete_user_meta($current_user->ID,'mo2f_user_phone');
138
+ delete_user_meta($current_user->ID,'mo2f_mobile_registration_status');
139
+ delete_user_meta($current_user->ID,'mo2f_otp_registration_status');
140
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
141
+ delete_user_meta($current_user->ID,'mo2f_selected_2factor_method');
142
+ delete_user_meta($current_user->ID,'mo2f_google_authentication_status');
143
+ delete_user_meta($current_user->ID,'mo2f_kba_registration_status');
144
+ delete_user_meta($current_user->ID,'mo2f_email_verification_status');
145
+ delete_user_meta($current_user->ID,'mo2f_authy_authentication_status');
146
+ }
147
+
148
+
149
+ function mo_auth_success_message() {
150
+ $message = get_option('mo2f_message'); ?>
151
+ <script>
152
+
153
+ jQuery(document).ready(function() {
154
+ var message = "<?php echo $message; ?>";
155
+ jQuery('#messages').append("<div class='error notice is-dismissible mo2f_error_container'> <p class='mo2f_msgs'>" + message + "</p></div>");
156
+ });
157
+ </script>
158
+ <?php
159
+ }
160
+
161
+ function mo_auth_error_message() {
162
+ $message = get_option('mo2f_message'); ?>
163
+ <script>
164
+ jQuery(document).ready(function() {
165
+ var message = "<?php echo $message; ?>";
166
+ jQuery('#messages').append("<div class='updated notice is-dismissible mo2f_success_container'> <p class='mo2f_msgs'>" + message + "</p></div>");
167
+
168
+ jQuery('a[href=\"#test\"]').click(function() {
169
+ var currentMethod = jQuery(this).data("method");
170
+
171
+ if(currentMethod == 'MOBILE AUTHENTICATION'){
172
+ jQuery('#mo2f_2factor_test_mobile_form').submit();
173
+ }else if(currentMethod == 'PUSH NOTIFICATIONS'){
174
+ jQuery('#mo2f_2factor_test_push_form').submit();
175
+ }else if(currentMethod == 'SOFT TOKEN'){
176
+ jQuery('#mo2f_2factor_test_softtoken_form').submit();
177
+ }else if(currentMethod == 'SMS' || currentMethod == 'PHONE VERIFICATION'){
178
+ jQuery('#mo2f_test_2factor_method').val(currentMethod);
179
+ jQuery('#mo2f_2factor_test_smsotp_form').submit();
180
+ }else if(currentMethod == 'OUT OF BAND EMAIL'){
181
+ jQuery('#mo2f_2factor_test_out_of_band_email_form').submit();
182
+ }else if(currentMethod == 'GOOGLE AUTHENTICATOR'){
183
+ jQuery('#mo2f_2factor_test_google_auth_form').submit();
184
+ }else if(currentMethod == 'AUTHY 2-FACTOR AUTHENTICATION'){
185
+ jQuery('#mo2f_2factor_test_authy_app_form').submit();
186
+ }else if(currentMethod == 'KBA'){
187
+ jQuery('#mo2f_2factor_test_kba_form').submit();
188
+ }
189
+
190
+
191
+ });
192
+
193
+ });
194
+ </script>
195
+ <?php
196
+ }
197
+
198
+ function miniorange_auth_menu() {
199
+ global $wpdb;
200
+ global $current_user;
201
+ $current_user = wp_get_current_user();
202
+ if(get_option('mo2f_enable_custom_icon')!=1)
203
+ $iconurl = plugin_dir_url(__FILE__) . 'includes/images/miniorange_icon.png';
204
+ else
205
+ $iconurl = site_url(). '/wp-content/uploads/plugin_icon.png';
206
+
207
+ $roles = $current_user->roles;
208
+ $miniorange_role = array_shift($roles);
209
+
210
+ if( !current_user_can( 'manage_options' ) && get_option('mo2fa_'.$miniorange_role) && get_option( 'mo_2factor_admin_registration_status') == 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' && get_option( 'mo2f_miniorange_admin') != $current_user->ID && get_option('mo2f_activate_plugin') == 1){
211
+ $user_register = new Miniorange_User_Register();
212
+ $mo2fa_hook_page = add_menu_page ('miniOrange 2 Factor Auth', get_option('mo2f_custom_plugin_name') , 'read', 'miniOrange_2_factor_settings', array( $user_register, 'mo2f_register_user'), $iconurl);
213
+ }else if(current_user_can( 'manage_options' )){
214
+ $mo2fa_hook_page = add_menu_page ('miniOrange 2 Factor Auth', get_option('mo2f_custom_plugin_name'), 'manage_options', 'miniOrange_2_factor_settings', array( $this, 'mo_auth_login_options' ),$iconurl);
215
+ }
216
+ }
217
+
218
+ function mo_auth_login_options () {
219
+ global $wpdb;
220
+ global $current_user;
221
+ $current_user = wp_get_current_user();
222
+ update_option('mo2f_host_name', 'https://auth.miniorange.com');
223
+ mo_2_factor_register($current_user);
224
+ }
225
+
226
+ function mo_2_factor_enable_frontend_style() {
227
+ wp_enqueue_style( 'mo2f_frontend_login_style', plugins_url('includes/css/front_end_login.css?version=4.1.3', __FILE__));
228
+ wp_enqueue_style( 'bootstrap_style', plugins_url('includes/css/bootstrap.min.css?version=4.1.3', __FILE__));
229
+ wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url('includes/css/phone.css', __FILE__));
230
+ }
231
+
232
+ function plugin_settings_style() {
233
+ wp_enqueue_style( 'mo_2_factor_admin_settings_style', plugins_url('includes/css/style_settings.css?version=4.1.3', __FILE__));
234
+ wp_enqueue_style( 'mo_2_factor_admin_settings_phone_style', plugins_url('includes/css/phone.css', __FILE__));
235
+ wp_enqueue_style( 'bootstrap_style', plugins_url('includes/css/bootstrap.min.css?version=4.1.3', __FILE__));
236
+ }
237
+
238
+ function plugin_settings_script($mo2fa_hook_page) {
239
+ if ( 'toplevel_page_miniOrange_2_factor_settings' != $mo2fa_hook_page ) {
240
+ return;
241
+ }
242
+ wp_enqueue_script('jquery');
243
+ wp_enqueue_script( 'mo_2_factor_admin_settings_phone_script', plugins_url('includes/js/phone.js', __FILE__ ));
244
+ wp_enqueue_script( 'bootstrap_script', plugins_url('includes/js/bootstrap.min.js', __FILE__ ));
245
+ }
246
+
247
+ private function mo_auth_show_success_message() {
248
+ remove_action( 'admin_notices', array( $this, 'mo_auth_success_message') );
249
+ add_action( 'admin_notices', array( $this, 'mo_auth_error_message') );
250
+ }
251
+
252
+ private function mo_auth_show_error_message() {
253
+ remove_action( 'admin_notices', array( $this, 'mo_auth_error_message') );
254
+ add_action( 'admin_notices', array( $this, 'mo_auth_success_message') );
255
+ }
256
+
257
+ function miniorange_auth_save_settings(){
258
+ if( ! session_id() || session_id() == '' || !isset($_SESSION) ) {
259
+ session_start();
260
+ }
261
+ global $current_user;
262
+ $current_user = wp_get_current_user();
263
+ if(current_user_can( 'manage_options' )){
264
+ if(isset($_POST['option']) and $_POST['option'] == "mo_auth_register_customer"){ //register the admin to miniOrange
265
+ //validate and sanitize
266
+ $email = '';
267
+ $phone = '';
268
+ $password = '';
269
+ $confirmPassword = '';
270
+ $company = '';
271
+ $firstName = '';
272
+ $lastName = '';
273
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['email'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['password'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['confirmPassword'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['company'] ) ) {
274
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
275
+ $this->mo_auth_show_error_message();
276
+ return;
277
+ }else if( strlen( $_POST['password'] ) < 6 || strlen( $_POST['confirmPassword'] ) < 6){
278
+ update_option( 'mo2f_message', 'Choose a password with minimum length 8.');
279
+ $this->mo_auth_show_error_message();
280
+ return;
281
+ } else{
282
+ $email = sanitize_email( $_POST['email'] );
283
+ $phone = sanitize_text_field( $_POST['phone'] );
284
+ $password = sanitize_text_field( $_POST['password'] );
285
+ $confirmPassword = sanitize_text_field( $_POST['confirmPassword'] );
286
+ $company = sanitize_text_field( $_POST['company'] );
287
+ $firstName = sanitize_text_field( $_POST['first_name'] );
288
+ $lastName = sanitize_text_field( $_POST['last_name'] );
289
+ }
290
+ $email = strtolower($email);
291
+ update_option( 'mo2f_email', $email );
292
+ update_user_meta( $current_user->ID,'mo2f_user_phone', $phone );
293
+ update_option('mo2f_admin_company', $company);
294
+ update_option('mo2f_admin_first_name', $firstName);
295
+ update_option('mo2_admin_last_name', $lastName);
296
+
297
+ if(strcmp($password, $confirmPassword) == 0) {
298
+ update_option( 'mo2f_password', $password );
299
+ $customer = new Customer_Setup();
300
+ $customerKey = json_decode($customer->check_customer(), true);
301
+ if($customerKey['status'] == 'ERROR'){
302
+ update_option( 'mo2f_message', $customerKey['message']);
303
+ $this->mo_auth_show_error_message();
304
+ }else{
305
+ if( strcasecmp( $customerKey['status'], 'CUSTOMER_NOT_FOUND') == 0 ){ //customer not found then send OTP to verify email
306
+ $content = json_decode($customer->send_otp_token(get_option('mo2f_email'),'EMAIL',$this->defaultCustomerKey,$this->defaultApiKey), true);
307
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
308
+
309
+ update_option( 'mo2f_message', 'An OTP has been sent to <b>' . ( get_option('mo2f_email') ) . '</b>. Please enter the OTP below to verify your email. ');
310
+ update_user_meta($current_user->ID,'mo2f_email_otp_count',1);
311
+ update_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',$content['txId']);
312
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
313
+ $this->mo_auth_show_success_message();
314
+ }else{
315
+ update_option('mo2f_message','There was an error in sending OTP over email. Please click on Resend OTP to try again.');
316
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
317
+ $this->mo_auth_show_error_message();
318
+ }
319
+ }else{ //customer already exists,retrieve its keys
320
+
321
+ $content = $customer->get_customer_key();
322
+ $customerKey = json_decode($content, true);
323
+ if(json_last_error() == JSON_ERROR_NONE) { /*Admin enter right credentials,if already exist */
324
+
325
+
326
+ if(array_key_exists("status", $customerKey) && $customerKey['status'] == 'ERROR'){
327
+ update_option('mo2f_message',$customerKey['message']);
328
+ $this->mo_auth_show_error_message();
329
+ }else{
330
+
331
+ if(isset($customerKey['id']) && !empty($customerKey['id'])){
332
+ update_option( 'mo2f_customerKey', $customerKey['id']);
333
+ update_option( 'mo2f_api_key', $customerKey['apiKey']);
334
+ update_option( 'mo2f_customer_token', $customerKey['token']);
335
+ update_option( 'mo2f_app_secret', $customerKey['appSecret'] );
336
+ update_option( 'mo2f_miniorange_admin',$current_user->ID);
337
+ update_option( 'mo2f_new_customer',true);
338
+ delete_option('mo2f_password');
339
+ update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
340
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
341
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option('mo2f_email'));
342
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
343
+
344
+ $enduser = new Two_Factor_Setup();
345
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
346
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
347
+ update_option( 'mo2f_message', 'Your account has been retrieved successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.');
348
+ $this->mo_auth_show_success_message();
349
+ }else{
350
+ delete_option( 'mo2f_email');
351
+ delete_option( 'mo2f_customerKey');
352
+ update_option( 'mo2f_message', 'An error occured while creating your account. Please try again or contact us by sending a query from support.');
353
+ $this->mo_auth_show_error_message();
354
+ }
355
+
356
+ }
357
+ } else { /*Admin account exist but enter wrong credentials*/
358
+ update_option( 'mo2f_message', 'You already have an account with miniOrange. Please enter a valid password.');
359
+ update_user_meta( $current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_VERIFY_CUSTOMER');
360
+ $this->mo_auth_show_success_message();
361
+ }
362
+ }
363
+ }
364
+ } else {
365
+ update_option( 'mo2f_message', 'Password and Confirm password do not match.');
366
+ $this->mo_auth_show_error_message();
367
+ }
368
+ }
369
+
370
+ if(isset($_POST['option']) and $_POST['option'] == "mo2f_goto_verifycustomer"){
371
+ update_option( 'mo2f_message', 'Please enter your registered email and password.');
372
+ update_user_meta( $current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_VERIFY_CUSTOMER');
373
+ $this->mo_auth_show_success_message();
374
+ }
375
+
376
+ if(isset($_POST['option']) and $_POST['option'] == "mo_auth_verify_customer"){ //register the admin to miniOrange if already exist
377
+
378
+ //validation and sanitization
379
+ $email = '';
380
+ $password = '';
381
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['email'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['password'] ) ) {
382
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
383
+ $this->mo_auth_show_error_message();
384
+ return;
385
+ }else{
386
+ $email = sanitize_email( $_POST['email'] );
387
+ $password = sanitize_text_field( $_POST['password'] );
388
+ }
389
+
390
+ update_option( 'mo2f_email', $email );
391
+ update_option( 'mo2f_password', $password );
392
+ $customer = new Customer_Setup();
393
+ $content = $customer->get_customer_key();
394
+ $customerKey = json_decode($content, true);
395
+ if(json_last_error() == JSON_ERROR_NONE) {
396
+ if(array_key_exists("status", $customerKey) && $customerKey['status'] == 'ERROR'){
397
+ update_option('mo2f_message',$customerKey['message']);
398
+ $this->mo_auth_show_error_message();
399
+ }else{
400
+ if(isset($customerKey['id']) && !empty($customerKey['id'])){
401
+ update_option( 'mo2f_customerKey', $customerKey['id']);
402
+ update_option( 'mo2f_api_key', $customerKey['apiKey']);
403
+ update_option( 'mo2f_customer_token', $customerKey['token']);
404
+ update_option( 'mo2f_app_secret', $customerKey['appSecret'] );
405
+ update_user_meta($current_user->ID,'mo2f_phone', $customerKey['phone']);
406
+ update_option( 'mo2f_miniorange_admin',$current_user->ID);
407
+ update_option( 'mo2f_new_customer',true);
408
+ delete_option('mo2f_password');
409
+ update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
410
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
411
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option('mo2f_email'));
412
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
413
+
414
+ $enduser = new Two_Factor_Setup();
415
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
416
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
417
+ update_option( 'mo2f_message', 'Your account has been retrieved successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.');
418
+ $this->mo_auth_show_success_message();
419
+ }else{
420
+ update_option( 'mo2f_message', 'Invalid email or password. Please try again.');
421
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_VERIFY_CUSTOMER');
422
+ $this->mo_auth_show_error_message();
423
+ }
424
+
425
+ }
426
+ } else {
427
+ update_option( 'mo2f_message', 'Invalid email or password. Please try again.');
428
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_VERIFY_CUSTOMER');
429
+ $this->mo_auth_show_error_message();
430
+ }
431
+ delete_option('mo2f_password');
432
+ }
433
+ if(isset($_POST['option']) and $_POST['option'] == 'mo_2factor_phone_verification'){ //at registration time
434
+ $phone = sanitize_text_field($_POST['phone_number']);
435
+
436
+ $phone = str_replace(' ', '', $phone);
437
+ $auth_type = 'OTP_OVER_SMS';
438
+ $customer = new Customer_Setup();
439
+ $send_otp_response = json_decode($customer->send_otp_token($phone,$auth_type, $this->defaultCustomerKey,$this->defaultApiKey),true);
440
+ if(strcasecmp($send_otp_response['status'], 'SUCCESS') == 0){
441
+ //Save txId
442
+
443
+ update_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',$send_otp_response['txId']);
444
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
445
+ if(get_user_meta($current_user->ID,'mo2f_sms_otp_count',true)){
446
+ update_user_meta($current_user->ID,'mo2f_sms_otp_count',get_user_meta($current_user->ID,'mo2f_sms_otp_count',true) + 1);
447
+ update_option('mo2f_message', 'Another One Time Passcode has been sent <b>( ' . get_user_meta($current_user->ID,'mo2f_sms_otp_count',true) . ' )</b> for verification to ' . $phone);
448
+ }else{
449
+ update_option('mo2f_message', 'One Time Passcode has been sent for verification to ' . $phone);
450
+ update_user_meta($current_user->ID,'mo2f_sms_otp_count',1);
451
+ }
452
+
453
+ $this->mo_auth_show_success_message();
454
+ }else{
455
+ update_option('mo2f_message','There was an error in sending sms. Please click on Resend OTP to try again.');
456
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
457
+ $this->mo_auth_show_error_message();
458
+ }
459
+ }
460
+
461
+ if(isset($_POST['option']) and trim($_POST['option']) == "mo_2factor_resend_otp"){ //resend OTP over email for admin
462
+ $customer = new Customer_Setup();
463
+ $content = json_decode($customer->send_otp_token(get_option('mo2f_email'),'EMAIL',$this->defaultCustomerKey,$this->defaultApiKey), true);
464
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
465
+ if(get_user_meta($current_user->ID,'mo2f_email_otp_count',true)){
466
+ update_user_meta($current_user->ID,'mo2f_email_otp_count',get_user_meta($current_user->ID,'mo2f_email_otp_count',true) + 1);
467
+ update_option( 'mo2f_message', 'Another OTP has been sent <b>( ' . get_user_meta($current_user->ID,'mo2f_email_otp_count',true) .' )</b> to <b>' . ( get_option('mo2f_email') ) . '</b>. Please enter the OTP below to verify your email. ');
468
+ }else{
469
+ update_option( 'mo2f_message', 'An OTP has been sent to <b>' . ( get_option('mo2f_email') ) . '</b>. Please enter the OTP below to verify your email. ');
470
+ update_user_meta($current_user->ID,'mo2f_email_otp_count',1);
471
+ }
472
+ update_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',$content['txId']);
473
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
474
+ $this->mo_auth_show_success_message();
475
+ }else{
476
+ update_option('mo2f_message','There was an error in sending email. Please click on Resend OTP to try again.');
477
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
478
+ $this->mo_auth_show_error_message();
479
+ }
480
+ }
481
+
482
+ if(isset($_POST['option']) and $_POST['option'] == "mo_2factor_validate_otp"){ //validate OTP over email for admin
483
+
484
+ //validation and sanitization
485
+ $otp_token = '';
486
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
487
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
488
+ $this->mo_auth_show_error_message();
489
+ return;
490
+ } else{
491
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
492
+ }
493
+
494
+ $customer = new Customer_Setup();
495
+ $transactionId = get_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',true);
496
+
497
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null,$transactionId, $otp_token, $this->defaultCustomerKey, $this->defaultApiKey ),true);
498
+ if($content['status'] == 'ERROR'){
499
+ update_option( 'mo2f_message', $content['message']);
500
+ $this->mo_auth_show_error_message();
501
+ }else{
502
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated and generate QRCode
503
+ $this->mo2f_create_customer($current_user);
504
+ delete_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account');
505
+ }else{ // OTP Validation failed.
506
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
507
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
508
+ $this->mo_auth_show_error_message();
509
+ }
510
+ }
511
+ }
512
+
513
+ if(isset($_POST['option']) and $_POST['option'] == "mo_2factor_validate_user_otp"){ //validate OTP over email for additional admin
514
+
515
+ //validation and sanitization
516
+ $otp_token = '';
517
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
518
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
519
+ $this->mo_auth_show_error_message();
520
+ return;
521
+ } else{
522
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
523
+ }
524
+
525
+ if(!MO2f_Utility::check_if_email_is_already_registered(get_user_meta($current_user->ID,'mo_2factor_user_email',true))){
526
+ $customer = new Customer_Setup();
527
+ $content = json_decode($customer->validate_otp_token( 'EMAIL', null, $_SESSION[ 'mo2f_transactionId' ], $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
528
+ if($content['status'] == 'ERROR'){
529
+ update_option( 'mo2f_message', $content['message']);
530
+ $this->mo_auth_show_error_message();
531
+ }else{
532
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated and generate QRCode
533
+ $this->mo2f_create_user($current_user,get_user_meta($current_user->ID,'mo_2factor_user_email',true));
534
+ delete_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account');
535
+ }else{ // OTP Validation failed.
536
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
537
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
538
+ $this->mo_auth_show_error_message();
539
+ }
540
+ }
541
+ }else{
542
+ update_option('mo2f_message','The email is already used by other user. Please register with other email by clicking on Back button.');
543
+ $this->mo_auth_show_error_message();
544
+ }
545
+ }
546
+
547
+ if(isset($_POST['option']) and $_POST['option'] == "mo_2factor_send_query"){ //Help me or support
548
+ $query = '';
549
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['query_email'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['query'] ) ) {
550
+ update_option( 'mo2f_message', 'Please submit your query with email.');
551
+ $this->mo_auth_show_error_message();
552
+ return;
553
+ } else{
554
+ $query = sanitize_text_field( $_POST['query'] );
555
+ $email = sanitize_text_field( $_POST['query_email'] );
556
+ $phone = sanitize_text_field( $_POST['query_phone'] );
557
+ $contact_us = new Customer_Setup();
558
+ $submited = json_decode($contact_us->submit_contact_us($email, $phone, $query),true);
559
+ if(json_last_error() == JSON_ERROR_NONE) {
560
+ if(is_array($submited) && array_key_exists('status', $submited) && $submited['status'] == 'ERROR'){
561
+ update_option( 'mo2f_message', $submited['message']);
562
+ $this->mo_auth_show_error_message();
563
+ }else{
564
+ if ( $submited == false ) {
565
+ update_option('mo2f_message', 'Your query could not be submitted. Please try again.');
566
+ $this->mo_auth_show_error_message();
567
+ } else {
568
+ update_option('mo2f_message', 'Thanks for getting in touch! We shall get back to you shortly.');
569
+ $this->mo_auth_show_success_message();
570
+ }
571
+ }
572
+ }
573
+
574
+ }
575
+ }
576
+
577
+ if(isset($_POST['option']) and $_POST['option'] == 'mo_auth_advanced_options_save'){
578
+ update_option( 'mo2f_enable_2fa_for_woocommerce', isset( $_POST['mo2f_enable_2fa_for_woocommerce']) ? $_POST['mo2f_enable_2fa_for_woocommerce'] : 0);
579
+ if(!get_option('mo2f_new_customer')){
580
+ //plugin customization
581
+ update_option( 'mo2f_disable_poweredby', isset( $_POST['mo2f_disable_poweredby']) ? $_POST['mo2f_disable_poweredby'] : 0);
582
+ update_option( 'mo2f_enable_custom_poweredby', isset( $_POST['mo2f_enable_custom_poweredby']) ? $_POST['mo2f_enable_custom_poweredby'] : 0);
583
+ if (get_option('mo2f_disable_poweredby') == 1){
584
+ update_option( 'mo2f_enable_custom_poweredby',0);
585
+ }
586
+ update_option( 'mo2f_enable_custom_icon', isset( $_POST['mo2f_enable_custom_icon']) ? $_POST['mo2f_enable_custom_icon'] : 0);
587
+ update_option( 'mo2f_custom_plugin_name', isset($_POST['mo2f_custom_plugin_name']) ? $_POST['mo2f_custom_plugin_name'] : 'miniOrange 2-Factor');
588
+ }
589
+ update_option( 'mo2f_message', 'Your settings are saved successfully.');
590
+ $this->mo_auth_show_success_message();
591
+ }
592
+
593
+ if(isset($_POST['option']) and $_POST['option'] == 'mo_auth_login_settings_save'){
594
+ $random_mo_key = get_option('mo2f_new_customer');
595
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS' ) {
596
+
597
+ if(!$random_mo_key){
598
+ update_option( 'mo2f_inline_registration', isset( $_POST['mo2f_inline_registration']) ? $_POST['mo2f_inline_registration'] : 0);
599
+ $authMethods = array();
600
+ $authMethod = isset($_POST['mo2f_authmethods']) ? $_POST['mo2f_authmethods'] : array();
601
+ foreach ($authMethod as $arrayvalue){
602
+ $authMethods[$arrayvalue] = $arrayvalue;
603
+ }
604
+ update_option( 'mo2f_auth_methods_for_users', $authMethods);
605
+
606
+ }
607
+ update_option( 'mo2f_deviceid_enabled', isset( $_POST['mo2f_deviceid_enabled'] ) ? $_POST['mo2f_deviceid_enabled'] : 0);
608
+ update_option( 'mo2f_login_policy', isset( $_POST['mo2f_login_policy']) ? $_POST['mo2f_login_policy'] : 0);
609
+ update_option( 'mo2f_enable_forgotphone', isset( $_POST['mo2f_forgotphone']) ? $_POST['mo2f_forgotphone'] : 0);
610
+ update_option( 'mo2f_show_loginwith_phone', isset( $_POST['mo2f_loginwith_phone']) ? $_POST['mo2f_loginwith_phone'] : 0);
611
+ update_option( 'mo2f_activate_plugin', isset( $_POST['mo2f_activate_plugin']) ? $_POST['mo2f_activate_plugin'] : 0);
612
+ update_option( 'mo2f_enable_mobile_support', isset( $_POST['mo2f_enable_mobile_support']) ? $_POST['mo2f_enable_mobile_support'] : 0);
613
+ update_option( 'mo2f_enable_xmlrpc', isset( $_POST['mo2f_enable_xmlrpc']) ? $_POST['mo2f_enable_xmlrpc'] : 0);
614
+
615
+ global $wp_roles;
616
+ if (!isset($wp_roles))
617
+ $wp_roles = new WP_Roles();
618
+ foreach($wp_roles->role_names as $id => $name) {
619
+ update_option('mo2fa_'.$id, isset( $_POST['mo2fa_'.$id] ) ? $_POST['mo2fa_'.$id] : 0);
620
+ }
621
+
622
+
623
+
624
+
625
+ if(get_option('mo2f_activate_plugin')){
626
+ $logouturl = wp_login_url() . '?action=logout';
627
+ update_option( 'mo2f_message', 'Your login settings are saved successfully. Now <a href=\"'.$logouturl.'\"><b>Click Here</b></a> to logout and try login with 2-Factor.');
628
+ update_option( 'mo2f_msg_counter',2);
629
+ $this->mo_auth_show_success_message();
630
+ }else{
631
+ update_option( 'mo2f_message', 'Two-Factor plugin has been disabled.');
632
+ update_option( 'mo2f_msg_counter',2);
633
+ $this->mo_auth_show_error_message();
634
+ }
635
+
636
+ if(get_option( 'mo2f_deviceid_enabled' ) && !get_option( 'mo2f_app_secret' )){
637
+ $get_app_secret = new Miniorange_Rba_Attributes();
638
+ $rba_response = json_decode($get_app_secret->mo2f_get_app_secret(),true); //fetch app secret
639
+ if(json_last_error() == JSON_ERROR_NONE){
640
+ if($rba_response['status'] == 'SUCCESS'){
641
+ update_option( 'mo2f_app_secret',$rba_response['appSecret'] );
642
+ }else{
643
+ update_option( 'mo2f_deviceid_enabled',0 );
644
+ update_option( 'mo2f_message', 'Error occurred while saving the settings.Please try again.');
645
+ $this->mo_auth_show_error_message();
646
+ }
647
+ }else{
648
+ update_option( 'mo2f_deviceid_enabled',0 );
649
+ update_option( 'mo2f_message', 'Error occurred while saving the settings.Please try again.');
650
+ $this->mo_auth_show_error_message();
651
+ }
652
+ }
653
+ }else{
654
+ update_option( 'mo2f_message', 'Invalid request. Please register with miniOrange and configure 2-Factor to save your login settings.');
655
+ $this->mo_auth_show_error_message();
656
+ }
657
+ }
658
+
659
+ if(isset($_POST['option']) and $_POST['option'] == 'mo_2factor_gobackto_registration_page'){ //back to registration page for admin
660
+ delete_option('mo2f_email');
661
+ delete_option('mo2f_password');
662
+ delete_option('mo2f_customerKey');
663
+ delete_option('mo2f_app_secret');
664
+ delete_option('mo2f_admin_company');
665
+ unset($_SESSION[ 'mo2f_transactionId' ]);
666
+ delete_user_meta($current_user->ID,'mo_2factor_map_id_with_email');
667
+ delete_user_meta($current_user->ID,'mo_2factor_user_registration_status');
668
+ delete_user_meta($current_user->ID,'mo2f_sms_otp_count');
669
+ delete_user_meta($current_user->ID,'mo2f_email_otp_count');
670
+ }
671
+
672
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_forgot_password'){ // if admin forgot password
673
+ if(isset( $_POST['email']) ){
674
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['email'] ) ) {
675
+ update_option( 'mo2f_message', 'Please enter your registered email below to reset your password.');
676
+
677
+
678
+ $this->mo_auth_show_error_message();
679
+ return;
680
+ }else
681
+ $email = sanitize_email($_POST['email']);
682
+
683
+ }
684
+
685
+ $customer = new Customer_Setup();
686
+ $content = json_decode($customer->forgot_password($email),true);
687
+ if(strcasecmp($content['status'], 'SUCCESS') == 0){
688
+ update_option( 'mo2f_message','You password has been reset successfully. A new password has been sent to your registered mail.');
689
+ $this->mo_auth_show_success_message();
690
+ }else{
691
+ update_option( 'mo2f_message','Your password could not be reset. Please enter your correct email in the textbox below and then click on the link.');
692
+ $this->mo_auth_show_error_message();
693
+ }
694
+
695
+
696
+ }
697
+
698
+ }
699
+
700
+ if(isset($_POST['option']) and trim($_POST['option']) == "mo_2factor_resend_user_otp"){ //resend OTP over email for additional admin and non-admin user
701
+ $customer = new Customer_Setup();
702
+ $content = json_decode($customer->send_otp_token(get_user_meta($current_user->ID,'mo_2factor_user_email',true),'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
703
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
704
+ update_option( 'mo2f_message', 'An OTP has been sent to <b>' . ( get_user_meta($current_user->ID,'mo_2factor_user_email',true) ) . '</b>. Please enter the OTP below to verify your email. ');
705
+ update_user_meta($current_user->ID,'mo_2fa_verify_otp_create_account',$content['txId']);
706
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
707
+ $this->mo_auth_show_success_message();
708
+ }else{
709
+ update_option('mo2f_message','There was an error in sending email. Please click on Resend OTP to try again.');
710
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
711
+ $this->mo_auth_show_error_message();
712
+ }
713
+ }
714
+
715
+ if(isset($_POST['option']) and ($_POST['option'] == "mo_auth_mobile_registration_complete" || $_POST['option'] == 'mo_auth_mobile_reconfiguration_complete')){ //mobile registration successfully complete for all users
716
+ unset($_SESSION[ 'mo2f_qrCode' ]);
717
+ unset($_SESSION[ 'mo2f_transactionId' ]);
718
+ unset($_SESSION[ 'mo2f_show_qr_code'] );
719
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
720
+ $enduser = new Two_Factor_Setup();
721
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true),null,null,null),true);
722
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
723
+ if($response['status'] == 'ERROR'){
724
+ update_option( 'mo2f_message', $response['message']);
725
+ $this->mo_auth_show_error_message();
726
+ }else if($response['status'] == 'SUCCESS'){
727
+ $selectedMethod = get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true);
728
+ $testmethod = $selectedMethod;
729
+ if( $selectedMethod == 'MOBILE AUTHENTICATION'){
730
+ $selectedMethod = "QR Code Authentication";
731
+ }
732
+ $message = '<b>' . $selectedMethod.'</b> is set as your 2nd factor method. <a href=\"#test\" data-method=\"' . $testmethod . '\">Click Here</a> to test ' . $selectedMethod . ' method.';
733
+ update_option( 'mo2f_message', $message);
734
+ update_user_meta($current_user->ID,'mo2f_mobile_registration_status',true);
735
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
736
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
737
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
738
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
739
+ $this->mo_auth_show_success_message();
740
+ }else{
741
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
742
+ $this->mo_auth_show_error_message();
743
+ }
744
+
745
+ }else{
746
+ update_option( 'mo2f_message','Invalid request. Please try again');
747
+ $this->mo_auth_show_error_message();
748
+ }
749
+
750
+ }
751
+
752
+ if(isset($_POST['option']) and $_POST['option'] == 'mo2f_mobile_authenticate_success'){ // mobile registration for all users(common)
753
+ if(current_user_can('manage_options')){
754
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
755
+ }else{
756
+ update_option( 'mo2f_message','You have successfully completed the test. <a href='.wp_login_url() . '?action=logout><b>Click Here</b></a> to logout and try login with 2-Factor.');
757
+ }
758
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
759
+ unset($_SESSION['mo2f_qrCode']);
760
+ unset($_SESSION['mo2f_transactionId']);
761
+ unset($_SESSION['mo2f_show_qr_code']);
762
+ $this->mo_auth_show_success_message();
763
+ }
764
+
765
+ if(isset($_POST['option']) and $_POST['option'] == 'mo2f_mobile_authenticate_error'){ //mobile registration failed for all users(common)
766
+ update_option( 'mo2f_message','Authentication failed. Please try again to test the configuration.');
767
+ unset($_SESSION['mo2f_show_qr_code']);
768
+ $this->mo_auth_show_error_message();
769
+ }
770
+
771
+ if(isset($_POST['option']) and $_POST['option'] == "mo_auth_setting_configuration"){ // redirect to setings page
772
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
773
+ }
774
+
775
+ if(isset($_POST['option']) and $_POST['option'] == "mo_auth_refresh_mobile_qrcode"){ // refrsh Qrcode for all users
776
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_TWO_FACTOR'
777
+ ||get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_INITIALIZE_MOBILE_REGISTRATION'
778
+ || get_user_meta($current_user->ID,'mo_2factor_user_registration_status',true) == 'MO_2_FACTOR_PLUGIN_SETTINGS') {
779
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
780
+ $this->mo2f_get_qr_code_for_mobile($email,$current_user->ID);
781
+ }else{
782
+ update_option( 'mo2f_message','Invalid request. Please register with miniOrange before configuring your mobile.');
783
+ $this->mo_auth_show_error_message();
784
+ }
785
+ }
786
+
787
+ if (isset($_POST['miniorange_get_started']) && isset($_POST['miniorange_user_reg_nonce'])){ //registration with miniOrange for additional admin and non-admin
788
+ $nonce = $_POST['miniorange_user_reg_nonce'];
789
+ if ( ! wp_verify_nonce( $nonce, 'miniorange-2-factor-user-reg-nonce' ) ) {
790
+ update_option('mo2f_message','Invalid request');
791
+ } else {
792
+ $email = '';
793
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo_useremail'] )){
794
+ update_option( 'mo2f_message', 'Please enter email-id to register.');
795
+ return;
796
+ }else{
797
+ $email = sanitize_email( $_POST['mo_useremail'] );
798
+ }
799
+
800
+ if(!MO2f_Utility::check_if_email_is_already_registered($email)){
801
+ update_user_meta($current_user->ID,'mo_2factor_user_email',$email);
802
+
803
+ $enduser = new Two_Factor_Setup();
804
+ $check_user = json_decode($enduser->mo_check_user_already_exist($email),true);
805
+ if(json_last_error() == JSON_ERROR_NONE){
806
+ if($check_user['status'] == 'ERROR'){
807
+ update_option( 'mo2f_message', $check_user['message']);
808
+ $this->mo_auth_show_error_message();
809
+ return;
810
+ }else if(strcasecmp($check_user['status'], 'USER_FOUND_UNDER_DIFFERENT_CUSTOMER') == 0){
811
+ update_option( 'mo2f_message', 'The email you entered is already registered. Please register with another email to set up Two-Factor.');
812
+ $this->mo_auth_show_error_message();
813
+ return;
814
+ }
815
+ else if(strcasecmp($check_user['status'], 'USER_FOUND') == 0 || strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
816
+
817
+
818
+
819
+ $enduser = new Customer_Setup();
820
+ $content = json_decode($enduser->send_otp_token($email,'EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
821
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
822
+ update_option( 'mo2f_message', 'An OTP has been sent to <b>' . ( $email ) . '</b>. Please enter the OTP below to verify your email. ');
823
+ $_SESSION[ 'mo2f_transactionId' ] = $content['txId'];
824
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_SUCCESS');
825
+ $this->mo_auth_show_success_message();
826
+ }else{
827
+ update_option('mo2f_message','There was an error in sending OTP over email. Please click on Resend OTP to try again.');
828
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
829
+ $this->mo_auth_show_error_message();
830
+ }
831
+ }
832
+ }
833
+ }else{
834
+ update_option('mo2f_message','The email is already used by other user. Please register with other email.');
835
+ $this->mo_auth_show_error_message();
836
+ }
837
+ }
838
+ }
839
+
840
+ if(isset($_POST['option']) and $_POST['option'] == 'mo_2factor_backto_user_registration'){ //back to registration page for additional admin and non-admin
841
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
842
+ unset($_SESSION[ 'mo2f_transactionId' ]);
843
+ delete_user_meta($current_user->ID,'mo_2factor_map_id_with_email');
844
+ delete_user_meta($current_user->ID,'mo_2factor_user_registration_status');
845
+ }
846
+
847
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_mobile_authentication'){ //test QR-Code authentication for all users
848
+
849
+ $challengeMobile = new Customer_Setup();
850
+ $content = $challengeMobile->send_otp_token(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'MOBILE AUTHENTICATION',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
851
+ $response = json_decode($content, true);
852
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
853
+ if($response['status'] == 'ERROR'){
854
+ update_option( 'mo2f_message', $response['message']);
855
+ $this->mo_auth_show_error_message();
856
+ }else{
857
+ if($response['status'] == 'SUCCESS'){
858
+ $_SESSION[ 'mo2f_qrCode' ] = $response['qrCode'];
859
+ $_SESSION[ 'mo2f_transactionId' ] = $response['txId'];
860
+ $_SESSION[ 'mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
861
+ update_option( 'mo2f_message','Please scan the QR Code now.');
862
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
863
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', 'MOBILE AUTHENTICATION');
864
+ $this->mo_auth_show_success_message();
865
+ }else{
866
+ unset($_SESSION[ 'mo2f_qrCode' ]);
867
+ unset($_SESSION[ 'mo2f_transactionId' ]);
868
+ unset($_SESSION[ 'mo2f_show_qr_code'] );
869
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
870
+ $this->mo_auth_show_error_message();
871
+ }
872
+ }
873
+ }else{
874
+ update_option( 'mo2f_message','Invalid request. Please try again');
875
+ $this->mo_auth_show_error_message();
876
+ }
877
+
878
+ }
879
+
880
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_soft_token'){ // Click on Test Soft Toekn link for all users
881
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
882
+ update_user_meta($current_user->ID, 'mo2f_selected_2factor_method', 'SOFT TOKEN');
883
+ }
884
+
885
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_soft_token'){ // validate Soft Token during test for all users
886
+ $otp_token = '';
887
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
888
+ update_option( 'mo2f_message', 'Please enter a value to test your authentication.');
889
+ $this->mo_auth_show_error_message();
890
+ return;
891
+ } else{
892
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
893
+ }
894
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
895
+ $customer = new Customer_Setup();
896
+ $content = json_decode($customer->validate_otp_token( 'SOFT TOKEN', $email, null, $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
897
+ if($content['status'] == 'ERROR'){
898
+ update_option( 'mo2f_message', $content['message']);
899
+ $this->mo_auth_show_error_message();
900
+ }else{
901
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated and generate QRCode
902
+ if(current_user_can('manage_options')){
903
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
904
+ }else{
905
+ update_option( 'mo2f_message','You have successfully completed the test. <a href='.wp_login_url() . '?action=logout><b>Click Here</b></a> to logout and try login with 2-Factor.');
906
+ }
907
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
908
+ $this->mo_auth_show_success_message();
909
+
910
+ }else{ // OTP Validation failed.
911
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
912
+ $this->mo_auth_show_error_message();
913
+ }
914
+ }
915
+ }
916
+
917
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_otp_over_sms'){ //sending otp for sms and phone call during test for all users
918
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
919
+ update_user_meta($current_user->ID, 'mo2f_selected_2factor_method', $_POST['mo2f_selected_2factor_method']);
920
+
921
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
922
+ $phone = get_user_meta($current_user->ID,'mo2f_user_phone',true);
923
+ $enduser = new Customer_Setup();
924
+ $content = json_decode($enduser->send_otp_token($email,$_POST['mo2f_selected_2factor_method'],get_option('mo2f_customerKey'),get_option('mo2f_api_key')), true);
925
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
926
+ if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'SMS'){
927
+ update_option( 'mo2f_message', 'An OTP has been sent to <b>' . ( $phone ) . '</b>. Please enter the one time passcode below. ');
928
+ }else if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'PHONE VERIFICATION'){
929
+ update_option( 'mo2f_message','You will receive a phone call on this number ' . $phone . '. Please enter the one time passcode below.');
930
+ }
931
+ $_SESSION[ 'mo2f_transactionId' ] = $content['txId'];
932
+ $this->mo_auth_show_success_message();
933
+ }else{
934
+ update_option('mo2f_message','There was an error in sending one time passcode. Please click on Resend OTP to try again.');
935
+ $this->mo_auth_show_error_message();
936
+ }
937
+ }
938
+
939
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_otp_over_sms'){ //validate otp over sms and phone call during test for all users
940
+ $otp_token = '';
941
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
942
+ update_option( 'mo2f_message', 'Please enter a value to test your authentication.');
943
+ $this->mo_auth_show_error_message();
944
+ return;
945
+ } else{
946
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
947
+ }
948
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
949
+ $customer = new Customer_Setup();
950
+ $content = json_decode($customer->validate_otp_token( get_user_meta($current_user->ID, 'mo2f_selected_2factor_method',true), $email,$_SESSION[ 'mo2f_transactionId' ], $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
951
+ if($content['status'] == 'ERROR'){
952
+ update_option( 'mo2f_message', $content['message']);
953
+ $this->mo_auth_show_error_message();
954
+ }else{
955
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated
956
+ if(current_user_can('manage_options')){
957
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
958
+ }else{
959
+ update_option( 'mo2f_message','You have successfully completed the test. <a href='.wp_login_url() . '?action=logout><b>Click Here</b></a> to logout and try login with 2-Factor.');
960
+ }
961
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
962
+ $this->mo_auth_show_success_message();
963
+
964
+ }else{ // OTP Validation failed.
965
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
966
+ $this->mo_auth_show_error_message();
967
+ }
968
+ }
969
+ }
970
+
971
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_push_notification'){
972
+
973
+ $challengeMobile = new Customer_Setup();
974
+ $content = $challengeMobile->send_otp_token(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'PUSH NOTIFICATIONS',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
975
+ $response = json_decode($content, true);
976
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate Qr code */
977
+ if($response['status'] == 'ERROR'){
978
+ update_option( 'mo2f_message', $response['message']);
979
+ $this->mo_auth_show_error_message();
980
+ }else{
981
+ if($response['status'] == 'SUCCESS'){
982
+ $_SESSION[ 'mo2f_transactionId' ] = $response['txId'];
983
+ $_SESSION[ 'mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
984
+ update_option( 'mo2f_message','A Push notification has been sent to your miniOrange Authenticator App.');
985
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
986
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', 'PUSH NOTIFICATIONS');
987
+ $this->mo_auth_show_success_message();
988
+ }else{
989
+ unset($_SESSION[ 'mo2f_qrCode' ]);
990
+ unset($_SESSION[ 'mo2f_transactionId' ]);
991
+ unset($_SESSION[ 'mo2f_show_qr_code'] );
992
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
993
+ $this->mo_auth_show_error_message();
994
+ }
995
+ }
996
+ }else{
997
+ update_option( 'mo2f_message','Invalid request. Please try again');
998
+ $this->mo_auth_show_error_message();
999
+ }
1000
+
1001
+ }
1002
+
1003
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_out_of_band_email'){
1004
+ $this->miniorange_email_verification_call($current_user);
1005
+ }
1006
+
1007
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_out_of_band_success'){
1008
+ if(!current_user_can('manage_options') && get_user_meta( $current_user->ID,'mo2f_selected_2factor_method', true) == 'OUT OF BAND EMAIL'){
1009
+ if(get_user_meta($current_user->ID,'mo2f_email_verification_status',true)){
1010
+ update_option( 'mo2f_message','You have successfully completed the test.');
1011
+ }else{
1012
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1013
+ $enduser = new Two_Factor_Setup();
1014
+ $response = json_decode($enduser->mo2f_update_userinfo($email, get_user_meta( $current_user->ID,'mo2f_selected_2factor_method', true),null,null,null),true);
1015
+ update_option( 'mo2f_message','<b>Email Verification</b> has been set as your 2nd factor method.');
1016
+ }
1017
+ }else{
1018
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
1019
+ }
1020
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1021
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1022
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1023
+ $this->mo_auth_show_success_message();
1024
+
1025
+ }
1026
+
1027
+ if(isset($_POST['option']) and $_POST['option'] == 'mo2f_out_of_band_error'){ //push and out of band email denied
1028
+ update_option( 'mo2f_message','You have denied the request.');
1029
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1030
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1031
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1032
+ $this->mo_auth_show_error_message();
1033
+ }
1034
+
1035
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_google_auth'){
1036
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
1037
+ update_user_meta($current_user->ID, 'mo2f_selected_2factor_method', 'GOOGLE AUTHENTICATOR');
1038
+ }
1039
+
1040
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_google_auth_test'){
1041
+ $otp_token = '';
1042
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
1043
+ update_option( 'mo2f_message', 'Please enter a value to test your authentication.');
1044
+ $this->mo_auth_show_error_message();
1045
+ return;
1046
+ } else{
1047
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
1048
+ }
1049
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1050
+ $customer = new Customer_Setup();
1051
+ $content = json_decode($customer->validate_otp_token( 'GOOGLE AUTHENTICATOR', $email, null, $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key')),true);
1052
+ if(json_last_error() == JSON_ERROR_NONE) {
1053
+
1054
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) { //Google OTP validated
1055
+ if(current_user_can('manage_options')){
1056
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
1057
+ }else{
1058
+ update_option( 'mo2f_message','You have successfully completed the test.');
1059
+ }
1060
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1061
+ $this->mo_auth_show_success_message();
1062
+
1063
+ }else{ // OTP Validation failed.
1064
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
1065
+ $this->mo_auth_show_error_message();
1066
+ }
1067
+ }else{
1068
+ update_option( 'mo2f_message','Error occurred while validating the OTP. Please try again.');
1069
+ $this->mo_auth_show_error_message();
1070
+ }
1071
+ }
1072
+
1073
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_configure_google_auth_phone_type' ){
1074
+ $phone_type = $_POST['mo2f_app_type_radio'];
1075
+ $google_auth = new Miniorange_Rba_Attributes();
1076
+ $google_response = json_decode($google_auth->mo2f_google_auth_service(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
1077
+ if(json_last_error() == JSON_ERROR_NONE) {
1078
+ if($google_response['status'] == 'SUCCESS'){
1079
+ $mo2f_google_auth = array();
1080
+ $mo2f_google_auth['ga_qrCode'] = $google_response['qrCodeData'];
1081
+ $mo2f_google_auth['ga_secret'] = $google_response['secret'];
1082
+ $mo2f_google_auth['ga_phone'] = $phone_type;
1083
+ $_SESSION['mo2f_google_auth'] = $mo2f_google_auth;
1084
+ }else{
1085
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1086
+ $this->mo_auth_show_error_message();
1087
+ }
1088
+ }else{
1089
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1090
+ $this->mo_auth_show_error_message();
1091
+ }
1092
+ }
1093
+
1094
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_google_auth' ){
1095
+ $otpToken = $_POST['google_token'];
1096
+ $mo2f_google_auth = isset($_SESSION['mo2f_google_auth']) ? $_SESSION['mo2f_google_auth'] : null;
1097
+ $ga_secret = $mo2f_google_auth != null ? $mo2f_google_auth['ga_secret'] : null;
1098
+ if(MO2f_Utility::mo2f_check_number_length($otpToken)){
1099
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1100
+ $google_auth = new Miniorange_Rba_Attributes();
1101
+ $google_response = json_decode($google_auth->mo2f_validate_google_auth($email,$otpToken,$ga_secret),true);
1102
+ if(json_last_error() == JSON_ERROR_NONE) {
1103
+ if($google_response['status'] == 'SUCCESS'){
1104
+ $enduser = new Two_Factor_Setup();
1105
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true),null,null,null),true);
1106
+ if(json_last_error() == JSON_ERROR_NONE) {
1107
+
1108
+ if($response['status'] == 'SUCCESS'){
1109
+
1110
+ update_user_meta($current_user->ID,'mo2f_google_authentication_status',true);
1111
+ update_user_meta($current_user->ID,'mo2f_authy_authentication_status',false);
1112
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1113
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
1114
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1115
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1116
+ update_user_meta($current_user->ID,'mo2f_external_app_type','GOOGLE AUTHENTICATOR');
1117
+ unset($_SESSION['mo2f_google_auth']);
1118
+ $message = '<b>Google Authenticator</b> has been set as your 2nd factor method. <a href=\"#test\" data-method=\"GOOGLE AUTHENTICATOR\">Click Here</a> to test Google Authenticator method.';
1119
+ update_option( 'mo2f_message',$message );
1120
+ $this->mo_auth_show_success_message();
1121
+
1122
+ }else{
1123
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1124
+ $this->mo_auth_show_error_message();
1125
+ }
1126
+ }else{
1127
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1128
+ $this->mo_auth_show_error_message();
1129
+ }
1130
+ }else{
1131
+ update_option( 'mo2f_message','Error occurred while validating the OTP. Please try again. Possible causes: <br />1. You have enter invalid OTP.<br />2. You App Time is not sync.Go to seetings and tap on Time correction for codes and tap on Sync now .');
1132
+ $this->mo_auth_show_error_message();
1133
+ }
1134
+ }else{
1135
+ update_option( 'mo2f_message','Error occurred while validating the user. Please try again.');
1136
+ $this->mo_auth_show_error_message();
1137
+ }
1138
+ }else{
1139
+ update_option( 'mo2f_message','Only digits are allowed. Please enter again.');
1140
+ $this->mo_auth_show_error_message();
1141
+ }
1142
+ }
1143
+
1144
+ if(isset($_POST['option']) && $_POST['option'] == 'mo_2factor_test_authy_auth'){
1145
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
1146
+ update_user_meta($current_user->ID, 'mo2f_selected_2factor_method', 'AUTHY 2-FACTOR AUTHENTICATION');
1147
+ }
1148
+
1149
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_configure_authy_app' ){
1150
+ $authy = new Miniorange_Rba_Attributes();
1151
+ $authy_response = json_decode($authy->mo2f_google_auth_service(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true)),true);
1152
+ if(json_last_error() == JSON_ERROR_NONE) {
1153
+ if($authy_response['status'] == 'SUCCESS'){
1154
+ $mo2f_authy_keys = array();
1155
+ $mo2f_authy_keys['authy_qrCode'] = $authy_response['qrCodeData'];
1156
+ $mo2f_authy_keys['authy_secret'] = $authy_response['secret'];
1157
+ $_SESSION['mo2f_authy_keys'] = $mo2f_authy_keys;
1158
+ }else{
1159
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1160
+ $this->mo_auth_show_error_message();
1161
+ }
1162
+ }else{
1163
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1164
+ $this->mo_auth_show_error_message();
1165
+ }
1166
+ }
1167
+
1168
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_authy_auth' ){
1169
+ $otpToken = $_POST['authy_token'];
1170
+ $mo2f_google_auth = isset($_SESSION['mo2f_authy_keys']) ? $_SESSION['mo2f_authy_keys'] : null;
1171
+ $authy_secret = $mo2f_google_auth != null ? $mo2f_google_auth['authy_secret'] : null;
1172
+ if(MO2f_Utility::mo2f_check_number_length($otpToken)){
1173
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1174
+ $authy_auth = new Miniorange_Rba_Attributes();
1175
+ $authy_response = json_decode($authy_auth->mo2f_validate_google_auth($email,$otpToken,$authy_secret),true);
1176
+ if(json_last_error() == JSON_ERROR_NONE) {
1177
+ if($authy_response['status'] == 'SUCCESS'){
1178
+ $enduser = new Two_Factor_Setup();
1179
+ $response = json_decode($enduser->mo2f_update_userinfo($email,'GOOGLE AUTHENTICATOR',null,null,null),true);
1180
+ if(json_last_error() == JSON_ERROR_NONE) {
1181
+
1182
+ if($response['status'] == 'SUCCESS'){
1183
+
1184
+ update_user_meta($current_user->ID,'mo2f_authy_authentication_status',true);
1185
+ update_user_meta($current_user->ID,'mo2f_google_authentication_status',false);
1186
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1187
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
1188
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1189
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1190
+ update_user_meta($current_user->ID,'mo2f_external_app_type','AUTHY 2-FACTOR AUTHENTICATION');
1191
+ unset($_SESSION['mo2f_authy_keys']);
1192
+ $message = '<b>Authy 2-Factor Authentication</b> has been set as your 2nd factor method. <a href=\"#test\" data-method=\"AUTHY 2-FACTOR AUTHENTICATION\">Click Here</a> to test Authy 2-Factor Authentication method.';
1193
+ update_option( 'mo2f_message',$message );
1194
+ $this->mo_auth_show_success_message();
1195
+
1196
+ }else{
1197
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1198
+ $this->mo_auth_show_error_message();
1199
+ }
1200
+ }else{
1201
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1202
+ $this->mo_auth_show_error_message();
1203
+ }
1204
+ }else{
1205
+ update_option( 'mo2f_message','Error occurred while validating the OTP. Please try again. Possible causes: <br />1. You have enter invalid OTP.<br />2. You App Time is not sync.Go to seetings and tap on Time correction for codes and tap on Sync now .');
1206
+ $this->mo_auth_show_error_message();
1207
+ }
1208
+ }else{
1209
+ update_option( 'mo2f_message','Error occurred while validating the user. Please try again.');
1210
+ $this->mo_auth_show_error_message();
1211
+ }
1212
+ }else{
1213
+ update_option( 'mo2f_message','Only digits are allowed. Please enter again.');
1214
+ $this->mo_auth_show_error_message();
1215
+ }
1216
+ }
1217
+
1218
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_save_kba'){
1219
+ if(MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_2'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans2'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kbaquestion_3'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_kba_ans3'] ) ){
1220
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
1221
+ $this->mo_auth_show_error_message();
1222
+ return;
1223
+ }
1224
+
1225
+ $kba_q1 = $_POST[ 'mo2f_kbaquestion_1' ];
1226
+ $kba_a1 = sanitize_text_field( $_POST[ 'mo2f_kba_ans1' ] );
1227
+ $kba_q2 = $_POST[ 'mo2f_kbaquestion_2' ];
1228
+ $kba_a2 = sanitize_text_field( $_POST[ 'mo2f_kba_ans2' ] );
1229
+ $kba_q3 = sanitize_text_field( $_POST[ 'mo2f_kbaquestion_3' ] );
1230
+ $kba_a3 = sanitize_text_field( $_POST[ 'mo2f_kba_ans3' ] );
1231
+
1232
+
1233
+ if (strcasecmp($kba_q1, $kba_q2) == 0 || strcasecmp($kba_q2, $kba_q3) == 0 || strcasecmp($kba_q3, $kba_q1) == 0) {
1234
+ update_option( 'mo2f_message', 'The questions you select must be unique.');
1235
+ $this->mo_auth_show_error_message();
1236
+ return;
1237
+ }
1238
+ $kba_q1 = addcslashes(stripslashes($kba_q1), '"\\');
1239
+ $kba_a1 = addcslashes(stripslashes($kba_a1), '"\\');
1240
+ $kba_q2 = addcslashes(stripslashes($kba_q2), '"\\');
1241
+ $kba_a2 = addcslashes(stripslashes($kba_a2), '"\\');
1242
+ $kba_q3 = addcslashes(stripslashes($kba_q3), '"\\');
1243
+ $kba_a3 = addcslashes(stripslashes($kba_a3), '"\\');
1244
+
1245
+ $kba_registration = new Two_Factor_Setup();
1246
+ $kba_reg_reponse = json_decode($kba_registration->register_kba_details(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), $kba_q1,$kba_a1,$kba_q2,$kba_a2,$kba_q3,$kba_a3),true);
1247
+ if(json_last_error() == JSON_ERROR_NONE) {
1248
+ if($kba_reg_reponse['status'] == 'SUCCESS'){
1249
+ if(isset($_POST['mobile_kba_option']) && $_POST['mobile_kba_option'] == 'mo2f_request_for_kba_as_emailbackup'){
1250
+ unset($_SESSION['mo2f_mobile_support']);
1251
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1252
+ update_user_meta($current_user->ID,'mo2f_kba_registration_status',true);
1253
+ delete_user_meta( $current_user->ID,'mo2f_selected_2factor_method');
1254
+ $message = 'Your KBA as alternate 2 factor is configured successfully.';
1255
+ update_option( 'mo2f_message',$message );
1256
+ $this->mo_auth_show_success_message();
1257
+ }else{
1258
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1259
+ $enduser = new Two_Factor_Setup();
1260
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', 'KBA');
1261
+ $response = json_decode($enduser->mo2f_update_userinfo($email,'KBA',null,null,null),true);
1262
+ if(json_last_error() == JSON_ERROR_NONE) {
1263
+ if($response['status'] == 'ERROR'){
1264
+ update_option( 'mo2f_message', $response['message']);
1265
+ $this->mo_auth_show_error_message();
1266
+ }else if($response['status'] == 'SUCCESS'){
1267
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1268
+ update_user_meta($current_user->ID,'mo2f_kba_registration_status',true);
1269
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1270
+ $authType = 'KBA';
1271
+ $message = '<b>' . $authType.'</b> is set as your 2nd factor method. <a href=\"#test\" data-method=\"' . $authType . '\">Click Here</a> to test ' . $authType . ' method.';
1272
+ update_option( 'mo2f_message',$message );
1273
+ $this->mo_auth_show_success_message();
1274
+ }else{
1275
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1276
+ $this->mo_auth_show_error_message();
1277
+ }
1278
+ }else{
1279
+ update_option( 'mo2f_message','Invalid request. Please try again');
1280
+ $this->mo_auth_show_error_message();
1281
+ }
1282
+ }
1283
+ }else{
1284
+ update_option( 'mo2f_message', 'Error occured while saving your kba details. Please try again.');
1285
+ $this->mo_auth_show_error_message();
1286
+ return;
1287
+ }
1288
+ }else{
1289
+ update_option( 'mo2f_message', 'Error occured while saving your kba details. Please try again.');
1290
+ $this->mo_auth_show_error_message();
1291
+ return;
1292
+ }
1293
+
1294
+ }
1295
+
1296
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_2factor_test_kba'){
1297
+
1298
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1299
+ $challengeKba = new Customer_Setup();
1300
+ $content = $challengeKba->send_otp_token($email, 'KBA',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1301
+ $response = json_decode($content, true);
1302
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate KBA Questions*/
1303
+ if($response['status'] == 'SUCCESS'){
1304
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
1305
+ $_SESSION[ 'mo2f_transactionId' ] = $response['txId'];
1306
+ $questions = array();
1307
+ $questions[0] = $response['questions'][0]['question'];
1308
+ $questions[1] = $response['questions'][1]['question'];
1309
+ $_SESSION[ 'mo_2_factor_kba_questions' ] = $questions;
1310
+ update_user_meta($current_user->ID,'mo2f_selected_2factor_method','KBA');
1311
+ update_option( 'mo2f_message','Please answer the following security questions.');
1312
+ $this->mo_auth_show_success_message();
1313
+ }else if($response['status'] == 'ERROR'){
1314
+ update_option('mo2f_message','There was an error fetching security questions. Please try again.');
1315
+ $this->mo_auth_show_error_message();
1316
+ }
1317
+ }else{
1318
+ update_option('mo2f_message','There was an error fetching security questions. Please try again.');
1319
+ $this->mo_auth_show_error_message();
1320
+ }
1321
+ }
1322
+
1323
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_kba_details'){
1324
+ $kba_ans_1 = '';
1325
+ $kba_ans_2 = '';
1326
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] ) || MO2f_Utility::mo2f_check_empty_or_null( $_POST['mo2f_answer_1'] )) {
1327
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
1328
+ $this->mo_auth_show_error_message();
1329
+ return;
1330
+ } else{
1331
+ $kba_ans_1 = sanitize_text_field( $_POST['mo2f_answer_1'] );
1332
+ $kba_ans_2 = sanitize_text_field( $_POST['mo2f_answer_2'] );
1333
+ }
1334
+
1335
+ $kbaAns = array();
1336
+ $kbaAns[0] = $_SESSION['mo_2_factor_kba_questions'][0];
1337
+ $kbaAns[1] = $kba_ans_1;
1338
+ $kbaAns[2] = $_SESSION['mo_2_factor_kba_questions'][1];
1339
+ $kbaAns[3] = $kba_ans_2;
1340
+
1341
+ $kba_validate = new Customer_Setup();
1342
+ $kba_validate_response = json_decode($kba_validate->validate_otp_token( 'KBA', null, $_SESSION[ 'mo2f_transactionId' ], $kbaAns, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
1343
+
1344
+ if(json_last_error() == JSON_ERROR_NONE) {
1345
+ if(strcasecmp($kba_validate_response['status'], 'SUCCESS') == 0) {
1346
+ update_option( 'mo2f_message','You have successfully completed the test. Now <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login&true\"><b>Click Here</b></a> to go to Login Settings. ');
1347
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1348
+ $this->mo_auth_show_success_message();
1349
+
1350
+ }else{ // KBA Validation failed.
1351
+ update_option( 'mo2f_message','Invalid Answers. Please try again.');
1352
+ $this->mo_auth_show_error_message();
1353
+ }
1354
+ }
1355
+ }
1356
+
1357
+
1358
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_verify_phone'){ // sendin otp for configuring OTP over SMS and Phone Call Verification
1359
+ $phone = sanitize_text_field( $_POST['verify_phone'] );
1360
+
1361
+ if( MO2f_Utility::mo2f_check_empty_or_null( $phone ) ){
1362
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
1363
+ $this->mo_auth_show_error_message();
1364
+ return;
1365
+ }
1366
+ $phone = str_replace(' ', '', $phone);
1367
+ $_SESSION['mo2f_phone'] = $phone;
1368
+
1369
+ $customer = new Customer_Setup();
1370
+
1371
+ if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'SMS'){
1372
+ $currentMethod = "OTP_OVER_SMS";
1373
+ }else if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'PHONE VERIFICATION'){
1374
+ $currentMethod = "PHONE_VERIFICATION";
1375
+ }
1376
+
1377
+ $content = json_decode($customer->send_otp_token($phone,$currentMethod,get_option( 'mo2f_customerKey'),get_option( 'mo2f_api_key')), true);
1378
+
1379
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate otp token */
1380
+ if($content['status'] == 'ERROR'){
1381
+ update_option( 'mo2f_message', $response['message']);
1382
+ $this->mo_auth_show_error_message();
1383
+ }else if($content['status'] == 'SUCCESS'){
1384
+ $_SESSION[ 'mo2f_transactionId' ] = $content['txId'];
1385
+
1386
+ if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'SMS'){
1387
+ update_option( 'mo2f_message','The One Time Passcode has been sent to ' . $phone . '. Please enter the one time passcode below to verify your number.');
1388
+ }else if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true)== 'PHONE VERIFICATION'){
1389
+ update_option( 'mo2f_message','You will receive a phone call on this number ' . $phone . '. Please enter the one time passcode below to verify your number.');
1390
+ }
1391
+ $this->mo_auth_show_success_message();
1392
+ }else{
1393
+ update_option( 'mo2f_message',$content['message']);
1394
+ $this->mo_auth_show_error_message();
1395
+ }
1396
+
1397
+ }else{
1398
+ update_option( 'mo2f_message','Invalid request. Please try again');
1399
+ $this->mo_auth_show_error_message();
1400
+ }
1401
+ }
1402
+
1403
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_validate_otp'){
1404
+ $otp_token = '';
1405
+ if( MO2f_Utility::mo2f_check_empty_or_null( $_POST['otp_token'] ) ) {
1406
+ update_option( 'mo2f_message', 'All the fields are required. Please enter valid entries.');
1407
+ $this->mo_auth_show_error_message();
1408
+ return;
1409
+ } else{
1410
+ $otp_token = sanitize_text_field( $_POST['otp_token'] );
1411
+ }
1412
+
1413
+ $customer = new Customer_Setup();
1414
+ $content = json_decode($customer->validate_otp_token( get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true), null, $_SESSION[ 'mo2f_transactionId' ], $otp_token, get_option('mo2f_customerKey'), get_option('mo2f_api_key') ),true);
1415
+ if($content['status'] == 'ERROR'){
1416
+ update_option( 'mo2f_message', $content['message']);
1417
+
1418
+ }else if(strcasecmp($content['status'], 'SUCCESS') == 0) { //OTP validated
1419
+ if(get_user_meta($current_user->ID,'mo2f_user_phone',true) && strlen(get_user_meta($current_user->ID,'mo2f_user_phone',true)) >= 4){
1420
+ if($_SESSION['mo2f_phone'] != get_user_meta($current_user->ID,'mo2f_user_phone',true) ){
1421
+ update_user_meta($current_user->ID,'mo2f_mobile_registration_status',false);
1422
+ }
1423
+ }
1424
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1425
+ $phone = $_SESSION['mo2f_phone'];
1426
+
1427
+ $enduser = new Two_Factor_Setup();
1428
+ $response = json_decode($enduser->mo2f_update_userinfo($email,get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true),$phone,null,null),true);
1429
+ if(json_last_error() == JSON_ERROR_NONE) {
1430
+
1431
+ if($response['status'] == 'ERROR'){
1432
+ unset($_SESSION[ 'mo2f_phone']);
1433
+ update_option( 'mo2f_message', $response['message']);
1434
+ $this->mo_auth_show_error_message();
1435
+ }else if($response['status'] == 'SUCCESS'){
1436
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1437
+ update_user_meta($current_user->ID,'mo2f_otp_registration_status',true);
1438
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
1439
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1440
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1441
+ update_user_meta($current_user->ID,'mo2f_user_phone',$_SESSION[ 'mo2f_phone']);
1442
+ unset($_SESSION[ 'mo2f_phone']);
1443
+ $testmethod = get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true);
1444
+ if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'SMS'){
1445
+ $authType = "OTP Over SMS";
1446
+ }else if(get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true) == 'PHONE VERIFICATION'){
1447
+ $authType = "Phone Call Verification";
1448
+ }
1449
+ $message = '<b>' . $authType.'</b> is set as your 2nd factor method. <a href=\"#test\" data-method=\"' . $testmethod . '\">Click Here</a> to test ' . $authType . ' method.';
1450
+ update_option( 'mo2f_message',$message );
1451
+ $this->mo_auth_show_success_message();
1452
+ }else{
1453
+ unset($_SESSION[ 'mo2f_phone']);
1454
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1455
+ $this->mo_auth_show_error_message();
1456
+ }
1457
+ }else{
1458
+ unset($_SESSION[ 'mo2f_phone']);
1459
+ update_option( 'mo2f_message','Invalid request. Please try again');
1460
+ $this->mo_auth_show_error_message();
1461
+ }
1462
+
1463
+ }else{ // OTP Validation failed.
1464
+ update_option( 'mo2f_message','Invalid OTP. Please try again.');
1465
+ $this->mo_auth_show_error_message();
1466
+ }
1467
+
1468
+ }
1469
+
1470
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_save_2factor_method'){ // configure 2nd factor for all users
1471
+ if(get_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange',true) == 'SUCCESS'){
1472
+ if($_POST['mo2f_selected_2factor_method'] == 'OUT OF BAND EMAIL' && !current_user_can('manage_options')){
1473
+ $this->miniorange_email_verification_call($current_user);
1474
+ }
1475
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_CONFIGURE'); //status for configuring the specific 2nd-factor method
1476
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', $_POST['mo2f_selected_2factor_method']); //status for second factor selected by user
1477
+ }else{
1478
+ update_option( 'mo2f_message','Invalid request. Please register with miniOrange to configure 2 Factor plugin.');
1479
+ $this->mo_auth_show_error_message();
1480
+ }
1481
+ }
1482
+
1483
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_update_2factor_method'){ // save 2nd factor method for all users
1484
+
1485
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1486
+ $enduser = new Two_Factor_Setup();
1487
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', $_POST['mo2f_selected_2factor_method']);
1488
+ $current_method = $_POST['mo2f_selected_2factor_method'] == 'AUTHY 2-FACTOR AUTHENTICATION' ? 'GOOGLE AUTHENTICATOR' : $_POST['mo2f_selected_2factor_method'];
1489
+ $response = json_decode($enduser->mo2f_update_userinfo($email, $current_method,null,null,null),true);
1490
+
1491
+ if(json_last_error() == JSON_ERROR_NONE) {
1492
+ if($response['status'] == 'ERROR'){
1493
+ update_option( 'mo2f_message', $response['message']);
1494
+ $this->mo_auth_show_error_message();
1495
+ }else if($response['status'] == 'SUCCESS'){
1496
+ $selectedMethod = get_user_meta( $current_user->ID,'mo2f_selected_2factor_method',true);
1497
+ if($selectedMethod == 'OUT OF BAND EMAIL'){
1498
+ $selectedMethod = "Email Verification";
1499
+ } else if($selectedMethod == 'MOBILE AUTHENTICATION'){
1500
+ $selectedMethod = "QR Code Authentication";
1501
+ }else if($selectedMethod == 'SMS'){
1502
+ $authType = "OTP Over SMS";
1503
+ }else if($selectedMethod == 'GOOGLE AUTHENTICATOR' || $selectedMethod == 'AUTHY 2-FACTOR AUTHENTICATION'){
1504
+ update_user_meta($current_user->ID,'mo2f_external_app_type',$selectedMethod);
1505
+ }
1506
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1507
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1508
+ delete_user_meta($current_user->ID,'mo_2factor_mobile_registration_status');
1509
+ update_option( 'mo2f_message', $selectedMethod. ' is set as your Two-Factor method.');
1510
+ $this->mo_auth_show_success_message();
1511
+ }else{
1512
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1513
+ $this->mo_auth_show_error_message();
1514
+ }
1515
+ }else{
1516
+ update_option( 'mo2f_message','Invalid request. Please try again');
1517
+ $this->mo_auth_show_error_message();
1518
+ }
1519
+ }
1520
+
1521
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_cancel_configuration'){
1522
+ unset($_SESSION[ 'mo2f_qrCode' ]);
1523
+ unset($_SESSION[ 'mo2f_transactionId' ]);
1524
+ unset($_SESSION[ 'mo2f_show_qr_code']);
1525
+ unset($_SESSION[ 'mo2f_phone']);
1526
+ unset($_SESSION[ 'mo2f_google_auth' ]);
1527
+ unset($_SESSION[ 'mo2f_mobile_support' ]);
1528
+ unset($_SESSION[ 'mo2f_authy_keys' ]);
1529
+ delete_user_meta($current_user->ID,'mo2f_configure_test_option');
1530
+ }
1531
+
1532
+ if(isset($_POST['option']) && $_POST['option'] == 'mo2f_2factor_configure_kba_backup'){
1533
+ $_SESSION['mo2f_mobile_support'] = 'MO2F_EMAIL_BACKUP_KBA';
1534
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_CONFIGURE');
1535
+ update_user_meta($current_user->ID,'mo2f_selected_2factor_method','KBA');
1536
+ }
1537
+
1538
+ }
1539
+
1540
+ function miniorange_email_verification_call($current_user){
1541
+ $challengeMobile = new Customer_Setup();
1542
+ $email = get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true);
1543
+ $content = $challengeMobile->send_otp_token($email, 'OUT OF BAND EMAIL',get_option('mo2f_customerKey'),get_option('mo2f_api_key'));
1544
+ $response = json_decode($content, true);
1545
+ if(json_last_error() == JSON_ERROR_NONE) { /* Generate out of band email */
1546
+ if($response['status'] == 'ERROR'){
1547
+ update_option( 'mo2f_message', $response['message']);
1548
+ $this->mo_auth_show_error_message();
1549
+ }else{
1550
+ if($response['status'] == 'SUCCESS'){
1551
+
1552
+ $_SESSION[ 'mo2f_transactionId' ] = $response['txId'];
1553
+ update_option( 'mo2f_message','A verification email is sent to<b> '. $email . '</b>. Please click on accept link to verify your email.');
1554
+ update_user_meta($current_user->ID,'mo2f_configure_test_option','MO2F_TEST');
1555
+ update_user_meta( $current_user->ID,'mo2f_selected_2factor_method', 'OUT OF BAND EMAIL');
1556
+ $this->mo_auth_show_success_message();
1557
+ }else{
1558
+ unset($_SESSION[ 'mo2f_transactionId' ]);
1559
+ update_option( 'mo2f_message','An error occured while processing your request. Please Try again.');
1560
+ $this->mo_auth_show_error_message();
1561
+ }
1562
+ }
1563
+ }else{
1564
+ update_option( 'mo2f_message','Invalid request. Please try again');
1565
+ $this->mo_auth_show_error_message();
1566
+ }
1567
+ }
1568
+
1569
+ function mo2f_create_customer($current_user){
1570
+ delete_user_meta($current_user->ID,'mo2f_sms_otp_count');
1571
+ delete_user_meta($current_user->ID,'mo2f_email_otp_count');
1572
+ $customer = new Customer_Setup();
1573
+ $customerKey = json_decode($customer->create_customer(), true);
1574
+ if($customerKey['status'] == 'ERROR'){
1575
+ update_option( 'mo2f_message', $customerKey['message']);
1576
+ $this->mo_auth_show_error_message();
1577
+ }else{
1578
+ if(strcasecmp($customerKey['status'], 'CUSTOMER_USERNAME_ALREADY_EXISTS') == 0) { //admin already exists in miniOrange
1579
+ $content = $customer->get_customer_key();
1580
+ $customerKey = json_decode($content, true);
1581
+ if(json_last_error() == JSON_ERROR_NONE) {
1582
+ if(array_key_exists("status", $customerKey) && $customerKey['status'] == 'ERROR'){
1583
+ update_option('mo2f_message',$customerKey['message']);
1584
+ $this->mo_auth_show_error_message();
1585
+ }else{
1586
+ if(isset($customerKey['id']) && !empty($customerKey['id'])){
1587
+ update_option( 'mo2f_customerKey', $customerKey['id']);
1588
+ update_option( 'mo2f_api_key', $customerKey['apiKey']);
1589
+ update_option( 'mo2f_customer_token', $customerKey['token']);
1590
+ update_option( 'mo2f_app_secret', $customerKey['appSecret'] );
1591
+ update_option( 'mo2f_miniorange_admin',$current_user->ID);
1592
+ update_option( 'mo2f_new_customer',true);
1593
+ delete_option('mo2f_password');
1594
+ update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
1595
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1596
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option('mo2f_email'));
1597
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1598
+ $enduser = new Two_Factor_Setup();
1599
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
1600
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1601
+ update_option( 'mo2f_message', 'Your account has been retrieved successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.');
1602
+ $this->mo_auth_show_success_message();
1603
+ }else{
1604
+ update_option( 'mo2f_message', 'An error occured while creating your account. Please try again by sending OTP again.');
1605
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
1606
+ $this->mo_auth_show_error_message();
1607
+ }
1608
+
1609
+ }
1610
+
1611
+ } else {
1612
+ update_option( 'mo2f_message', 'Invalid email or password. Please try again.');
1613
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_VERIFY_CUSTOMER');
1614
+ $this->mo_auth_show_error_message();
1615
+ }
1616
+ }else{
1617
+ if(isset($customerKey['id']) && !empty($customerKey['id'])){
1618
+ update_option( 'mo2f_customerKey', $customerKey['id']);
1619
+ update_option( 'mo2f_api_key', $customerKey['apiKey']);
1620
+ update_option( 'mo2f_customer_token', $customerKey['token']);
1621
+ update_option( 'mo2f_app_secret', $customerKey['appSecret'] );
1622
+ update_option( 'mo2f_miniorange_admin',$current_user->ID);
1623
+ delete_option('mo2f_password');
1624
+ update_option( 'mo2f_new_customer',true);
1625
+ update_option( 'mo_2factor_admin_registration_status','MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS');
1626
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1627
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',get_option('mo2f_email'));
1628
+ update_option( 'mo2f_message', 'Your account has been created successfully. ');
1629
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1630
+ $enduser = new Two_Factor_Setup();
1631
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
1632
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1633
+ update_option( 'mo2f_message', 'Your account has been created successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.');
1634
+ $this->mo_auth_show_success_message();
1635
+ header('Location: admin.php?page=miniOrange_2_factor_settings&mo2f_tab=mo2f_pricing');
1636
+ }else{
1637
+ update_option( 'mo2f_message', 'An error occured while creating your account. Please try again by sending OTP again.');
1638
+ update_user_meta($current_user->ID, 'mo_2factor_user_registration_status','MO_2_FACTOR_OTP_DELIVERED_FAILURE');
1639
+ $this->mo_auth_show_error_message();
1640
+ }
1641
+
1642
+ }
1643
+ }
1644
+ }
1645
+
1646
+ function mo2f_create_user($current_user,$email){
1647
+ $email = strtolower($email);
1648
+ $enduser = new Two_Factor_Setup();
1649
+ $check_user = json_decode($enduser->mo_check_user_already_exist($email),true);
1650
+ if(json_last_error() == JSON_ERROR_NONE){
1651
+ if($check_user['status'] == 'ERROR'){
1652
+ update_option( 'mo2f_message', $check_user['message']);
1653
+ $this->mo_auth_show_error_message();
1654
+ }else{
1655
+ if(strcasecmp($check_user['status'], 'USER_FOUND') == 0){
1656
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
1657
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1658
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',$email);
1659
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1660
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
1661
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1662
+ $message = 'You are registered successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.';
1663
+ update_option( 'mo2f_message', $message);
1664
+ $this->mo_auth_show_success_message();
1665
+ }else if(strcasecmp($check_user['status'], 'USER_NOT_FOUND') == 0){
1666
+ $content = json_decode($enduser->mo_create_user($current_user,$email), true);
1667
+ if(json_last_error() == JSON_ERROR_NONE) {
1668
+ if($content['status'] == 'ERROR'){
1669
+ update_option( 'mo2f_message', $content['message']);
1670
+ $this->mo_auth_show_error_message();
1671
+ }else{
1672
+ if(strcasecmp($content['status'], 'SUCCESS') == 0) {
1673
+ delete_user_meta($current_user->ID,'mo_2factor_user_email');
1674
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_with_miniorange','SUCCESS');
1675
+ update_user_meta($current_user->ID,'mo_2factor_map_id_with_email',$email);
1676
+ update_user_meta($current_user->ID,'mo_2factor_user_registration_status','MO_2_FACTOR_PLUGIN_SETTINGS');
1677
+ $enduser->mo2f_update_userinfo(get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true), 'OUT OF BAND EMAIL',null,'API_2FA',true);
1678
+ update_user_meta($current_user->ID,'mo2f_email_verification_status',true);
1679
+ $message = 'You are registered successfully. <b>Email Verification</b> has been set as your default 2nd factor method. <a href=\"admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mobile_configure\" >Click Here </a>to configure another 2nd factor authentication method.';
1680
+ update_option( 'mo2f_message', $message);
1681
+ $this->mo_auth_show_success_message();
1682
+
1683
+ }else{
1684
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1685
+ $this->mo_auth_show_error_message();
1686
+ }
1687
+ }
1688
+ }else{
1689
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again or contact your admin.');
1690
+ $this->mo_auth_show_error_message();
1691
+ }
1692
+ }else{
1693
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1694
+ $this->mo_auth_show_error_message();
1695
+ }
1696
+ }
1697
+ }else{
1698
+ update_option( 'mo2f_message','Error occurred while registering the user. Please try again.');
1699
+ $this->mo_auth_show_error_message();
1700
+ }
1701
+ }
1702
+
1703
+ function mo2f_get_qr_code_for_mobile($email,$id){
1704
+ $registerMobile = new Two_Factor_Setup();
1705
+ $content = $registerMobile->register_mobile($email);
1706
+ $response = json_decode($content, true);
1707
+ if(json_last_error() == JSON_ERROR_NONE) {
1708
+ if($response['status'] == 'ERROR'){
1709
+ update_option( 'mo2f_message', $response['message']);
1710
+ unset($_SESSION[ 'mo2f_qrCode' ]);
1711
+ unset($_SESSION[ 'mo2f_transactionId' ]);
1712
+ unset($_SESSION[ 'mo2f_show_qr_code']);
1713
+ $this->mo_auth_show_error_message();
1714
+ }else{
1715
+ if($response['status'] == 'IN_PROGRESS'){
1716
+ update_option( 'mo2f_message','Please scan the QR Code now.');
1717
+ $_SESSION[ 'mo2f_qrCode' ] = $response['qrCode'];
1718
+ $_SESSION[ 'mo2f_transactionId' ] = $response['txId'];
1719
+ $_SESSION[ 'mo2f_show_qr_code'] = 'MO_2_FACTOR_SHOW_QR_CODE';
1720
+ $this->mo_auth_show_success_message();
1721
+ }else{
1722
+ update_option( 'mo2f_message', "An error occured while processing your request. Please Try again.");
1723
+ unset($_SESSION[ 'mo2f_qrCode' ]);
1724
+ unset($_SESSION[ 'mo2f_transactionId' ]);
1725
+ unset($_SESSION[ 'mo2f_show_qr_code']);
1726
+ $this->mo_auth_show_error_message();
1727
+ }
1728
+ }
1729
+ }
1730
+ }
1731
+
1732
+ public function mo_get_2fa_shorcode($atts){
1733
+ if(!is_user_logged_in() && mo2f_is_customer_registered()){
1734
+ $mo2f_shorcode = new MO2F_ShortCode();
1735
+ $html = $mo2f_shorcode->mo2FAFormShortCode($atts);
1736
+ return $html;
1737
+ }
1738
+ }
1739
+
1740
+ public function mo_get_login_form_shortcode($atts){
1741
+ if(!is_user_logged_in() && mo2f_is_customer_registered()){
1742
+ $mo2f_shorcode = new MO2F_ShortCode();
1743
+ $html = $mo2f_shorcode->mo2FALoginFormShortCode($atts);
1744
+ return $html;
1745
+ }
1746
+ }
1747
+ }
1748
+
1749
+ function mo2f_is_customer_registered() {
1750
+ $email = get_option('mo2f_email');
1751
+ $customerKey = get_option('mo2f_customerKey');
1752
+ if(!$email || !$customerKey || !is_numeric(trim($customerKey))) {
1753
+ return 0;
1754
+ } else {
1755
+ return 1;
1756
+ }
1757
+ }
1758
+
1759
+ new Miniorange_Authentication;
1760
+ ?>
miniorange_2_factor_support.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function mo2f_support(){
4
+ global $wpdb;
5
+ global $current_user;
6
+ $current_user = wp_get_current_user();
7
+ ?>
8
+ <div class="mo2f_support_layout">
9
+ <h3>Support</h3>
10
+ <form name="f" method="post" action="">
11
+ <div>Need any help? Just send us a query so we can help you. <br /><br /></div>
12
+ <div>
13
+ <table style="width:95%;">
14
+ <tr><td>
15
+ <input type="email" class="mo2f_table_textbox" id="query_email" name="query_email" value="<?php echo get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true) ? get_user_meta($current_user->ID,'mo_2factor_map_id_with_email',true) : $current_user->user_email; ?>" placeholder="Enter your email" required="true" />
16
+ </td>
17
+ </tr>
18
+ <tr><td>
19
+ <input type="text" class="mo2f_table_textbox" style="width:100% !important;" name="query_phone" id="query_phone" value="<?php echo get_user_meta($current_user->ID,'mo2f_user_phone',true); ?>" placeholder="Enter your phone"/>
20
+ </td>
21
+ </tr>
22
+ <tr>
23
+ <td>
24
+ <textarea id="query" name="query" style="resize: vertical;border-radius:4px;width:100%;height:143px;" onkeyup="mo2f_valid(this)" onblur="mo2f_valid(this)" onkeypress="mo2f_valid(this)" placeholder="Write your query here"></textarea>
25
+ </td>
26
+ </tr>
27
+ </table>
28
+ </div>
29
+ <input type="hidden" name="option" value="mo_2factor_send_query"/>
30
+ <input type="submit" name="send_query" id="send_query" value="Submit Query" style="margin-bottom:3%;" class="button button-primary button-large" />
31
+ </form>
32
+ <br />
33
+ </div>
34
+ <br>
35
+
36
+ <script>
37
+ jQuery("#query_phone").intlTelInput();
38
+ function mo2f_valid(f) {
39
+ !(/^[a-zA-Z?,.\(\)\/@ 0-9]*$/).test(f.value) ? f.value = f.value.replace(/[^a-zA-Z?,.\(\)\/@ 0-9]/, '') : null;
40
+ }
41
+ </script>
42
+ <?php
43
+ }
44
+ ?>
miniorange_2_factor_troubleshooting.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function mo2f_show_help_and_troubleshooting($current_user) {
3
+ ?>
4
+ <div class="mo2f_table_layout">
5
+ <?php echo mo2f_check_if_registered_with_miniorange($current_user); ?>
6
+ <br>
7
+ <ul class="mo2f_faqs">
8
+ <?php if(current_user_can( 'manage_options' )) { ?>
9
+
10
+ <h3><a data-toggle="collapse" href="#question0" aria-expanded="false" ><li>I am getting the fatal error of call to undefined function json_last_error(). What should I do?</li></a></h3>
11
+ <div class="mo2f_collapse" id="question0">
12
+ Please check your php version. The plugin is supported in php version 5.3.0 or above. You need to upgrade your php version to 5.3.0 or above to use the plugin.
13
+ For any further queries, please submit a query on right hand side in our <b>Support Section</b>.
14
+
15
+ </div>
16
+ <hr>
17
+
18
+ <h3><a data-toggle="collapse" href="#question1" aria-expanded="false" ><li>How to enable PHP cURL extension? (Pre-requisite)</li></a></h3>
19
+ <div class="mo2f_collapse" id="question1">
20
+ cURL is enabled by default but in case you have disabled it, follow the steps to enable
21
+ <ol>
22
+ <li>Open php.ini(it's usually in /etc/ or in php folder on the server).</li>
23
+ <li>Search for extension=php_curl.dll. Uncomment it by removing the semi-colon( ; ) in front of it.</li>
24
+ <li>Restart the Apache Server.</li>
25
+ </ol>
26
+ For any further queries, please submit a query on right hand side in our <b>Support Section</b>.
27
+
28
+ </div>
29
+ <hr>
30
+ <h3><a data-toggle="collapse" href="#question2" aria-expanded="false" ><li>I am getting error - curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set.
31
+ </li></a></h3>
32
+ <div class="mo2f_collapse" id="question2">
33
+ Just setsafe_mode = Off in your php.ini file (it's usually in /etc/ on the server). If that's already off, then look around for the open_basedir in the php.ini file, and change it to open_basedir = .
34
+ </div>
35
+ <hr>
36
+ <h3><a data-toggle="collapse" href="#question3" aria-expanded="false" ><li>I did not recieve OTP while trying to register with miniOrange. What should I do?
37
+ </li></a></h3>
38
+ <div class="mo2f_collapse" id="question3">
39
+ The OTP is sent to your email address with which you have registered with miniOrange. If you can't see the email from miniOrange in your mails, please make sure to check your <b>SPAM folder</b>. If you don't see an email even in SPAM folder, please submit a query on right hand side in our <b>Support Section</b> or you can contact us at info@miniorange.com.
40
+ </div>
41
+ <hr>
42
+ <h3><a data-toggle="collapse" href="#question4" aria-expanded="false" ><li>I forgot the password of my miniOrange account. How can I reset it?
43
+ </li></a></h3>
44
+ <div class="mo2f_collapse" id="question4">
45
+ There are two cases according to the page you see -
46
+ <ul>
47
+ <li>1. <b>Login with miniOrange screen:</b> You should click on forgot password link. You will get a new password on your email address with which you have registered with miniOrange . Now you can login with the new password.</li><br>
48
+ <li>2. <b>Register with miniOrange screen:</b> Enter your email ID and any random password in password and confirm password input box. This will redirect you to Login with miniOrange screen. Now follow first step.</li>
49
+ </ul>
50
+
51
+ </div>
52
+ <hr>
53
+ <h3><a data-toggle="collapse" href="#question5" aria-expanded="false" ><li>I have a custom / front-end login page on my site and I want the look and feel to remain the same when I add 2 factor ?</li></a></h3>
54
+ <div class="mo2f_collapse" id="question5">
55
+ If you have a custom login form other than wp-login.php then we will provide you the shortcode. We are not claiming that it will work with all the customized login page. In such case, custom work is needed to integrate two factor with your customized login page. You can submit a query in our <b>Support Section</b> on right hand side for more details.
56
+ </div>
57
+ <hr>
58
+ <h3><a data-toggle="collapse" href="#question6" aria-expanded="false" ><li>I have Woocommerce theme login page on my site. How can I enable Two Factor ?</li></a></h3>
59
+ <div class="mo2f_collapse" id="question6">
60
+ If you have Woocommerce theme login then go to Advanced Options Tab and check <b>Enable Two-Factor for Woocommerce Front End Login</b>. If you need any help setting up 2-Factor for your Woocommerce theme login form, please submit a query in our <b>Support Section</b> on right hand side.
61
+ </div>
62
+ <hr>
63
+ <h3><a data-toggle="collapse" href="#question21" aria-expanded="false" ><li>I have installed plugins which limit the login attempts like Limit Login Attempt, Loginizer, Wordfence etc. Is there any incompatibilities with these kind of plugins?</li></a></h3>
64
+ <div class="mo2f_collapse" id="question21">
65
+ The limit login attempt kind of plugins limit the number of login attempts and block the IP temporarily. So if you are using 2 factor along with these kind of plugins then you should increase the login attempts (minimum 5) so that you dont get locked out yourself.
66
+ </div>
67
+ <hr>
68
+ <h3><a data-toggle="collapse" href="#question7" aria-expanded="false" ><li>I am trying to login with Two-Factor but my screen got blank after entering username and password. I am locked out of my account. What to do now ?</li></a></h3>
69
+ <div class="mo2f_collapse" id="question7">
70
+ If you have an additional administrator account whose Two Factor is not enabled yet. Login with it. Otherwise,
71
+ Go to WordPress Database. Select wp_options, search for mo2f_activate_plugin key and update its value to 0. Two Factor will get disabled.
72
+ </div>
73
+ <hr>
74
+ <h3><a data-toggle="collapse" href="#question8" aria-expanded="false" ><li>If you are using any Security Plugin in WordPress like Simple Security Firewall, All in One WP Security Plugin and you are not able to login with Two-Factor.</li></a></h3>
75
+ <div class="mo2f_collapse" id="question8">
76
+ Our Two-Factor plugin is compatible with most of the security plugins, but if it is not working for you.
77
+ Please submit a query in our <b>Support Section</b> on right hand side or you can contact us at <b>info@miniorange.com</b>.
78
+ </div>
79
+ <hr>
80
+ <h3><a data-toggle="collapse" href="#question9" aria-expanded="false" ><li>If you are using any render blocking javascript and css plugin like Async JS and CSS Plugin and you are not able to login with Two-Factor or your screen got blank.</li></a></h3>
81
+ <div class="mo2f_collapse" id="question9">
82
+ If you are using <b>Async JS and CSS Plugin</b>. Please go to its settings and add jquery in the list of exceptions and save settings. It will work. If you are still not able to get it right,
83
+ Please submit a query in our <b>Support Section</b> on right hand side or you can contact us at <b>info@miniorange.com</b>.
84
+ </div>
85
+ <hr>
86
+ <h3><a data-toggle="collapse" href="#question10" aria-expanded="false" ><li>I want to enable 2-factor only for administrators ?</li></a></h3>
87
+ <div class="mo2f_collapse" id="question10">
88
+ 2-Factor is enabled by default for administrators on plugin activation. You just need to complete your account setup and configure your mobile from <b>Configure Mobile Tab</b>. Once this is done administrators can login using 2-Factor and other users can still login with their password.
89
+ </div>
90
+ <hr>
91
+ <h3><a data-toggle="collapse" href="#question11" aria-expanded="false" ><li>I want to enable 2 factor for administrators and end users ?</li></a></h3>
92
+ <div class="mo2f_collapse" id="question11">
93
+ Go to <b>Login Settings Tab</b> and check <b>Enable 2-Factor for all other users</b>. Enable 2-Factor for admins is checked by default.
94
+ </div>
95
+ <hr>
96
+
97
+ <h3><a data-toggle="collapse" href="#question12" aria-expanded="false" ><li>My phone has no internet connectivity, how can I login?</li></a></h3>
98
+ <div class="mo2f_collapse" id="question12">
99
+ You can login using our alternate login method. Please follow below steps to login or <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#myCarousel2">click here</a> to see how it works.<br>
100
+ <br><ol>
101
+ <li>Enter your username and click on login with your phone.</li>
102
+ <li>Click on <b>Phone is Offline?</b> button below QR Code.</li>
103
+ <li>You will see a textbox to enter one time passcode.</li>
104
+ <li>Open miniOrange Authenticator app and Go to Soft Token Tab.</li>
105
+ <li>Enter the one time passcode shown in miniOrange Authenticator app in textbox.</li>
106
+ <li>Click on submit button to validate the otp.</li>
107
+ <li>Once you are authenticated, you will be logged in.</li>
108
+ </ol>
109
+ </div>
110
+ <hr>
111
+ <h3><a data-toggle="collapse" href="#question13" aria-expanded="false" ><li>My users have different types of phones. What phones are supported?</li></a></h3>
112
+ <div class="mo2f_collapse" id="question13">
113
+ We support all types of phone. Smart Phones, Basic Phones, Landlines, etc. Go to Setup Two-Factor Tab and select Two-Factor method of your choice from a range of 6 different options.
114
+ </div>
115
+ <hr>
116
+ <h3><a data-toggle="collapse" href="#question14" aria-expanded="false" ><li>What if a user does not have a smart phone?</li></a></h3>
117
+ <div class="mo2f_collapse" id="question14">
118
+ You can select OTP over SMS, Phone Call Verification or Email Verification as your Two-Factor method. All these methods are supported on basic phones.
119
+ </div>
120
+ <hr>
121
+ <?php }?>
122
+ <h3><a data-toggle="collapse" href="#question15" aria-expanded="false" ><li>What if I am trying to login from my phone ?</li></a></h3>
123
+ <div class="mo2f_collapse" id="question15">
124
+ If you are logging in from your phone, just enter the one time passcode from miniOrange Authenticator App.
125
+ Go to Soft Token Tab to see one time passcode.
126
+ </div>
127
+ <hr>
128
+ <?php if(current_user_can( 'manage_options' )) { ?>
129
+
130
+
131
+ <h3><a data-toggle="collapse" href="#question16" aria-expanded="false" ><li>I want to hide default login form and just want to show login with phone?</li></a></h3>
132
+ <div class="mo2f_collapse" id="question16">
133
+ You should go to <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_login">Login Settings Tab</a> and check <b>I want to hide default login form.</b> checkbox to hide the default login form.
134
+
135
+
136
+ </div>
137
+ <hr>
138
+ <?php }?>
139
+ <h3><a data-toggle="collapse" href="#question18" aria-expanded="false" ><li>My phone is lost, stolen or discharged. How can I login?</li></a></h3>
140
+ <div class="mo2f_collapse" id="question18">
141
+ You can login using our alternate login method. Please follow below steps to login or <a href="admin.php?page=miniOrange_2_factor_settings&amp;mo2f_tab=mo2f_demo#myCarousel3">click here</a> to see how it works.
142
+ <br><br>
143
+ <ol>
144
+ <li>Enter your username and click on login with your phone.</li>
145
+ <li>Click on <b>Forgot Phone?</b> button below QR Code.</li>
146
+ <li>You will see a textbox to enter one time passcode.</li>
147
+ <li>Check your registered email and copy the one time passcode in this textbox.</li>
148
+ <li>Click on submit button to validate the otp.</li>
149
+ <li>Once you are authenticated, you will be logged in.</li>
150
+ </ol>
151
+ </div>
152
+ <hr>
153
+ <h3><a data-toggle="collapse" href="#question19" aria-expanded="false" ><li>My phone has no internet connectivity and i am entering the one time passcode from miniOrange Authenticator App, it says Invalid OTP.</li></a></h3>
154
+ <div class="mo2f_collapse" id="question19">
155
+ Click on the <b>Settings Icon</b> on top right corner in <b>miniOrange Authenticator App</b> and then press <b>Sync button</b> under 'Time correction for codes' to sync your time with miniOrange Servers. If you still can't get it right, submit a query here in our <b>support section</b>.<br><br>
156
+ </div>
157
+ <hr>
158
+ <?php if(current_user_can( 'manage_options' )) { ?>
159
+
160
+
161
+ <h3><a data-toggle="collapse" href="#question20" aria-expanded="false" ><li>I want to go back to default login with password.</li></a></h3>
162
+ <div class="mo2f_collapse" id="question20">
163
+ You can disable Two Factor from Login settings Tab by unchecking Enable Two Factor Plugin checkbox.
164
+ </div>
165
+ <hr>
166
+
167
+
168
+
169
+
170
+
171
+ <h3><a>For any other query/problem/request, please feel free to submit a query in our support section on right hand side. We are happy to help you and will get back to you as soon as possible.</a></h3>
172
+ <?php }?>
173
+ </ul>
174
+
175
+ </div>
176
+ <?php } ?>
miniorange_2_factor_user_inline_registration.php ADDED
@@ -0,0 +1,964 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ include_once dirname( __FILE__ ) . '/miniorange_2_factor_mobile_configuration.php';
4
+
5
+
6
+ function prompt_user_to_register(){ ?>
7
+ <div class="miniorange_kba_page">
8
+ <center>
9
+ <div class="miniorange-inner-kba-login-container">
10
+
11
+ <h2 class="mo_header_background" >Setup Two Factor</h2>
12
+ <br>
13
+ <p><?php echo $_SESSION['mo2f-login-message']; ?></p>
14
+ <br>
15
+ A new security system has been enabled to better protect your account. Please configure your Two-Factor Authentication method by setting up your account.
16
+ <br><br>
17
+
18
+ <input type="email" autofocus="true" name="mo_useremail" id="mo_useremail" class="mo_email_textbox" required placeholder="person@example.com" />
19
+
20
+ <br><br>
21
+ <input type="button" name="miniorange_get_started" onclick="mouserregistersubmit();" class="miniorange-button" value="Get Started" />
22
+ <?php if( !get_option('mo2f_inline_registration')){ ?>
23
+ <input type="button" name="mo2f_skip_btn" onclick="moskipregistersubmit();" class="miniorange-button" value="Skip" />
24
+ <?php } ?>
25
+ <br><br>
26
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
27
+ <br><br>
28
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
29
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
30
+ <?php }?>
31
+
32
+ </div>
33
+
34
+ </center>
35
+
36
+ </div>
37
+ <script>
38
+ jQuery("div#login").hide();
39
+ jQuery("body.login div#login").before(jQuery('.miniorange_kba_page'));
40
+ function mologinback(){
41
+ jQuery('#mo2f_backto_mo_loginform').submit();
42
+ }
43
+ function mouserregistersubmit(){
44
+ var userEmail = jQuery('#mo_useremail').val();
45
+ document.getElementById("mo2f_inline_register_user_form").elements[0].value = userEmail;
46
+ jQuery('#mo2f_inline_register_user_form').submit();
47
+
48
+ }
49
+
50
+ jQuery('#mo_useremail').keypress(function(e){
51
+ if(e.which == 13){//Enter key pressed
52
+ e.preventDefault();
53
+ var userEmail = jQuery('#mo_useremail').val();
54
+ document.getElementById("mo2f_inline_register_user_form").elements[0].value = userEmail;
55
+ jQuery('#mo2f_inline_register_user_form').submit();
56
+ }
57
+
58
+ });
59
+ function moskipregistersubmit(){
60
+ jQuery('#mo2f_inline_register_skip_form').submit();
61
+ }
62
+ </script>
63
+ <?php }
64
+
65
+ function prompt_user_for_validate_otp(){ ?>
66
+ <div class="miniorange_soft_auth">
67
+ <center>
68
+ <div class="miniorange-inner-login-container">
69
+
70
+ <h2 class="mo_header_background">Verify Your Email</h2>
71
+ <br>
72
+ <div style="padding-left:10px;padding-right:10px;"><?php echo isset($_SESSION['mo2f-login-message']) ? $_SESSION['mo2f-login-message'] : '';?></div><br/>
73
+ <div style="padding-left:40px;padding-right:40px;">
74
+ <input autofocus="true" type="text" name="otp_token" id="otp_token" required placeholder="Enter OTP" />
75
+
76
+ <a href="#resendinlineotplink">Resend OTP ?</a>
77
+ <input type="button" name="back" id="mo2f_inline_backto_regform" style="margin-left:20px;" class="miniorange-button" value="Back" />
78
+ <input type="button" name="miniorange_validtae_otp" style="float:right;" value="Validate OTP" class="miniorange-button" onclick="movalidateotpsubmit();" />
79
+ </div>
80
+
81
+
82
+
83
+ <br><br>
84
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
85
+ <br><br>
86
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
87
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
88
+ <?php }?>
89
+
90
+ </div>
91
+
92
+ </center>
93
+
94
+ </div>
95
+ <script>
96
+ jQuery("div#login").hide();
97
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
98
+ function mologinback(){
99
+ jQuery('#mo2f_backto_mo_loginform').submit();
100
+ }
101
+ function movalidateotpsubmit(){
102
+ var otp = jQuery('#otp_token').val();
103
+ document.getElementById("mo2f_inline_user_validate_otp_form").elements[0].value = otp;
104
+ jQuery('#mo2f_inline_user_validate_otp_form').submit();
105
+ }
106
+
107
+ jQuery('#otp_token').keypress(function(e){
108
+ if(e.which == 13){//Enter key pressed
109
+ e.preventDefault();
110
+ var otp = jQuery('#otp_token').val();
111
+ document.getElementById("mo2f_inline_user_validate_otp_form").elements[0].value = otp;
112
+ jQuery('#mo2f_inline_user_validate_otp_form').submit();
113
+ }
114
+
115
+ });
116
+ jQuery('a[href=\"#resendinlineotplink\"]').click(function(e) {
117
+ jQuery('#mo2fa_inline_resend_otp_form').submit();
118
+ });
119
+ jQuery('#mo2f_inline_backto_regform').click(function() {
120
+ jQuery('#mo2f_goto_user_registration_form').submit();
121
+ });
122
+ </script>
123
+ <?php }
124
+
125
+ function prompt_user_to_select_2factor_method($current_user){
126
+ $current_selected_method = get_user_meta($current_user,'mo2f_selected_2factor_method',true);
127
+ if($current_selected_method == 'MOBILE AUTHENTICATION'
128
+ || $current_selected_method == 'SOFT TOKEN'
129
+ || $current_selected_method == 'PUSH NOTIFICATIONS'){
130
+
131
+ prompt_user_for_miniorange_app_setup($current_user);
132
+
133
+ }else if($current_selected_method == 'SMS'
134
+ || $current_selected_method == 'PHONE VERIFICATION'){
135
+
136
+ prompt_user_for_phone_setup($current_user);
137
+
138
+ }else if($current_selected_method == 'GOOGLE AUTHENTICATOR' ){
139
+
140
+ prompt_user_for_google_authenticator_setup($current_user);
141
+
142
+ }else if($current_selected_method == 'AUTHY 2-FACTOR AUTHENTICATION'){
143
+
144
+ prompt_user_for_authy_authenticator_setup($current_user);
145
+
146
+ }else if($current_selected_method == 'KBA' ){
147
+
148
+ prompt_user_for_kba_setup($current_user);
149
+
150
+ }else if($current_selected_method == 'OUT OF BAND EMAIL' ){
151
+
152
+ prompt_user_for_setup_success($current_user);
153
+
154
+ }else{
155
+ $opt = (array) get_option('mo2f_auth_methods_for_users'); ?>
156
+ <div class="miniorange_soft_auth">
157
+
158
+ <div class="miniorange-inner-kba-login-container" >
159
+
160
+ <h2 class="mo_header_background">Select Two Factor Method</h2>
161
+ <br>
162
+ <div class="mo_margin_left">
163
+
164
+ <b>Select any Two-Factor of your choice below and complete its setup.</b>
165
+ <br><br>
166
+ <span class="<?php if( !(in_array("OUT OF BAND EMAIL", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
167
+ <label title="You will receive an email with link. You have to click the ACCEPT or DENY link to verify your email. Supported in Desktops, Laptops, Smartphones.">
168
+ <input type="radio" name="mo2f_selected_2factor_method" value="OUT OF BAND EMAIL" />
169
+ Email Verification
170
+ </label>
171
+ <br>
172
+ </span>
173
+
174
+ <span class="<?php if( !(in_array("SMS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
175
+
176
+ <label title="You will receive a one time passcode via SMS on your phone. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones.">
177
+ <input type="radio" name="mo2f_selected_2factor_method" value="SMS" />
178
+ OTP Over SMS
179
+ </label>
180
+ <br>
181
+ </span>
182
+
183
+ <span class="<?php if( !(in_array("PHONE VERIFICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>">
184
+
185
+ <label title="You will receive a phone call telling a one time passcode. You have to enter the one time passcode to login. Supported in Landlines, Smartphones, Feature phones.">
186
+ <input type="radio" name="mo2f_selected_2factor_method" value="PHONE VERIFICATION" />
187
+ Phone Call Verification
188
+ </label>
189
+ <br>
190
+ </span>
191
+
192
+ <span class="<?php if( !(in_array("SOFT TOKEN", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
193
+ <label title="You have to enter 6 digits code generated by miniOrange Authenticator App like Google Authenticator code to login. Supported in Smartphones only." >
194
+ <input type="radio" name="mo2f_selected_2factor_method" value="SOFT TOKEN" />
195
+ Soft Token
196
+ </label>
197
+
198
+ <br>
199
+ </span>
200
+
201
+ <span class="<?php if( !(in_array("MOBILE AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
202
+
203
+ <label title="You have to scan the QR Code from your phone using miniOrange Authenticator App to login. Supported in Smartphones only.">
204
+ <input type="radio" name="mo2f_selected_2factor_method" value="MOBILE AUTHENTICATION" />
205
+ QR Code Authentication
206
+ </label>
207
+ <br>
208
+ </span>
209
+
210
+ <span class="<?php if( !(in_array("PUSH NOTIFICATIONS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
211
+
212
+ <label title="You will receive a push notification on your phone. You have to ACCEPT or DENY it to login. Supported in Smartphones only.">
213
+ <input type="radio" name="mo2f_selected_2factor_method" value="PUSH NOTIFICATIONS" />
214
+ Push Notification
215
+ </label>
216
+ <br>
217
+ </span>
218
+ <span class="<?php if( !(in_array("GOOGLE AUTHENTICATOR", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
219
+
220
+ <label title="You have to enter 6 digits code generated by Google Authenticator App to login. Supported in Smartphones only.">
221
+ <input type="radio" name="mo2f_selected_2factor_method" value="GOOGLE AUTHENTICATOR" />
222
+ Google Authenticator
223
+ </label>
224
+ <br>
225
+ </span>
226
+ <span class="<?php if( !(in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
227
+
228
+ <label title="You have to enter 6 digits code generated by Authy 2-Factor Authentication App to login. Supported in Smartphones only.">
229
+ <input type="radio" name="mo2f_selected_2factor_method" value="AUTHY 2-FACTOR AUTHENTICATION" />
230
+ Authy 2-Factor Authentication
231
+ </label>
232
+ <br>
233
+ </span>
234
+
235
+ <span class="<?php if( !(in_array("KBA", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
236
+
237
+ <label title="You have to answers some knowledge based security questions which are only known to you to authenticate yourself. Supported in Desktops,Laptops,Smartphones." >
238
+ <input type="radio" name="mo2f_selected_2factor_method" value="KBA" />
239
+ Security Questions ( KBA )
240
+ </label>
241
+
242
+ </span>
243
+
244
+ <br><br>
245
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
246
+ <br><br>
247
+ </div>
248
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
249
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
250
+ <?php }?>
251
+
252
+ </div>
253
+
254
+
255
+ </div>
256
+ <script>
257
+ jQuery("div#login").hide();
258
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
259
+ function mologinback(){
260
+ jQuery('#mo2f_backto_mo_loginform').submit();
261
+ }
262
+ jQuery('input:radio[name=mo2f_selected_2factor_method]').click(function() {
263
+ var selectedMethod = jQuery(this).val();
264
+ document.getElementById("mo2f_select_2fa_methods_form").elements[0].value = selectedMethod;
265
+ jQuery('#mo2f_select_2fa_methods_form').submit();
266
+ });
267
+
268
+ </script>
269
+ <?php }
270
+ }
271
+
272
+ function prompt_user_for_authy_authenticator_setup($current_user){
273
+ $mo2f_authy_auth = isset($_SESSION['mo2f_authy_keys']) ? $_SESSION['mo2f_authy_keys'] : null;
274
+ $data = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_qrCode'] : null;
275
+ $authy_secret = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_secret'] : null;
276
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
277
+ ?>
278
+ <div class="miniorange_soft_auth">
279
+ <div class="miniorange-ga-setup-container">
280
+ <h2 class="mo_header_background">Set up Authy 2-Factor Authentication</h2>
281
+ <div class="mo_margin_left">
282
+ <br>
283
+ <?php echo $_SESSION['mo2f-login-message']; ?>
284
+ <table>
285
+ <tr>
286
+ <td style="vertical-align:top;width:30%;padding-right:15px">
287
+ <h3>Step-1: Configure with Authy</h3><h3>2-Factor Authentication App.</h3><br /><hr />
288
+ <br /><input type="button" name="mo2f_authy_configure" id="mo2f_authy_configure" class="miniorange-button" style="width:45%;" value="Configure" /><br /><br />
289
+ <?php if (sizeof($opt) > 1) { ?>
290
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
291
+ <?php } ?>
292
+
293
+
294
+ </td>
295
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
296
+ <td style="width:46%;padding-right:15px;vertical-align:top;">
297
+ <h3>Step-2: Set up Authy 2-Factor Authentication App</h3><h3>&nbsp; </h3><br /><hr>
298
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
299
+ <h4>Install the Authy 2-Factor Authentication App.</h4>
300
+ <h4>Now open and configure Authy 2-Factor Authentication App.</h4>
301
+ <h4> Tap on Add Account and then tap on SCAN QR CODE in your App and scan the qr code.</h4>
302
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div>
303
+ <div><a data-toggle="collapse" href="#mo2f_authy_scan" aria-expanded="false" ><b>Can't scan the QR Code? </b></a></div></center>
304
+ <div class="mo2f_collapse mo_margin_left" id="mo2f_authy_scan" >
305
+ <ol>
306
+ <li>In Authy 2-Factor Authentication App, tap on ENTER KEY MANUALLY."</li>
307
+ <li>In "Adding New Account" type your secret key:</li>
308
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
309
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
310
+ <?php echo $authy_secret; ?>
311
+ </div>
312
+ <div style="font-size: 80%;color: #666666;">
313
+ Spaces don't matter.
314
+ </div>
315
+ </div>
316
+ <li>Tap OK.</li>
317
+ </ol>
318
+ </div>
319
+ </div>
320
+ </td>
321
+ <td style="border-left: 1px solid #EBECEC; padding: 5px;"></td>
322
+ <td style="vertical-align:top;width:30%">
323
+ <h3>Step-3: Verify and Save</h3><h3>&nbsp;</h3><br /><hr>
324
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
325
+ <h4>Once you have scanned the qr code, enter the verification code generated by the Authenticator app</h4><br/>
326
+
327
+ <span><b>Code: </b>
328
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" required="true" type="text" id="authy_token" name="authy_token" placeholder="Enter OTP" style="width:95%;"/></span><br />
329
+ <input type="button" name="validate" id="mo2f_authy_validate" class="miniorange-button" value="Verify and Save" />
330
+ </div>
331
+ </td>
332
+ </tr><br>
333
+ </table>
334
+ <?php if (sizeof($opt) == 1) { ?>
335
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
336
+ <?php } ?>
337
+ <br><br>
338
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
339
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
340
+ <?php }?>
341
+ </div>
342
+ </div>
343
+ </div>
344
+ <script>
345
+ jQuery("div#login").hide();
346
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
347
+ function mologinback(){
348
+ jQuery('#mo2f_backto_mo_loginform').submit();
349
+ }
350
+ jQuery('#mo2f_inline_back_btn').click(function() {
351
+ jQuery('#mo2f_goto_two_factor_form').submit();
352
+ });
353
+ jQuery('#mo2f_authy_configure').click(function() {
354
+ jQuery('#mo2f_inline_authy_configure_form').submit();
355
+ });
356
+ jQuery('#mo2f_authy_validate').click(function() {
357
+ var token = jQuery('#authy_token').val();
358
+ document.getElementById("mo2f_inline_validate_authy_authentication_form").elements[0].value = token;
359
+ jQuery('#mo2f_inline_validate_authy_authentication_form').submit();
360
+ });
361
+
362
+ jQuery('#authy_token').keypress(function(e){
363
+ if(e.which == 13){//Enter key pressed
364
+ e.preventDefault();
365
+ var token = jQuery('#authy_token').val();
366
+ document.getElementById("mo2f_inline_validate_authy_authentication_form").elements[0].value = token;
367
+ jQuery('#mo2f_inline_validate_authy_authentication_form').submit();
368
+ }
369
+
370
+ });
371
+ </script>
372
+ <?php
373
+ }
374
+
375
+ function prompt_user_for_google_authenticator_setup($current_user){
376
+ $mo2f_google_auth = isset($_SESSION['mo2f_google_auth']) ? $_SESSION['mo2f_google_auth'] : null;
377
+ $data = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_qrCode'] : null;
378
+ $ga_secret = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_secret'] : null;
379
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
380
+ ?>
381
+ <div class="miniorange_soft_auth">
382
+ <div class="miniorange-ga-setup-container">
383
+ <h2 class="mo_header_background">Set up Google Authenticator</h2>
384
+ <div class="mo_margin_left">
385
+ <br>
386
+ <?php echo $_SESSION['mo2f-login-message']; ?>
387
+ <table>
388
+ <tr>
389
+ <td style="vertical-align:top;width:18%;">
390
+ <h3>Select Phone Type</h3>
391
+ <br>
392
+ <input type="radio" name="mo2f_inline_app_type_radio" value="android" <?php checked( $mo2f_google_auth['ga_phone'] == 'android' ); ?> /> <b>Android</b><br /><br />
393
+ <input type="radio" name="mo2f_inline_app_type_radio" value="iphone" <?php checked( $mo2f_google_auth['ga_phone'] == 'iphone' ); ?> /> <b>iPhone</b><br /><br />
394
+ <input type="radio" name="mo2f_inline_app_type_radio" value="blackberry" <?php checked( $mo2f_google_auth['ga_phone'] == 'blackberry' ); ?> /> <b>BlackBerry</b><br /><br />
395
+ <?php if (sizeof($opt) > 1) { ?>
396
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
397
+ <?php } ?>
398
+ </td>
399
+ <td class="mo2f_separator"></td>
400
+ <td style="width:46%;">
401
+
402
+
403
+ <div id="mo2f_android_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'android' ? 'display:block' : 'display:none'; ?>" class="mo_margin_left">
404
+ <h3>Install the Google Authenticator App for Android.</h3>
405
+ <br>
406
+ <ol>
407
+ <li>On your phone,Go to Google Play Store.</li>
408
+ <li>Search for <b>Google Authenticator.</b>
409
+ <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Download from the Google Play Store and install the application.</a>
410
+ </li>
411
+
412
+ </ol>
413
+ <br>
414
+ <h3>Now open and configure Google Authenticator.</h3>
415
+ <br>
416
+ <ol>
417
+ <li>In Google Authenticator, touch Menu and select "Set up account."</li>
418
+ <li>Select "Scan a barcode". Use your phone's camera to scan this barcode.</li>
419
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
420
+
421
+ </ol>
422
+ <center>
423
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_a" aria-expanded="false" ><b>Can't scan the barcode? </b></a></div>
424
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_a">
425
+ <ol>
426
+ <li>In Google Authenticator, touch Menu and select "Set up account."</li>
427
+ <li>Select "Enter provided key"</li>
428
+ <li>In "Enter account name" type your full email address.</li>
429
+ <li>In "Enter your key" type your secret key:</li>
430
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
431
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
432
+ <?php echo $ga_secret; ?>
433
+ </div>
434
+ <div style="font-size: 80%;color: #666666;">
435
+ Spaces don't matter.
436
+ </div>
437
+ </div>
438
+ <li>Key type: make sure "Time-based" is selected.</li>
439
+ <li>Tap Add.</li>
440
+ </ol>
441
+ </div>
442
+ </center>
443
+ </div>
444
+
445
+ <div id="mo2f_iphone_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'iphone' ? 'display:block' : 'display:none'; ?>" class="mo_margin_left">
446
+ <h3>Install the Google Authenticator app for iPhone.</h3>
447
+ <br>
448
+ <ol>
449
+ <li>On your iPhone, tap the App Store icon.</li>
450
+ <li>Search for <b>Google Authenticator.</b>
451
+ <a href="http://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8" target="_blank">Download from the App Store and install it</a>
452
+ </li>
453
+ </ol>
454
+ <br>
455
+ <h3>Now open and configure Google Authenticator.</h3>
456
+ <br>
457
+ <ol>
458
+ <li>In Google Authenticator, tap "+", and then "Scan Barcode."</li>
459
+ <li>Use your phone's camera to scan this barcode.
460
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?><br><br>
461
+ <a data-toggle="collapse" href="#mo2f_scanbarcode_i" aria-expanded="false" ><b>Can't scan the barcode? </b></a>
462
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_i" >
463
+ <br>
464
+ <ol>
465
+ <li>In Google Authenticator, tap +.</li>
466
+ <li>Key type: make sure "Time-based" is selected.</li>
467
+ <li>In "Account" type your full email address.</li>
468
+ <li>In "Key" type your secret key:</li>
469
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
470
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
471
+ <?php echo $ga_secret; ?>
472
+ </div>
473
+ <div style="font-size: 80%;color: #666666;">
474
+ Spaces don't matter.
475
+ </div>
476
+ </div>
477
+ <li>Tap Add.</li>
478
+ </ol>
479
+ </div></div></center>
480
+ </li>
481
+ </ol>
482
+ <br>
483
+
484
+ </div>
485
+ <div id="mo2f_blackberry_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'blackberry' ? 'display:block' : 'display:none'; ?>" class="mo_margin_left">
486
+ <h3>Install the Google Authenticator app for BlackBerry</h4>
487
+ <br>
488
+ <ol>
489
+ <li>On your phone, open a web browser.Go to <b>m.google.com/authenticator.</b></li>
490
+ <li>Download and install the Google Authenticator application.</li>
491
+ </ol>
492
+ <br>
493
+ <h3>Now open and configure Google Authenticator.</h3>
494
+ <br>
495
+ <ol>
496
+ <li>In Google Authenticator, select Manual key entry.</li>
497
+ <li>In "Enter account name" type your full email address.</li>
498
+ <li>In "Enter key" type your secret key:</li>
499
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
500
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
501
+ <?php echo $ga_secret; ?>
502
+ </div>
503
+ <div style="font-size: 80%;color: #666666;">
504
+ Spaces don't matter.
505
+ </div>
506
+ </div>
507
+ <li>Choose Time-based type of key.</li>
508
+ <li>Tap Save.</li>
509
+ </ol>
510
+ </div>
511
+ <br>
512
+ </td>
513
+ <td class="mo2f_separator"></td>
514
+ <td style="vertical-align:top;">
515
+ <div style="margin-right:15px;<?php echo isset($_SESSION['mo2f_google_auth']) ? 'display:block' : 'display:none'; ?>" class="mo_margin_left">
516
+ <h3>Verify and Save</h3><br>
517
+ <div>Once you have scanned the barcode, enter the 6-digit verification code generated by the Authenticator app</div><br/>
518
+ <span><b>Code: </b>
519
+ <input class="mo2f_table_textbox" autofocus="true" required="true" type="text" id="google_token" name="google_token" placeholder="Enter OTP" /></span><br /><br/>
520
+
521
+ <input type="button" name="validate" id="validate" class="miniorange-button" onclick="mo2f_inline_verify_ga_code();" value="Verify and Save" />
522
+
523
+ </div>
524
+ </td>
525
+ <tr>
526
+ </table>
527
+ <?php if (sizeof($opt) == 1) { ?>
528
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
529
+ <?php } ?>
530
+ <br><br>
531
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
532
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
533
+ <?php }?>
534
+
535
+ </div>
536
+ </div>
537
+ </div>
538
+ <script>
539
+ jQuery("div#login").hide();
540
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
541
+ function mologinback(){
542
+ jQuery('#mo2f_backto_mo_loginform').submit();
543
+ }
544
+ jQuery('#mo2f_inline_back_btn').click(function() {
545
+ jQuery('#mo2f_goto_two_factor_form').submit();
546
+ });
547
+ jQuery('input:radio[name=mo2f_inline_app_type_radio]').click(function() {
548
+ var selectedPhone = jQuery(this).val();
549
+ document.getElementById("mo2f_inline_app_type_ga_form").elements[0].value = selectedPhone;
550
+ jQuery('#mo2f_inline_app_type_ga_form').submit();
551
+ });
552
+ function mo2f_inline_verify_ga_code(){
553
+ var token = jQuery('#google_token').val();
554
+ document.getElementById("mo2f_inline_verify_ga_code_form").elements[0].value = token;
555
+ jQuery('#mo2f_inline_verify_ga_code_form').submit();
556
+ }
557
+
558
+ jQuery('#google_token').keypress(function(e){
559
+ if(e.which == 13){//Enter key pressed
560
+ e.preventDefault();
561
+ var token = jQuery('#google_token').val();
562
+ document.getElementById("mo2f_inline_verify_ga_code_form").elements[0].value = token;
563
+ jQuery('#mo2f_inline_verify_ga_code_form').submit();
564
+ }
565
+
566
+ });
567
+ </script>
568
+
569
+ <?php
570
+ }
571
+ function prompt_user_for_phone_setup($current_user){
572
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
573
+ ?>
574
+ <div class="miniorange_soft_auth">
575
+ <div class="miniorange-inner-login-container">
576
+ <h2 class="mo_header_background">Verify Your Phone</h2>
577
+ <div class="mo_margin_left">
578
+ <br>
579
+ <p><b><?php echo $_SESSION['mo2f-login-message']; ?></b></p>
580
+ <br>
581
+ <div class="mo2f_row">
582
+ <h4>Enter your phone number</h4>
583
+ <input class="mo2f_textbox" type="text" name="verify_phone" id="phone" style="padding-left:40px!important;"
584
+ value="<?php if( isset($_SESSION['mo2f_phone'])){ echo $_SESSION['mo2f_phone'];} else echo get_user_meta($current_user,'mo2f_user_phone',true); ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" title="Enter phone number without any space or dashes" />
585
+ <input type="button" name="verify" onclick="moinlineverifyphone();" class="miniorange-button" value="Verify" />
586
+ </div>
587
+
588
+ <br>
589
+ <h4>Enter One Time Passcode</h4>
590
+
591
+ <input class="mo2f_textbox" autofocus="true" type="text" name="otp_token" placeholder="Enter OTP" id="otp_token"/>
592
+ <?php if (get_user_meta($current_user, 'mo2f_selected_2factor_method',true) == 'SMS'){ ?>
593
+ <a href="#resendsmslink">Resend OTP ?</a>
594
+ <?php } else {?>
595
+ <a href="#resendsmslink">Call Again ?</a>
596
+ <?php } ?><br>
597
+
598
+ <?php if (sizeof($opt) > 1) { ?>
599
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
600
+ <?php } ?>
601
+ <input type="button" name="validate" onclick="moverifyotp();" class="miniorange-button" value="Validate OTP" />
602
+
603
+ <br><br>
604
+ </div>
605
+ <?php if (sizeof($opt) == 1) { ?>
606
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
607
+ <?php } ?>
608
+ <br><br>
609
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
610
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
611
+ <?php }?>
612
+ </div>
613
+ </div>
614
+ <script>
615
+ jQuery("#phone").intlTelInput();
616
+ jQuery("div#login").hide();
617
+ jQuery("body.login div#login").before(jQuery('.miniorange_soft_auth'));
618
+ function mologinback(){
619
+ jQuery('#mo2f_backto_mo_loginform').submit();
620
+ }
621
+
622
+ jQuery('#mo2f_inline_back_btn').click(function() {
623
+ jQuery('#mo2f_goto_two_factor_form').submit();
624
+ });
625
+
626
+ jQuery('a[href=\"#resendsmslink\"]').click(function(e) {
627
+ jQuery('#mo2fa_inline_resend_otp_form').submit();
628
+ });
629
+
630
+ function moinlineverifyphone(){
631
+ var phone = jQuery('#phone').val();
632
+ document.getElementById("mo2f_inline_verifyphone_form").elements[0].value = phone;
633
+ jQuery('#mo2f_inline_verifyphone_form').submit();
634
+ }
635
+
636
+ jQuery('#phone').keypress(function(e){
637
+ if(e.which == 13){//Enter key pressed
638
+ e.preventDefault();
639
+ var phone = jQuery('#phone').val();
640
+ document.getElementById("mo2f_inline_verifyphone_form").elements[0].value = phone;
641
+ jQuery('#mo2f_inline_verifyphone_form').submit();
642
+ }
643
+
644
+ });
645
+
646
+ function moverifyotp(){
647
+ var otp = jQuery('#otp_token').val();
648
+ document.getElementById("mo2f_inline_validateotp_form").elements[0].value = otp;
649
+ jQuery('#mo2f_inline_validateotp_form').submit();
650
+ }
651
+
652
+ jQuery('#otp_token').keypress(function(e){
653
+ if(e.which == 13){//Enter key pressed
654
+ e.preventDefault();
655
+ var otp = jQuery('#otp_token').val();
656
+ document.getElementById("mo2f_inline_validateotp_form").elements[0].value = otp;
657
+ jQuery('#mo2f_inline_validateotp_form').submit();
658
+ }
659
+
660
+ });
661
+
662
+ </script>
663
+
664
+
665
+
666
+ <?php }
667
+ function prompt_user_for_miniorange_app_setup($current_user){
668
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
669
+ $user = isset($_SESSION['mo2f_current_user']) ? unserialize($_SESSION['mo2f_current_user']) : null;
670
+
671
+ ?>
672
+ <div class="miniorange_app_setup_page">
673
+ <div class="miniorange-app-setup-container">
674
+ <h2 class="mo_header_background">Setup miniOrange Authenticator App</h2>
675
+ <div class="mo_margin_left">
676
+ <br>
677
+ <p><b><?php echo $_SESSION['mo2f-login-message']; ?></b></p>
678
+ <br>
679
+ <p class='mo2f_success_container' ><?php echo $_SESSION['mo2f-login-message']; ?></p>
680
+ <div style="margin-right:7px;"><?php download_instruction_for_mobile_app($user); ?></div>
681
+ <div class="mo_margin_left">
682
+ <br>
683
+ <h3>Step-2 : Scan QR code</h3><hr class="mo_hr">
684
+ <br>
685
+ <div id="mo2f_configurePhone"><h4>Please click on 'Configure your phone' button below to see QR Code.</h4>
686
+ <br>
687
+ <?php if (sizeof($opt) > 1) { ?>
688
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
689
+ <?php } ?>
690
+ <input type="button" name="submit" onclick="moconfigureapp();" class="miniorange-button" value="Configure your phone" />
691
+ </div>
692
+
693
+ <?php
694
+ if(isset($_SESSION[ 'mo2f_show_qr_code' ]) && $_SESSION[ 'mo2f_show_qr_code' ] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['miniorange_inline_show_qrcode_nonce']) && wp_verify_nonce( $_POST['miniorange_inline_show_qrcode_nonce'], 'miniorange-2-factor-inline-show-qrcode-nonce' )){
695
+ initialize_inline_mobile_registration(); ?>
696
+ <script>jQuery("#mo2f_app_div").hide();</script>
697
+ <?php } ?>
698
+ <br>
699
+ </div>
700
+ <?php if (sizeof($opt) == 1) { ?>
701
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
702
+ <?php } ?>
703
+ <br><br>
704
+ </div>
705
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
706
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
707
+ <?php }?>
708
+ </div>
709
+ </div>
710
+ <script>
711
+ jQuery("div#login").hide();
712
+ jQuery("body.login div#login").before(jQuery('.miniorange_app_setup_page'));
713
+ function mologinback(){
714
+ jQuery('#mo2f_backto_mo_loginform').submit();
715
+ }
716
+
717
+ function moconfigureapp(){
718
+ jQuery('#mo2f_inline_configureapp_form').submit();
719
+ }
720
+ jQuery('#mo2f_inline_back_btn').click(function() {
721
+ jQuery('#mo2f_goto_two_factor_form').submit();
722
+ });
723
+ </script>
724
+
725
+
726
+ <?php }
727
+
728
+ function initialize_inline_mobile_registration(){
729
+ $data = $_SESSION[ 'mo2f-login-qrCode' ];
730
+ $url = get_option('mo2f_host_name');
731
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
732
+ ?>
733
+
734
+ <p>Open your <b>miniOrange Authenticator</b> app and click on <b>Configure button</b> to scan the QR Code. Your phone should have internet connectivity to scan QR code.</p>
735
+ <div class="red" style="color:red;"><br />
736
+ <p>I am not able to scan the QR code, <a data-toggle="collapse" href="#mo2f_scanqrcode" aria-expanded="false" >click here </a></p></div>
737
+ <div class="mo2f_collapse" id="mo2f_scanqrcode">
738
+ <br />Follow these instructions below and try again.
739
+ <ol>
740
+ <li>Make sure your desktop screen has enough brightness.</li>
741
+ <li>Open your app and click on Configure button to scan QR Code again.</li>
742
+ <li>If you get cross mark on QR Code then click on 'Refresh QR Code' link.</li>
743
+ </ol>
744
+ </div>
745
+ <br>
746
+ <table class="mo2f_settings_table">
747
+ <a href="#mo2f_refreshQRCode">Click here to Refresh QR Code.</a>
748
+ <div id="displayInlineQrCode" style="margin-left:250px;"><br /> <?php echo '<img style="width:200px;" src="data:image/jpg;base64,' . $data . '" />'; ?>
749
+ </div>
750
+ </table>
751
+ <?php
752
+ if (sizeof($opt) > 1) { ?>
753
+ <input type="button" name="back" id="mo2f_inline_back_to_btn" class="miniorange-button" value="Back" />
754
+ <?php } ?>
755
+
756
+ <script>
757
+ jQuery('#mo2f_inline_back_to_btn').click(function() {
758
+ jQuery('#mo2f_goto_two_factor_form').submit();
759
+ });
760
+ jQuery('a[href=\"#mo2f_refreshQRCode\"]').click(function(e) {
761
+ jQuery('#mo2f_inline_configureapp_form').submit();
762
+ });
763
+ jQuery("#mo2f_configurePhone").hide();
764
+ var timeout;
765
+ pollInlineMobileRegistration();
766
+ function pollInlineMobileRegistration()
767
+ {
768
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
769
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
770
+ var postUrl = "<?php echo $url; ?>" + "/moas/api/auth/registration-status";
771
+ jQuery.ajax({
772
+ url: postUrl,
773
+ type : "POST",
774
+ dataType : "json",
775
+ data : jsonString,
776
+ contentType : "application/json; charset=utf-8",
777
+ success : function(result) {
778
+ var status = JSON.parse(JSON.stringify(result)).status;
779
+ if (status == 'SUCCESS') {
780
+ var content = "<br/><div id='success'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></div>";
781
+ jQuery("#displayInlineQrCode").empty();
782
+ jQuery("#displayInlineQrCode").append(content);
783
+ setTimeout(function(){jQuery("#mo2f_inline_mobile_register_form").submit();}, 1000);
784
+ } else if (status == 'ERROR' || status == 'FAILED') {
785
+ var content = "<br/><div id='error'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></div>";
786
+ jQuery("#displayInlineQrCode").empty();
787
+ jQuery("#displayInlineQrCode").append(content);
788
+ jQuery("#messages").empty();
789
+
790
+ jQuery("#messages").append("<div class='error mo2f_error_container'> <p class='mo2f_msgs'>An Error occured processing your request. Please try again to configure your phone.</p></div>");
791
+ } else {
792
+ timeout = setTimeout(pollInlineMobileRegistration, 3000);
793
+ }
794
+ }
795
+ });
796
+ }
797
+ </script>
798
+ <?php }
799
+
800
+ function prompt_user_for_kba_setup($current_user){
801
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
802
+ ?>
803
+ <div class="miniorange_app_setup_page">
804
+
805
+ <div class="miniorange-app-setup-container">
806
+ <h2 class="mo_header_background">Setup Security Question (KBA)</h2>
807
+ <div class="mo_margin_left">
808
+ <br>
809
+ <p id="validation_msg"><b><?php echo $_SESSION['mo2f-login-message']; ?></b></p>
810
+ <br>
811
+ <?php mo2f_configure_kba_questions(); ?>
812
+ <br />
813
+ <?php if (sizeof($opt) > 1) { ?>
814
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="miniorange-button" value="Back" />
815
+ <?php } ?>
816
+ <input type="button" name="validate" onclick="moinlinesavekba();" class="miniorange-button" value="Save" />
817
+ <br>
818
+ <?php if (sizeof($opt) == 1) { ?>
819
+ <input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
820
+ <?php } ?>
821
+ </div>
822
+
823
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
824
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
825
+ <?php }?>
826
+ </div>
827
+ </div>
828
+ <script>
829
+ jQuery("div#login").hide();
830
+ jQuery("body.login div#login").before(jQuery('.miniorange_app_setup_page'));
831
+ function moinlinesavekba(){
832
+
833
+ var kba_1 = jQuery('#mo2f_kbaquestion_1').val();
834
+ var kba_2 = jQuery('#mo2f_kba_ans1').val();
835
+ var kba_3 = jQuery('#mo2f_kbaquestion_2').val();
836
+ var kba_4 = jQuery('#mo2f_kba_ans2').val();
837
+ var kba_5 = jQuery('#mo2f_kbaquestion_3').val();
838
+ var kba_6 = jQuery('#mo2f_kba_ans3').val();
839
+
840
+ var regx = /^[a-zA-z0-9_@.$#&+-\s]*$/;
841
+
842
+ if(!(kba_2.match(regx) && kba_4.match(regx) && kba_6.match(regx))){
843
+ jQuery('#validation_msg').append("Only alphanumeric letters with special characters (_@.$#&amp;+-) are allowed.");
844
+ return;
845
+ }
846
+
847
+ document.getElementById("mo2f_inline_save_kba_form").elements[0].value = kba_1;
848
+ document.getElementById("mo2f_inline_save_kba_form").elements[1].value = kba_2;
849
+ document.getElementById("mo2f_inline_save_kba_form").elements[2].value = kba_3;
850
+ document.getElementById("mo2f_inline_save_kba_form").elements[3].value = kba_4;
851
+ document.getElementById("mo2f_inline_save_kba_form").elements[4].value = kba_5;
852
+ document.getElementById("mo2f_inline_save_kba_form").elements[5].value = kba_6;
853
+ document.getElementById("mo2f_inline_save_kba_form").elements[6].value = '';
854
+ jQuery('#mo2f_inline_save_kba_form').submit();
855
+ }
856
+ jQuery('#mo2f_inline_back_btn').click(function() {
857
+ jQuery('#mo2f_goto_two_factor_form').submit();
858
+ });
859
+ function mologinback(){
860
+ jQuery('#mo2f_backto_mo_loginform').submit();
861
+ }
862
+ </script>
863
+
864
+ <?php }
865
+
866
+ function prompt_user_for_setup_success($id){
867
+
868
+ $mo2f_second_factor = get_user_meta($id,'mo2f_selected_2factor_method',true);
869
+ if($mo2f_second_factor == 'OUT OF BAND EMAIL'){
870
+ $mo2f_second_factor = 'Email Verification';
871
+ }else if($mo2f_second_factor == 'SMS'){
872
+ $mo2f_second_factor = 'OTP over SMS';
873
+ }else if($mo2f_second_factor == 'PHONE VERIFICATION'){
874
+ $mo2f_second_factor = 'Phone Call Verification';
875
+ }else if($mo2f_second_factor == 'SOFT TOKEN'){
876
+ $mo2f_second_factor = 'Soft Token';
877
+ }else if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
878
+ $mo2f_second_factor = 'QR Code Authentication';
879
+ }else if($mo2f_second_factor == 'PUSH NOTIFICATIONS'){
880
+ $mo2f_second_factor = 'Push Notification';
881
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
882
+ $mo2f_second_factor = 'Google Authenticator';
883
+ }else if($mo2f_second_factor == 'AUTHY 2-FACTOR AUTHENTICATION'){
884
+ $mo2f_second_factor = 'Authy 2-Factor Authentication';
885
+ }else if($mo2f_second_factor == 'KBA'){
886
+ $mo2f_second_factor = 'Security Questions (KBA)';
887
+ }
888
+ $status = get_user_meta($id,'mo_2factor_user_registration_status',true);
889
+ ?>
890
+ <div class="miniorange_app_setup_page">
891
+
892
+ <div class="miniorange-app-setup-container">
893
+ <h2 class="mo_header_background">Two Factor Setup Complete</h2>
894
+ <br><br>
895
+ <?php if($status == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
896
+ ?>
897
+ <center>
898
+ <h3><b style="color:#7EAFB7;"><?php echo $mo2f_second_factor; ?> </b>has been set your Two Factor method for login.<br>
899
+ Next time when you will login, you will be prompted <?php echo $mo2f_second_factor; ?> as your 2nd factor.
900
+ </h3><br />
901
+ </center>
902
+ <?php } if($status != 'MO_2_FACTOR_PLUGIN_SETTINGS'){
903
+ ?><center><div id="validation_msg" style="color:red;"></div></center>
904
+ <div id="mo2f_show_kba_reg" class="mo2f_inline_padding">
905
+ <div id="mo2f_kba_browser"><center>
906
+ <h4> Please set your security questions. It will be used as an alternate login or backup method for all authentication methods. It will also be used as 2nd factor when you will try to login from mobile browser.</h4></center>
907
+ </div><br />
908
+ <?php echo isset($_SESSION[ 'mo2f-login-message' ]) ? '<h3 style="color:red;">' . $_SESSION[ 'mo2f-login-message' ] . '</h3>': '';?>
909
+ <?php mo2f_configure_kba_questions(); ?>
910
+ <input type="button" name="validate" onclick="moinlinesavekba();" class="miniorange-button mo2f_inline_padding" value="Save" />
911
+ </div>
912
+ <?php }
913
+ if($status == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ ?>
914
+ <center>
915
+ <br /><br />
916
+ <h2><a href="#mo2f_login_account">Click Here</a></h2> to sign-in into your account.
917
+ <br>
918
+ </center>
919
+ <?php } ?>
920
+ <center><input type="button" name="miniorange_login_back" onclick="mologinback();" id="miniorange_login_back" class="button-green" value="←Back To Login" />
921
+ </center>
922
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
923
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
924
+ <?php }?>
925
+ </div>
926
+ </div>
927
+
928
+ <script>
929
+ jQuery("div#login").hide();
930
+ jQuery("body.login div#login").before(jQuery('.miniorange_app_setup_page'));
931
+ jQuery('a[href=\"#mo2f_login_account\"]').click(function(e) {
932
+ jQuery('#mo2f_inline_register_skip_form').submit();
933
+ });
934
+ function moinlinesavekba(){
935
+ var kba_1 = jQuery('#mo2f_kbaquestion_1').val();
936
+ var kba_2 = jQuery('#mo2f_kba_ans1').val();
937
+ var kba_3 = jQuery('#mo2f_kbaquestion_2').val();
938
+ var kba_4 = jQuery('#mo2f_kba_ans2').val();
939
+ var kba_5 = jQuery('#mo2f_kbaquestion_3').val();
940
+ var kba_6 = jQuery('#mo2f_kba_ans3').val();
941
+
942
+ var regx = /^[a-zA-z0-9_@.$#&+-\s]*$/;
943
+
944
+ if(!(kba_2.match(regx) && kba_4.match(regx) && kba_6.match(regx))){
945
+ jQuery('#validation_msg').empty().append("Only alphanumeric letters with special characters (_@.$#&amp;+-) are allowed.");
946
+ return;
947
+ }
948
+
949
+ document.getElementById("mo2f_inline_save_kba_form").elements[0].value = kba_1;
950
+ document.getElementById("mo2f_inline_save_kba_form").elements[1].value = kba_2;
951
+ document.getElementById("mo2f_inline_save_kba_form").elements[2].value = kba_3;
952
+ document.getElementById("mo2f_inline_save_kba_form").elements[3].value = kba_4;
953
+ document.getElementById("mo2f_inline_save_kba_form").elements[4].value = kba_5;
954
+ document.getElementById("mo2f_inline_save_kba_form").elements[5].value = kba_6;
955
+ document.getElementById("mo2f_inline_save_kba_form").elements[6].value = 'mo2f_inline_kba_registration';
956
+ jQuery('#mo2f_inline_save_kba_form').submit();
957
+ }
958
+ function mologinback(){
959
+ jQuery('#mo2f_backto_mo_loginform').submit();
960
+ }
961
+ </script>
962
+ <?php
963
+ }
964
+ ?>
miniorange_2_factor_woocommerce_login.php ADDED
@@ -0,0 +1,1817 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function mo2f_frontend_get_forgotphone_form(){
4
+ $random_mo_key = get_option('mo2f_new_customer');
5
+ $message = $random_mo_key ? 'Please select the option and click on Continue button' : 'Please choose from below options:';
6
+ ?>
7
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="mo2f_forgotphone_modal">
8
+ <div class="mo2f-modal-backdrop"></div>
9
+ <div class="mo2f_modal-dialog mo2f_modal-md">
10
+ <div class="mo2f_modal-content">
11
+ <div class="mo2f_modal-header">
12
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
13
+ How would you like to authenticate yourself</h4>
14
+ </div>
15
+ <div class="mo2f_modal-body">
16
+ <div id="kbaSection">
17
+ <div style="padding-left:10px;padding-right:10px;fonnt-size:15px;"><?php echo isset($_SESSION['mo2f-login-message']) ? $_SESSION['mo2f-login-message'] : '';?></div>
18
+ <p style="padding-left:10px;padding-right:10px;font-size: 15px;"><?php echo $message; ?></p>
19
+ <div style="padding-left:40px;padding-right:40px;font-size: 15px;">
20
+ <?php if(!$random_mo_key){ ?>
21
+ <input type="radio" name="mo2f_selected_forgotphone_option" value="OTP OVER EMAIL" checked="ckecked" />&nbsp;Send a one time passcode to my registered email<br /><br />
22
+ <?php } ?>
23
+ <input type="radio" name="mo2f_selected_forgotphone_option" value="KBA" />&nbsp;Answer your Security Questions (KBA)
24
+
25
+ <br /><br />
26
+ <input type="button" name="miniorange_validtae_otp" value="Continue" class="button button-primary" onclick="mo2fselectforgotphoneoption();" />
27
+
28
+ </div>
29
+ <br>
30
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
31
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
32
+ <?php }?>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ <style>
39
+ .woocommerce .woocommerce-error {
40
+ display: none !important;
41
+ }
42
+ .modal-backdrop{
43
+ z-index: 0 !important;
44
+ }
45
+ </style>
46
+ <script>
47
+ jQuery('.woocommerce-error').hide();
48
+ jQuery('#mo2f_forgotphone_modal').modal('show');
49
+ function mologinback(){
50
+ jQuery('#mo2f_2fa_form_close').submit();
51
+ }
52
+ function mo2fselectforgotphoneoption(){
53
+ var option = jQuery('input[name=mo2f_selected_forgotphone_option]:checked').val();
54
+ document.getElementById("mo2f_challenge_forgotphone_form").elements[0].value = option;
55
+ jQuery('#mo2f_challenge_forgotphone_form').submit();
56
+ }
57
+ </script>
58
+ <?php
59
+ }
60
+
61
+ function mo2f_frontend_get_kba_form(){
62
+ ?>
63
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal4">
64
+ <div class="mo2f-modal-backdrop"></div>
65
+ <div class="mo2f_modal-dialog mo2f_modal-md">
66
+ <div class="mo2f_modal-content">
67
+ <div class="mo2f_modal-header">
68
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
69
+ Validate Security Questions</h4>
70
+ </div>
71
+ <div class="mo2f_modal-body center">
72
+ <div id="kbaSection">
73
+
74
+ <div id="mo_kba_title">
75
+ <p class="mo2fa_display_message_frontend" ><?php echo isset($_SESSION['mo2f-login-message']) ? $_SESSION['mo2f-login-message'] : 'Please answer the following questions:'; ?></p><br />
76
+ </div>
77
+ <div id="mo2f_kba_content">
78
+ <p style="text-align:center;font-size:15px;">
79
+ <?php if(isset($_SESSION['mo_2_factor_kba_questions'])){
80
+ echo $_SESSION['mo_2_factor_kba_questions'][0];
81
+ ?><br />
82
+ <input class="mo2f-textbox" style="width:350px;" type="text" name="mo2f_answer_1" id="mo2f_answer_1" required="true" autofocus="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." autocomplete="off" ><br />
83
+ <?php
84
+ echo $_SESSION['mo_2_factor_kba_questions'][1];
85
+ ?><br />
86
+ <input class="mo2f-textbox" style="width:350px;" type="text" name="mo2f_answer_2" id="mo2f_answer_2" required="true" pattern="(?=\S)[A-Za-z0-9_@.$#&amp;+-\s]{1,100}" title="Only alphanumeric letters with special characters(_@.$#&amp;+-) are allowed." autocomplete="off" >
87
+ <?php
88
+ }
89
+ ?>
90
+ </p>
91
+ </div>
92
+
93
+ <?php if(get_option('mo2f_login_policy')){
94
+ if(get_option('mo2f_deviceid_enabled')){
95
+ ?>
96
+ <span class="mo2f_device" style="float:left; font-size:15px;"><input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" />Remember this device.</span>
97
+ <?php
98
+ }else{
99
+ ?>
100
+ <input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" style="display:none;" />
101
+ <?php
102
+ }
103
+ }else{
104
+ ?>
105
+ <input type="checkbox" name="miniorange_remember_device" id="miniorange_remember_device" style="display:none;" />
106
+ <?php
107
+ }
108
+ ?>
109
+ <input type="button" name="miniorange_kba_validate" onclick="mo2f_validate_kba();" id="miniorange_kba_validate" class="button button-primary" style="float:right;" value="Validate" />
110
+
111
+
112
+ </div>
113
+ <br /><br />
114
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
115
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
116
+ <?php }?>
117
+ </div>
118
+ </div>
119
+ </div>
120
+ </div>
121
+ <style>
122
+ .woocommerce .woocommerce-error {
123
+ display: none !important;
124
+ }
125
+ .modal-backdrop{
126
+ z-index: 0 !important;
127
+ }
128
+ </style>
129
+ <script>
130
+ jQuery('.woocommerce-error').hide();
131
+ jQuery('#myModal4').modal('show');
132
+ function mologinback(){
133
+ jQuery('#mo2f_2fa_form_close').submit();
134
+ }
135
+ function mo2f_validate_kba(){
136
+ var ans1 = jQuery('#mo2f_answer_1').val();
137
+ var ans2 = jQuery('#mo2f_answer_2').val();
138
+ var check = jQuery('#miniorange_remember_device').prop('checked');
139
+ document.getElementById("mo2f_submitkba_loginform").elements[0].value = ans1;
140
+ document.getElementById("mo2f_submitkba_loginform").elements[1].value = ans2;
141
+ document.getElementById("mo2f_submitkba_loginform").elements[2].value = check;
142
+ jQuery('#mo2f_submitkba_loginform').submit();
143
+ }
144
+ jQuery('#mo2f_answer_2').keypress(function(e){
145
+ if(e.which == 13){//Enter key pressed
146
+ e.preventDefault();
147
+ mo2f_validate_kba();
148
+ }
149
+ });
150
+ </script>
151
+ <?php
152
+ }
153
+
154
+ function mo2f_frontend_get_trusted_device_form(){
155
+ ?>
156
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal">
157
+ <div class="mo2f-modal-backdrop"></div>
158
+ <div class="mo2f_modal-dialog">
159
+ <div class="mo2f_modal-content">
160
+ <div class="mo2f_modal-header">
161
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
162
+ Remember Device</h4>
163
+ </div>
164
+ <div class="mo2f_modal-body center">
165
+ <div id="pushSection">
166
+
167
+ <div id="mo_device_title" style="margin-bottom:10%;padding-top:6%;">
168
+
169
+ <p style="text-align:center !important;">Do you want to remember this device?</p>
170
+
171
+ </div>
172
+
173
+ <div id="mo2f_device_content">
174
+ <center>
175
+ <input type="button" name="miniorange_trust_device_yes" onclick="mo_check_device_confirm();" id="miniorange_trust_device_yes" class="mo2f-button mo_green" style="margin-right:5%;" value="Yes" />
176
+
177
+ <input type="button" name="miniorange_trust_device_no" onclick="mo_check_device_cancel();" id="miniorange_trust_device_no" class="mo2f-button mo_red" value="No" />
178
+ </center>
179
+ </div>
180
+ <div id="showLoadingBar" hidden>
181
+ <center>
182
+ <p style="text-align:center !important;">Please wait...We are taking you into your account.</p>
183
+
184
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" />
185
+ </center>
186
+ </div>
187
+ <br />
188
+ <center>
189
+ <span>
190
+ <div style="font-size: 15px;">Click on <i><b>Yes</b></i> if its your personal device.<div/>
191
+ <div style="font-size: 15px;">Click on <i><b>No</b></i> if its a public device.</div>
192
+ </span>
193
+ </center>
194
+
195
+ <br />
196
+ <br />
197
+ </div>
198
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
199
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
200
+ <?php }?>
201
+ </div>
202
+
203
+ </div>
204
+ </div>
205
+ </div>
206
+ <style>
207
+
208
+ .woocommerce .woocommerce-error {
209
+ display: none !important;
210
+ }
211
+ .modal-backdrop{
212
+ z-index: 0 !important;
213
+ }
214
+ </style>
215
+ <script>
216
+ jQuery('.woocommerce-error').hide();
217
+ jQuery('#myModal').modal('show');
218
+ function mologinback(){
219
+ jQuery('#mo2f_2fa_form_close').submit();
220
+ }
221
+ function mo_check_device_confirm(){
222
+ jQuery('#mo2f_device_content').hide();
223
+ jQuery('#mo_device_title').hide();
224
+ jQuery('#showLoadingBar').show();
225
+ jQuery('#mo2f_trust_device_confirm_form').submit();
226
+ }
227
+ function mo_check_device_cancel(){
228
+ jQuery('#mo2f_device_content').hide();
229
+ jQuery('#mo_device_title').hide();
230
+ jQuery('#showLoadingBar').show();
231
+ jQuery('#mo2f_trust_device_cancel_form').submit();
232
+ }
233
+ </script>
234
+ <?php
235
+ }
236
+
237
+ function mo2f_frontend_getpush_oobemail_response($id){
238
+ ?>
239
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal1">
240
+ <div class="mo2f-modal-backdrop"></div>
241
+ <div class="mo2f_modal-dialog mo2f_modal-md">
242
+ <div class="mo2f_modal-content">
243
+ <div class="mo2f_modal-header">
244
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
245
+ Accept Your Transaction</h4>
246
+ </div>
247
+ <div class="mo2f_modal-body center">
248
+
249
+ <div id="otpMessage" >
250
+ <p class='mo2fa_display_message_frontend'><?php echo $_SESSION['mo2f-login-message']; ?></p>
251
+ </div>
252
+
253
+
254
+ <div id="mo_2_factor_push_page">
255
+ <center>
256
+ <div id="pushSection" >
257
+
258
+ <a href="#showPushHelp" id="pushHelpLink" class="mo2f-link">See How It Works ?</a>
259
+
260
+ <p style="font-size:20px;text-align:center;">Waiting for your approval...</p>
261
+
262
+ <div id="showPushImage" style="margin-bottom:10px;" class="center">
263
+
264
+ <img src="<?php echo plugins_url( 'includes/images/ajax-loader-login.gif' , __FILE__ );?>" style="display:inline!important;"/>
265
+
266
+ </div>
267
+ <span style="padding-right:2%;">
268
+ <?php if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_PUSH_NOTIFICATIONS'){ ?>
269
+ <center>
270
+ <?php if(get_option('mo2f_enable_forgotphone')){ ?>
271
+ <a name="miniorange_login_forgotphone" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="mo2f-link" >Forgot Phone?</a>
272
+ <?php } ?>
273
+ &nbsp;&nbsp;&nbsp;&nbsp;
274
+ <a name="miniorange_login_offline" onclick="mologinoffline();" id="miniorange_login_offline" class="mo2f-link" >Phone is Offline?</a>
275
+ </center>
276
+
277
+ <?php }else if(isset($_SESSION[ 'mo_2factor_login_status' ]) && $_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL' && get_user_meta($id,'mo2f_kba_registration_status',true)){ ?>
278
+ <center><a href="#mo2f_alternate_login_kba" class="mo2f-link">Didn't receive mail?</a></center>
279
+ <?php }
280
+ ?>
281
+ </span>
282
+ <br>
283
+
284
+ </div>
285
+ </center>
286
+ <div id="showPushHelp" class="showPushHelp" hidden>
287
+ <br>
288
+ <center><a href="#showPushHelp" id="pushLink" class="mo2f-link">←Go Back.</a>
289
+ <br>
290
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
291
+ <ol class="mo2f_carousel-indicators">
292
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
293
+ <li data-target="#myCarousel" data-slide-to="1"></li>
294
+ <li data-target="#myCarousel" data-slide-to="2"></li>
295
+ </ol>
296
+ <div class="mo2f_carousel-inner" role="listbox">
297
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OOB_EMAIL') { ?>
298
+ <div class="item active">
299
+
300
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-1.png" alt="First slide">
301
+ </div>
302
+ <div class="item">
303
+ <p>Click on Accept Transaction link to verify your email .</p><br>
304
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-2.png" alt="First slide">
305
+
306
+ </div>
307
+ <div class="item">
308
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/email-with-link-login-flow-3.png" alt="First slide">
309
+ </div>
310
+ <?php } else { ?>
311
+ <!-- Indicators -->
312
+
313
+
314
+ <div class="item active">
315
+ <p>You will receive a notification on your phone.</p><br>
316
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow.png" alt="First slide">
317
+ </div>
318
+ <div class="item">
319
+ <p>Open the notification and click on accept button.</p><br>
320
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow-1.png" alt="First slide">
321
+
322
+ </div>
323
+ <div class="item">
324
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/push-login-flow-2.png" alt="First slide">
325
+ </div>
326
+ <?php } ?>
327
+ </div>
328
+ </div>
329
+ </center>
330
+ </div>
331
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
332
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
333
+ <?php }?>
334
+ </div>
335
+
336
+ </div><!-- /.modal-content -->
337
+ </div><!-- /.modal-dialog -->
338
+ </div><!-- /.modal -->
339
+ </div>
340
+ <style>
341
+ .woocommerce .woocommerce-error {
342
+ display: none !important;
343
+ }
344
+ .modal-backdrop{
345
+ z-index: 0 !important;
346
+ }
347
+ </style>
348
+ <script>
349
+ jQuery('.woocommerce-error').hide();
350
+ jQuery('#myModal1').modal('show');
351
+ jQuery('body.woocommerce.login.form-row').hide();
352
+ var timeout;
353
+ pollPushValidation();
354
+ function pollPushValidation()
355
+ {
356
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
357
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
358
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
359
+
360
+ jQuery.ajax({
361
+ url: postUrl,
362
+ type : "POST",
363
+ dataType : "json",
364
+ data : jsonString,
365
+ contentType : "application/json; charset=utf-8",
366
+ success : function(result) {
367
+ var status = JSON.parse(JSON.stringify(result)).status;
368
+ if (status == 'SUCCESS') {
369
+ jQuery('#mo2f_mobile_validation_form').submit();
370
+ } else if (status == 'ERROR' || status == 'FAILED' || status == 'DENIED') {
371
+ jQuery('#mo2f_2fa_form_close').submit();
372
+ } else {
373
+ timeout = setTimeout(pollPushValidation, 3000);
374
+ }
375
+ }
376
+ });
377
+ }
378
+ jQuery('#myCarousel').carousel('pause');
379
+ jQuery('#pushHelpLink').click(function() {
380
+ jQuery('#showPushHelp').show();
381
+ jQuery('#pushSection').hide();
382
+ jQuery('#otpMessage').hide();
383
+ jQuery('#myCarousel').carousel(0);
384
+ });
385
+ jQuery('#pushLink').click(function() {
386
+ jQuery('#showPushHelp').hide();
387
+ jQuery('#pushSection').show();
388
+ jQuery('#otpMessage').show();
389
+ jQuery('#myCarousel').carousel('pause');
390
+ });
391
+ function mologinback(){
392
+ jQuery('#mo2f_2fa_form_close').submit();
393
+ }
394
+ function mologinoffline(){
395
+ jQuery('#mo2f_show_softtoken_loginform').submit();
396
+ }
397
+ function mologinforgotphone(){
398
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
399
+ }
400
+ jQuery('a[href=\"#mo2f_alternate_login_kba\"]').click(function() {
401
+ jQuery('#mo2f_alternate_login_kbaform').submit();
402
+ });
403
+ </script>
404
+ <?php
405
+ }
406
+
407
+ function mo2f_frontend_getqrcode(){
408
+
409
+ ?>
410
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal2">
411
+ <div class="mo2f-modal-backdrop"></div>
412
+ <div class="mo2f_modal-dialog mo2f_modal-md">
413
+ <div class="mo2f_modal-content">
414
+ <div class="mo2f_modal-header">
415
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
416
+ Scan QR Code</h4>
417
+ </div>
418
+ <div class="mo2f_modal-body center">
419
+
420
+ <?php if(isset($_SESSION['mo2f-login-message']) && $_SESSION['mo2f-login-message'] == 'Error:OTP over Email'){ ?>
421
+
422
+ <div id="otpMessage">
423
+ <p class='mo2fa_display_message_frontend'><?php echo 'Error occurred while sending OTP over email. Please try again.'; ?></p>
424
+ </div>
425
+ <?php } ?>
426
+
427
+
428
+ <div id="scanQRSection">
429
+ <p class='mo2fa_display_message_frontend'>Identify yourself by scanning the QR code with miniOrange Authenticator app.</p>
430
+ <a href="#showQRHelp" id="helpLink" class="mo2f-link">See How It Works ?</a>
431
+ <br><br>
432
+ <div id="showQrCode" style="margin-bottom:10%;">
433
+ <center><?php echo '<img src="data:image/jpg;base64,' . $_SESSION[ 'mo2f-login-qrCode' ] . '" />'; ?></center>
434
+ </div>
435
+
436
+
437
+
438
+ <?php if(get_option('mo2f_enable_forgotphone')){ ?>
439
+ <a name="miniorange_login_forgotphone" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="mo2f-link" >Forgot Phone?</a>
440
+ <?php } ?>
441
+ &nbsp;&nbsp;&nbsp;&nbsp;
442
+ <a name="miniorange_login_offline" onclick="mologinoffline();" id="miniorange_login_offline" class="mo2f-link" >Phone is Offline?</a>
443
+
444
+ <br />
445
+
446
+ </div>
447
+ <div id="showQRHelp" class="showQRHelp" hidden>
448
+ <br>
449
+ <center><a href="#showQRHelp" id="qrLink" class="mo2f-link">←Back to Scan QR Code.</a>
450
+ <br>
451
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
452
+ <!-- Indicators -->
453
+ <ol class="mo2f_carousel-indicators">
454
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
455
+ <li data-target="#myCarousel" data-slide-to="1"></li>
456
+ <li data-target="#myCarousel" data-slide-to="2"></li>
457
+ <li data-target="#myCarousel" data-slide-to="3"></li>
458
+ <li data-target="#myCarousel" data-slide-to="4"></li>
459
+ </ol>
460
+ <div class="mo2f_carousel-inner" role="listbox">
461
+ <div class="item active">
462
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-1.png" alt="First slide">
463
+ </div>
464
+ <div class="item">
465
+ <p>Open miniOrange Authenticator app and click on Authenticate.</p><br>
466
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
467
+
468
+ </div>
469
+ <div class="item">
470
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-3.png" alt="First slide">
471
+ </div>
472
+ <div class="item">
473
+ <img class="first-slide" src="https://auth.miniorange.com/moas//images/help/qr-help-4.png" alt="First slide">
474
+ </div>
475
+ <div class="item">
476
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-5.png" alt="First slide">
477
+ </div>
478
+ </div>
479
+ </div>
480
+ </center>
481
+ </div>
482
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
483
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
484
+ <?php }?>
485
+ </div>
486
+ </div><!-- /.modal-content -->
487
+ </div><!-- /.modal-dialog -->
488
+ </div><!-- /.modal -->
489
+ <style>
490
+ .woocommerce .woocommerce-error {
491
+ display: none !important;
492
+ }
493
+ .modal-backdrop{
494
+ z-index: 0 !important;
495
+ }
496
+ </style>
497
+ <script>
498
+ jQuery('.woocommerce-error').hide();
499
+ jQuery('#myModal2').modal('show');
500
+
501
+ var timeout;
502
+ pollMobileValidation();
503
+ function pollMobileValidation()
504
+ {
505
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
506
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
507
+ var postUrl = "<?php echo get_option('mo2f_host_name'); ?>" + "/moas/api/auth/auth-status";
508
+ jQuery.ajax({
509
+ url: postUrl,
510
+ type : "POST",
511
+ dataType : "json",
512
+ data : jsonString,
513
+ contentType : "application/json; charset=utf-8",
514
+ success : function(result) {
515
+ var status = JSON.parse(JSON.stringify(result)).status;
516
+ if (status == 'SUCCESS') {
517
+ var content = "<div id='success'><center><img src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></center></div>";
518
+ jQuery("#showQrCode").empty();
519
+ jQuery("#showQrCode").append(content);
520
+ setTimeout(function(){jQuery("#mo2f_mobile_validation_form").submit();}, 100);
521
+ } else if (status == 'ERROR' || status == 'FAILED') {
522
+ var content = "<div id='error'><center><img src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></center></div>";
523
+ jQuery("#showQrCode").empty();
524
+ jQuery("#showQrCode").append(content);
525
+ setTimeout(function(){jQuery('#mo2f_2fa_form_close').submit();}, 1000);
526
+ } else {
527
+ timeout = setTimeout(pollMobileValidation, 3000);
528
+ }
529
+ }
530
+ });
531
+ }
532
+ jQuery('#myCarousel').carousel('pause');
533
+ jQuery('#helpLink').click(function() {
534
+ jQuery('#showQRHelp').show();
535
+ jQuery('#scanQRSection').hide();
536
+
537
+ jQuery('#myCarousel').carousel(0);
538
+ });
539
+ jQuery('#qrLink').click(function() {
540
+ jQuery('#showQRHelp').hide();
541
+ jQuery('#scanQRSection').show();
542
+ jQuery('#myCarousel').carousel('pause');
543
+ });
544
+ function mologinback(){
545
+ jQuery('#mo2f_2fa_form_close').submit();
546
+ }
547
+ function mologinoffline(){
548
+ jQuery('#mo2f_show_softtoken_loginform').submit();
549
+ }
550
+ function mologinforgotphone(){
551
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
552
+ }
553
+ </script>
554
+ <?php
555
+ }
556
+
557
+ function mo2f_frontend_getotp_form(){
558
+ ?>
559
+
560
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal3">
561
+ <div class="mo2f-modal-backdrop"></div>
562
+ <div class="mo2f_modal-dialog mo2f_modal-md">
563
+ <div class="mo2f_modal-content">
564
+ <div class="mo2f_modal-header">
565
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
566
+ Validate OTP</h4>
567
+ </div>
568
+ <div class="mo2f_modal-body">
569
+
570
+
571
+ <div id="otpMessage">
572
+ <p class="mo2fa_display_message_frontend" ><?php echo $_SESSION['mo2f-login-message']; ?></p>
573
+ </div>
574
+
575
+ <div id="showOTP">
576
+ <div class="mo2f-login-container">
577
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_GOOGLE_AUTHENTICATION'){ ?>
578
+ <a href="#showOTPHelp" id="otpHelpLink" class="mo2f-link">See How It Works ?</a>
579
+ <?php } ?>
580
+ <br />
581
+ <input type="text" name="mo2fa_softtokenkey" placeholder="Enter one time passcode" id="mo2fa_softtokenkey" required="true" class="mo2f-textbox" autofocus="true" pattern="[0-9]{4,8}" title="Only digits within range 4-8 are allowed."/>
582
+ <br />
583
+ <input type="button" name="miniorange_soft_token_submit" onclick="mootploginsubmit();" id="miniorange_soft_token_submit" class="button" value="Validate" />
584
+ <br><br>
585
+ <?php if(get_option('mo2f_enable_forgotphone') && isset($_SESSION[ 'mo_2factor_login_status' ] ) && $_SESSION[ 'mo_2factor_login_status' ] != 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL'){ ?>
586
+ <a name="miniorange_login_forgotphone" onclick="mologinforgotphone();" id="miniorange_login_forgotphone" class="mo2f-link" >Forgot Phone ?</a>
587
+ <?php } ?>
588
+ <br><br>
589
+ </div>
590
+ </div>
591
+ <div id="showOTPHelp" class="showOTPHelp" hidden>
592
+ <br>
593
+ <center><a href="#showOTP" id="otpLink" class="mo2f-link">←Go Back</a>
594
+ <br>
595
+ <div id="myCarousel" class="mo2f_carousel slide" data-ride="carousel">
596
+ <!-- Indicators -->
597
+
598
+ <?php if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_SOFT_TOKEN'){ ?>
599
+ <ol class="mo2f_carousel-indicators">
600
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
601
+ <li data-target="#myCarousel" data-slide-to="1"></li>
602
+ <li data-target="#myCarousel" data-slide-to="2"></li>
603
+ <li data-target="#myCarousel" data-slide-to="3"></li>
604
+
605
+ </ol>
606
+ <div class="mo2f_carousel-inner" role="listbox">
607
+
608
+
609
+ <div class="item active">
610
+ <p>Open miniOrange Authenticator app and click on settings icon on top right corner.</p><br>
611
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/qr-help-2.png" alt="First slide">
612
+ </div>
613
+ <div class="item">
614
+ <p>Click on Sync button below to sync your time with miniOrange Servers. This is a one time sync to avoid otp validation failure.</p><br>
615
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-3.png" alt="First slide">
616
+ </div>
617
+ <div class="item">
618
+ <p>Go to Soft Token tab.</p><br>
619
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-2.png" alt="First slide">
620
+ </div>
621
+ <div class="item">
622
+ <p>Enter the one time passcode shown in miniOrange Authenticator app here.</p><br>
623
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/token-help-4.png" alt="First slide">
624
+ </div>
625
+ </div>
626
+ <?php } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_EMAIL') { ?>
627
+ <ol class="mo2f_carousel-indicators">
628
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
629
+ <li data-target="#myCarousel" data-slide-to="1"></li>
630
+ <li data-target="#myCarousel" data-slide-to="2"></li>
631
+
632
+ </ol>
633
+ <div class="mo2f_carousel-inner" role="listbox">
634
+ <div class="item active">
635
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-1.png" alt="First slide">
636
+ </div>
637
+ <div class="item">
638
+ <p>Check your email with which you registered and copy the one time passcode.</p><br>
639
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-2.png" alt="First slide">
640
+ </div>
641
+ <div class="item">
642
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-help-3.png" alt="First slide">
643
+ </div>
644
+ </div>
645
+ <?php } else if($_SESSION[ 'mo_2factor_login_status' ] == 'MO_2_FACTOR_CHALLENGE_OTP_OVER_SMS') { ?>
646
+ <ol class="mo2f_carousel-indicators">
647
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
648
+ <li data-target="#myCarousel" data-slide-to="1"></li>
649
+ <li data-target="#myCarousel" data-slide-to="2"></li>
650
+
651
+ </ol>
652
+ <div class="mo2f_carousel-inner" role="listbox">
653
+ <div class="item active">
654
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-1.png" alt="First slide">
655
+ </div>
656
+ <div class="item">
657
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-2.png" alt="First slide">
658
+ </div>
659
+ <div class="item">
660
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/otp-over-sms-login-flow-3.png" alt="First slide">
661
+ </div>
662
+ </div>
663
+ <?php } else { ?>
664
+ <!-- phone call verification -->
665
+ <ol class="mo2f_carousel-indicators">
666
+ <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
667
+ <li data-target="#myCarousel" data-slide-to="1"></li>
668
+
669
+
670
+ </ol>
671
+ <div class="mo2f_carousel-inner" role="listbox">
672
+ <div class="item active">
673
+ <p>You will receive a phone call. Pick up the call and listen to the one time passcode carefully. </p>
674
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/phone-call-login-flow-2.png" alt="First slide">
675
+ </div>
676
+ <div class="item">
677
+ <p>Enter the one time passcode here and click on validate button to login.</p><br>
678
+ <img class="first-slide" src="https://auth.miniorange.com/moas/images/help/phone-call-login-flow.png" alt="First slide">
679
+ </div>
680
+
681
+ </div>
682
+ <?php } ?>
683
+
684
+ </div>
685
+ </div>
686
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
687
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
688
+ <?php }?>
689
+ </div>
690
+ </div>
691
+ </div><!-- /.modal-content -->
692
+ </div><!-- /.modal-dialog -->
693
+ </div><!-- /.modal -->
694
+ <style>
695
+ .woocommerce .woocommerce-error {
696
+ display: none !important;
697
+ }
698
+ .modal-backdrop{
699
+ z-index: 0 !important;
700
+ }
701
+ </style>
702
+ <script>
703
+ jQuery('.woocommerce-error').hide();
704
+ jQuery('#myModal3').modal('show');
705
+ jQuery('#otpHelpLink').click(function() {
706
+ jQuery('#showOTPHelp').show();
707
+ jQuery('#showOTP').hide();
708
+ jQuery('#otpMessage').hide();
709
+ });
710
+ jQuery('#otpLink').click(function() {
711
+ jQuery('#showOTPHelp').hide();
712
+ jQuery('#showOTP').show();
713
+ jQuery('#otpMessage').show();
714
+ });
715
+
716
+ function mologinback(){
717
+ jQuery('#mo2f_2fa_form_close').submit();
718
+ }
719
+ function mologinforgotphone(){
720
+ jQuery('#mo2f_show_forgotphone_loginform').submit();
721
+ }
722
+ function mootploginsubmit(){
723
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
724
+ document.getElementById("mo2f_submitotp_loginform").elements[0].value = otpkey;
725
+ jQuery('#mo2f_submitotp_loginform').submit();
726
+
727
+ }
728
+
729
+ jQuery('#mo2fa_softtokenkey').keypress(function(e){
730
+ if(e.which == 13){//Enter key pressed
731
+ e.preventDefault();
732
+ var otpkey = jQuery('#mo2fa_softtokenkey').val();
733
+ document.getElementById("mo2f_submitotp_loginform").elements[0].value = otpkey;
734
+ jQuery('#mo2f_submitotp_loginform').submit();
735
+ }
736
+
737
+ });
738
+
739
+
740
+
741
+ </script>
742
+ <?php
743
+ }
744
+ function prompt_user_to_register_frontend(){ ?>
745
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal5">
746
+ <div class="mo2f-modal-backdrop"></div>
747
+ <div class="mo2f_modal-dialog mo2f_modal-md">
748
+ <div class="mo2f_modal-content">
749
+ <div class="mo2f_modal-header">
750
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
751
+ Setup Two Factor</h4>
752
+ </div>
753
+ <div class="mo2f_modal-body center">
754
+ <p class="mo2fa_display_message_frontend"><?php echo $_SESSION['mo2f-login-message']; ?></p>
755
+
756
+ A new security system has been enabled to better protect your account. Please configure your Two-Factor Authentication method by setting up your account.
757
+ <br><br>
758
+ <div class="mo2f-login-container">
759
+ <input type="email" autofocus="true" name="mo_useremail" id="mo_useremail" class="mo2f-textbox" style="width:305px !important;" required placeholder="person@example.com" />
760
+ <br>
761
+ <input type="button" name="miniorange_get_started" onclick="mouserregistersubmit();" class="button" value="Get Started" />
762
+ <?php if( !get_option('mo2f_inline_registration')){ ?>
763
+ <br><br>
764
+ <input type="button" name="mo2f_skip_btn" onclick="moskipregistersubmit();" class="button " value="Skip" />
765
+ <?php } ?>
766
+ <br><br>
767
+ </div>
768
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
769
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
770
+ <?php }?>
771
+ </div>
772
+
773
+
774
+ </div><!-- /.modal-content -->
775
+ </div><!-- /.modal-dialog -->
776
+ </div><!-- /.modal -->
777
+ <style>
778
+ .woocommerce .woocommerce-error {
779
+ display: none !important;
780
+ }
781
+ .modal-backdrop{
782
+ z-index: 0 !important;
783
+ }
784
+ </style>
785
+ <script>
786
+ jQuery('.woocommerce-error').hide();
787
+ jQuery('#myModal5').modal('show');
788
+
789
+ function mologinback(){
790
+ jQuery('#mo2f_2fa_form_close').submit();
791
+ }
792
+ function mouserregistersubmit(){
793
+ var userEmail = jQuery('#mo_useremail').val();
794
+ document.getElementById("mo2f_inline_register_user_form").elements[0].value = userEmail;
795
+ jQuery('#mo2f_inline_register_user_form').submit();
796
+
797
+ }
798
+
799
+ jQuery('#mo_useremail').keypress(function(e){
800
+ if(e.which == 13){//Enter key pressed
801
+ e.preventDefault();
802
+ var userEmail = jQuery('#mo_useremail').val();
803
+ document.getElementById("mo2f_inline_register_user_form").elements[0].value = userEmail;
804
+ jQuery('#mo2f_inline_register_user_form').submit();
805
+ }
806
+
807
+ });
808
+ function moskipregistersubmit(){
809
+ jQuery('#mo2f_inline_register_skip_form').submit();
810
+ }
811
+ </script>
812
+ <?php }
813
+
814
+ function prompt_user_for_validate_otp_frontend(){ ?>
815
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal6">
816
+ <div class="mo2f-modal-backdrop"></div>
817
+ <div class="mo2f_modal-dialog mo2f_modal-md">
818
+ <div class="mo2f_modal-content">
819
+ <div class="mo2f_modal-header">
820
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
821
+ Verify Your Email</h4>
822
+ </div>
823
+ <div class="mo2f_modal-body">
824
+ <p class="mo2fa_display_message_frontend"><?php echo $_SESSION['mo2f-login-message']; ?></p>
825
+ <center>
826
+ <input autofocus="true" type="text" name="otp_token" id="otp_token" required placeholder="Enter OTP" class="mo2f-textbox" style="width:305px !important;" />
827
+ <br>
828
+ <a href="#resendinlineotplink">Resend OTP ?</a>
829
+ <input type="button" name="back" id="mo2f_inline_backto_regform" style="margin-left:20px;" class="button" value="Back" />
830
+ <input name="submit" type="button" value="Validate OTP" class="button" onclick="movalidateotpsubmit();" />
831
+
832
+
833
+ </center>
834
+ <br><br>
835
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
836
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
837
+ <?php }?>
838
+ </div>
839
+
840
+
841
+ </div><!-- /.modal-content -->
842
+ </div><!-- /.modal-dialog -->
843
+ </div><!-- /.modal -->
844
+ <style>
845
+ .woocommerce .woocommerce-error {
846
+ display: none !important;
847
+ }
848
+ .modal-backdrop{
849
+ z-index: 0 !important;
850
+ }
851
+ </style>
852
+ <script>
853
+ jQuery('.woocommerce-error').hide();
854
+ jQuery('#myModal6').modal('show');
855
+
856
+ function mologinback(){
857
+ jQuery('#mo2f_2fa_form_close').submit();
858
+ }
859
+ function movalidateotpsubmit(){
860
+ var otp = jQuery('#otp_token').val();
861
+ document.getElementById("mo2f_inline_user_validate_otp_form").elements[0].value = otp;
862
+ jQuery('#mo2f_inline_user_validate_otp_form').submit();
863
+ }
864
+
865
+ jQuery('#otp_token').keypress(function(e){
866
+ if(e.which == 13){//Enter key pressed
867
+ e.preventDefault();
868
+ var otp = jQuery('#otp_token').val();
869
+ document.getElementById("mo2f_inline_user_validate_otp_form").elements[0].value = otp;
870
+ jQuery('#mo2f_inline_user_validate_otp_form').submit();
871
+ }
872
+
873
+ });
874
+ jQuery('a[href=\"#resendinlineotplink\"]').click(function(e) {
875
+ jQuery('#mo2fa_inline_resend_otp_form').submit();
876
+ });
877
+ jQuery('#mo2f_inline_backto_regform').click(function() {
878
+ jQuery('#mo2f_goto_user_registration_form').submit();
879
+ });
880
+ </script>
881
+ <?php }
882
+
883
+ function prompt_user_to_select_2factor_method_frontend($current_user){
884
+ $current_selected_method = get_user_meta($current_user,'mo2f_selected_2factor_method',true);
885
+ if($current_selected_method == 'MOBILE AUTHENTICATION'
886
+ || $current_selected_method == 'SOFT TOKEN'
887
+ || $current_selected_method == 'PUSH NOTIFICATIONS'){
888
+
889
+ prompt_user_for_miniorange_app_setup_frontend($current_user);
890
+
891
+ }else if($current_selected_method == 'SMS'
892
+ || $current_selected_method == 'PHONE VERIFICATION'){
893
+
894
+ prompt_user_for_phone_setup_frontend($current_user);
895
+
896
+ }else if($current_selected_method == 'GOOGLE AUTHENTICATOR' ){
897
+
898
+ prompt_user_for_google_authenticator_setup_frontend($current_user);
899
+
900
+ }else if($current_selected_method == 'AUTHY 2-FACTOR AUTHENTICATION'){
901
+ prompt_user_for_authy_authenticator_setup_frontend($current_user);
902
+ }else if($current_selected_method == 'KBA' ){
903
+
904
+ prompt_user_for_kba_setup_frontend($current_user);
905
+
906
+ }else if($current_selected_method == 'OUT OF BAND EMAIL' ){
907
+
908
+ prompt_user_for_setup_success_frontend($current_user);
909
+
910
+ }else{
911
+ $opt = (array) get_option('mo2f_auth_methods_for_users'); ?>
912
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal7">
913
+ <div class="mo2f-modal-backdrop"></div>
914
+ <div class="mo2f_modal-dialog mo2f_modal-lg">
915
+ <div class="mo2f_modal-content">
916
+ <div class="mo2f_modal-header">
917
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
918
+ Select Two Factor Method</h4>
919
+ </div>
920
+ <div class="mo2f_modal-body">
921
+
922
+ <b>Select Any Two-Factor of your choice below and complete its setup.</b>
923
+ <br>
924
+ <input type="hidden" name="option" value="mo_2factor_validate_user_otp" />
925
+ <br>
926
+ <span class="<?php if( !(in_array("OUT OF BAND EMAIL", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
927
+ <label title="You will receive an email with link. You have to click the ACCEPT or DENY link to verify your email. Supported in Desktops, Laptops, Smartphones." class="mo2f_label">
928
+ <input type="radio" name="mo2f_selected_2factor_method" value="OUT OF BAND EMAIL" />
929
+ Email Verification
930
+ </label>
931
+ <br>
932
+ </span>
933
+
934
+ <span class="<?php if( !(in_array("SMS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
935
+
936
+ <label title="You will receive a one time passcode via SMS on your phone. You have to enter the otp on your screen to login. Supported in Smartphones, Feature Phones." class="mo2f_label">
937
+ <input type="radio" name="mo2f_selected_2factor_method" value="SMS" />
938
+ OTP Over SMS
939
+ </label>
940
+ <br>
941
+ </span>
942
+
943
+ <span class="<?php if( !(in_array("PHONE VERIFICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>">
944
+
945
+ <label title="You will receive a phone call telling a one time passcode. You have to enter the one time passcode to login. Supported in Landlines, Smartphones, Feature phones." class="mo2f_label">
946
+ <input type="radio" name="mo2f_selected_2factor_method" value="PHONE VERIFICATION" />
947
+ Phone Call Verification
948
+ </label>
949
+ <br>
950
+ </span>
951
+
952
+ <span class="<?php if( !(in_array("SOFT TOKEN", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
953
+ <label class="mo2f_label" title="You have to enter 6 digits code generated by miniOrange Authenticator App like Google Authenticator code to login. Supported in Smartphones only." >
954
+ <input type="radio" name="mo2f_selected_2factor_method" value="SOFT TOKEN" />
955
+ Soft Token
956
+ </label>
957
+
958
+ <br>
959
+ </span>
960
+
961
+ <span class="<?php if( !(in_array("MOBILE AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
962
+
963
+ <label class="mo2f_label" title="You have to scan the QR Code from your phone using miniOrange Authenticator App to login. Supported in Smartphones only.">
964
+ <input type="radio" name="mo2f_selected_2factor_method" value="MOBILE AUTHENTICATION" />
965
+ QR Code Authentication
966
+ </label>
967
+ <br>
968
+ </span>
969
+
970
+ <span class="<?php if( !(in_array("PUSH NOTIFICATIONS", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; } ?>" >
971
+
972
+ <label class="mo2f_label" title="You will receive a push notification on your phone. You have to ACCEPT or DENY it to login. Supported in Smartphones only.">
973
+ <input type="radio" name="mo2f_selected_2factor_method" value="PUSH NOTIFICATIONS" />
974
+ Push Notification
975
+ </label>
976
+ <br>
977
+
978
+ </span>
979
+
980
+
981
+ <span class="<?php if( !(in_array("GOOGLE AUTHENTICATOR", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
982
+
983
+ <label title="You have to enter 6 digits code generated by Google Authenticaor App to login. Supported in Smartphones only." class="mo2f_label">
984
+ <input type="radio" name="mo2f_selected_2factor_method" value="GOOGLE AUTHENTICATOR" />
985
+ Google Authenticator
986
+ </label>
987
+ <br>
988
+ </span>
989
+ <span class="<?php if( !(in_array("AUTHY 2-FACTOR AUTHENTICATION", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
990
+
991
+ <label class="mo2f_label" title="You have to enter 6 digits code generated by Authy 2-Factor Authentication App to login. Supported in Smartphones only.">
992
+ <input type="radio" name="mo2f_selected_2factor_method" value="AUTHY 2-FACTOR AUTHENTICATION" />
993
+ Authy 2-Factor Authentication
994
+ </label>
995
+ <br>
996
+ </span>
997
+
998
+ <span class="<?php if( !(in_array("KBA", $opt)) ){ echo "mo2f_td_hide"; }else { echo "mo2f_td_show"; }?>">
999
+
1000
+ <label title="You have to answers some knowledge based security questions which are only known to you to authenticate yourself. Supported in Desktops,Laptops,Smartphones." class="mo2f_label">
1001
+ <input type="radio" name="mo2f_selected_2factor_method" value="KBA" />
1002
+ Security Questions( KBA )
1003
+ </label>
1004
+ </span>
1005
+
1006
+ <br><br>
1007
+ </div>
1008
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1009
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1010
+ <?php }?>
1011
+ </div>
1012
+
1013
+
1014
+
1015
+ </div><!-- /.modal-content -->
1016
+ </div><!-- /.modal-dialog -->
1017
+ </div><!-- /.modal -->
1018
+ <style>
1019
+ .woocommerce .woocommerce-error {
1020
+ display: none !important;
1021
+ }
1022
+ .modal-backdrop{
1023
+ z-index: 0 !important;
1024
+ }
1025
+ </style>
1026
+ <script>
1027
+ jQuery('.woocommerce-error').hide();
1028
+ jQuery('#myModal7').modal('show');
1029
+
1030
+ function mologinback(){
1031
+ jQuery('#mo2f_2fa_form_close').submit();
1032
+ }
1033
+ jQuery('input:radio[name=mo2f_selected_2factor_method]').click(function() {
1034
+ var selectedMethod = jQuery(this).val();
1035
+ document.getElementById("mo2f_select_2fa_methods_form").elements[0].value = selectedMethod;
1036
+ jQuery('#mo2f_select_2fa_methods_form').submit();
1037
+ });
1038
+
1039
+ </script>
1040
+ <?php }
1041
+ }
1042
+ function prompt_user_for_authy_authenticator_setup_frontend($current_user){
1043
+ $mo2f_authy_auth = isset($_SESSION['mo2f_authy_keys']) ? $_SESSION['mo2f_authy_keys'] : null;
1044
+ $data = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_qrCode'] : null;
1045
+ $authy_secret = isset($_SESSION['mo2f_authy_keys']) ? $mo2f_authy_auth['authy_secret'] : null;
1046
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1047
+ ?>
1048
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="mo2f_authy_modal">
1049
+ <div class="mo2f-modal-backdrop"></div>
1050
+ <div class="mo2f_modal-dialog mo2f_modal-lg" style="width:999px !important;margin:0px auto !important;">
1051
+ <div class="mo2f_modal-content">
1052
+ <div class="mo2f_modal-header">
1053
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1054
+ Setup Authy 2-Factor Authentication</h4>
1055
+ </div>
1056
+
1057
+ <div class="mo2f_modal-body">
1058
+ <?php echo $_SESSION[ 'mo2f-login-message' ]; ?>
1059
+ <table style="border:hidden;">
1060
+ <tr>
1061
+ <td style="vertical-align:top;width:300px;padding-right:15px;border:none !important;">
1062
+ <div style="font-size: 18px !important;"><b>Step-1: Configure Authy App.</b></div><hr />
1063
+ <input type="button" name="mo2f_authy_configure" id="mo2f_authy_configure" class="button" value="Configure" /><br /><br />
1064
+ <?php if (sizeof($opt) > 1) { ?>
1065
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="button" value="Back" />
1066
+ <?php } ?>
1067
+
1068
+
1069
+ </td>
1070
+ <td class="mo2f_separator mo2f_authy_table"></td>
1071
+ <td style="width:40%;padding-right:15px;vertical-align:top;border:none !important;">
1072
+ <div style="font-size: 18px !important;"><b>Step-2: Set up Authy App</b></div><hr>
1073
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
1074
+ <ol class="mo2f_ordered_list">
1075
+ <li class="mo2f_list">Install the Authy 2-Factor Authentication App.</li>
1076
+ <li class="mo2f_list">Now open and configure Authy 2-Factor Authentication App.</li>
1077
+ <li class="mo2f_list"> Tap on Add Account and then tap on SCAN QR CODE in your App and scan the qr code.</li>
1078
+ </ol>
1079
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
1080
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_a" aria-expanded="false" ><b>Can't scan the QR Code? </b></a></div>
1081
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_a">
1082
+ <ol class="mo2f_ordered_list">
1083
+ <li class="mo2f_list">In Authy 2-Factor Authentication App, tap on ENTER KEY MANUALLY."</li>
1084
+ <li class="mo2f_list">In "Adding New Account" type your secret key:</li>
1085
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1086
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1087
+ <?php echo $authy_secret; ?>
1088
+ </div>
1089
+ <div style="font-size: 80%;color: #666666;">
1090
+ Spaces don't matter.
1091
+ </div>
1092
+ </div>
1093
+ <li class="mo2f_list">Tap OK.</li>
1094
+ </ol>
1095
+ </div>
1096
+ </div>
1097
+ </td>
1098
+ <td class="mo2f_separator mo2f_authy_table"></td>
1099
+ <td style="vertical-align:top;width:25%;border:none !important;">
1100
+ <div style="font-size: 18px !important;"><b>Step-3: Verify and Save</b></div><hr>
1101
+ <div style="<?php echo isset($_SESSION['mo2f_authy_keys']) ? 'display:block' : 'display:none'; ?>">
1102
+ <li class="mo2f_list">Once you have scanned the qr code, enter the verification code generated by the Authenticator app</li>
1103
+
1104
+ <span style="font-size:16px !important;"><b>Code: </b>
1105
+ <input class="mo2f_table_textbox" style="width:200px;" autofocus="true" required="true" type="text" id="authy_token" name="authy_token" placeholder="Enter OTP" style="width:95%;"/></span><br /><br/>
1106
+ <input type="button" name="validate" id="mo2f_authy_validate" class="button button-primary button-large" value="Verify and Save" />
1107
+ </div>
1108
+ </td>
1109
+ </tr><br>
1110
+ </table>
1111
+ <br><br>
1112
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1113
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1114
+ <?php }?>
1115
+ </div>
1116
+ </div><!-- /.modal-content -->
1117
+ </div><!-- /.modal-dialog -->
1118
+ </div><!-- /.modal -->
1119
+ <style>
1120
+ .woocommerce .woocommerce-error {
1121
+ display: none !important;
1122
+ }
1123
+ .modal-backdrop{
1124
+ z-index: 0 !important;
1125
+ }
1126
+ .mo2f_authy_table{
1127
+ width: 1px !important;
1128
+ border-right: none !important;
1129
+ border-top: none !important;
1130
+ border-bottom: none !important;
1131
+ }
1132
+ </style>
1133
+ <script>
1134
+ jQuery('.woocommerce-error').hide();
1135
+ jQuery('#mo2f_authy_modal').modal('show');
1136
+
1137
+ function mologinback(){
1138
+ jQuery('#mo2f_2fa_form_close').submit();
1139
+ }
1140
+ jQuery('#mo2f_inline_back_btn').click(function() {
1141
+ jQuery('#mo2f_goto_two_factor_form').submit();
1142
+ });
1143
+ jQuery('#mo2f_authy_configure').click(function() {
1144
+ jQuery('#mo2f_inline_authy_configure_form').submit();
1145
+ });
1146
+ jQuery('#mo2f_authy_validate').click(function() {
1147
+ var token = jQuery('#authy_token').val();
1148
+ document.getElementById("mo2f_inline_validate_authy_authentication_form").elements[0].value = token;
1149
+ jQuery('#mo2f_inline_validate_authy_authentication_form').submit();
1150
+ });
1151
+
1152
+ jQuery('#authy_token').keypress(function(e){
1153
+ if(e.which == 13){//Enter key pressed
1154
+ e.preventDefault();
1155
+ var token = jQuery('#authy_token').val();
1156
+ document.getElementById("mo2f_inline_validate_authy_authentication_form").elements[0].value = token;
1157
+ jQuery('#mo2f_inline_validate_authy_authentication_form').submit();
1158
+ }
1159
+
1160
+ });
1161
+ </script>
1162
+ <?php
1163
+ }
1164
+
1165
+ function prompt_user_for_google_authenticator_setup_frontend($current_user){
1166
+ $mo2f_google_auth = isset($_SESSION['mo2f_google_auth']) ? $_SESSION['mo2f_google_auth'] : null;
1167
+ $data = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_qrCode'] : null;
1168
+ $ga_secret = isset($_SESSION['mo2f_google_auth']) ? $mo2f_google_auth['ga_secret'] : null;
1169
+ $opt = (array) get_option('mo2f_auth_methods_for_users'); ?>
1170
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal10">
1171
+ <div class="mo2f-modal-backdrop"></div>
1172
+ <div class="mo2f_modal-dialog mo2f_modal-lg" style="width:999px !important;margin:0px auto !important;">
1173
+ <div class="mo2f_modal-content">
1174
+ <div class="mo2f_modal-header">
1175
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1176
+ Setup Google Authenticator</h4>
1177
+ </div>
1178
+
1179
+ <div class="mo2f_modal-body">
1180
+ <?php echo $_SESSION['mo2f-login-message']; ?>
1181
+ <table style="border:hidden;" id="mo2f_ga_tab">
1182
+ <tr>
1183
+ <td style="vertical-align:top;width:200px !important;border: none !important;">
1184
+ <div style="font-size: 18px !important;"><b>Select Phone Type</b></div>
1185
+ <br>
1186
+ <p style="font-size: 15px !important;"><input type="radio" name="mo2f_inline_app_type_radio" value="android" <?php checked( $mo2f_google_auth['ga_phone'] == 'android' ); ?> /> <b>Android</b><br /><br />
1187
+ <input type="radio" name="mo2f_inline_app_type_radio" value="iphone" <?php checked( $mo2f_google_auth['ga_phone'] == 'iphone' ); ?> /> <b>iPhone</b><br /><br />
1188
+ <input type="radio" name="mo2f_inline_app_type_radio" value="blackberry" <?php checked( $mo2f_google_auth['ga_phone'] == 'blackberry' ); ?> /> <b>BlackBerry</b><br /><br /></p>
1189
+ <?php if (sizeof($opt) > 1) { ?>
1190
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="button" value="Back" />
1191
+ <?php } ?>
1192
+ </td>
1193
+ <td class="mo2f_separator mo2f_ga_table"></td>
1194
+ <td style="width:400px;border: none !important;">
1195
+
1196
+
1197
+ <div id="mo2f_android_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'android' ? 'display:block' : 'display:none'; ?>">
1198
+ <div style="font-size: 18px !important;"><b>Install the Google Authenticator App for Android.</b></div>
1199
+ <ol class="mo2f_ordered_list">
1200
+ <li class="mo2f_list">On your phone,Go to Google Play Store.</li>
1201
+ <li class="mo2f_list">Search for <b>Google Authenticator.</b>
1202
+ <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">Download from the Google Play Store and install the application.</a>
1203
+ </li>
1204
+
1205
+ </ol>
1206
+ <div style="font-size: 18px !important;">Now open and configure Google Authenticator.</div>
1207
+ <ol class="mo2f_ordered_list">
1208
+ <li class="mo2f_list">In Google Authenticator, touch Menu and select "Set up account."</li>
1209
+ <li class="mo2f_list">Select "Scan a barcode". Use your phone's camera to scan this barcode.</li>
1210
+ <center><br><div id="displayQrCode" ><?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?></div></center>
1211
+
1212
+ </ol>
1213
+ <br>
1214
+ <div><a data-toggle="collapse" href="#mo2f_scanbarcode_a" aria-expanded="false" ><b>Can't scan the barcode? </b></a></div>
1215
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_a">
1216
+ <ol class="mo2f_ordered_list">
1217
+ <li class="mo2f_list">In Google Authenticator, touch Menu and select "Set up account."</li>
1218
+ <li class="mo2f_list">Select "Enter provided key"</li>
1219
+ <li class="mo2f_list">In "Enter account name" type your full email address.</li>
1220
+ <li class="mo2f_list">In "Enter your key" type your secret key:</li>
1221
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1222
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1223
+ <?php echo $ga_secret; ?>
1224
+ </div>
1225
+ <div style="font-size: 80%;color: #666666;">
1226
+ Spaces don't matter.
1227
+ </div>
1228
+ </div>
1229
+ <li class="mo2f_list">Key type: make sure "Time-based" is selected.</li>
1230
+ <li class="mo2f_list">Tap Add.</li>
1231
+ </ol>
1232
+ </div>
1233
+
1234
+ </div>
1235
+
1236
+ <div id="mo2f_iphone_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'iphone' ? 'display:block' : 'display:none'; ?>">
1237
+ <div style="font-size: 18px !important;"><b>Install the Google Authenticator app for iPhone.</b></div>
1238
+ <ol class="mo2f_ordered_list">
1239
+ <li class="mo2f_list">On your iPhone, tap the App Store icon.</li>
1240
+ <li class="mo2f_list">Search for <b>Google Authenticator.</b>
1241
+ <a href="http://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8" target="_blank">Download from the App Store and install it</a>
1242
+ </li>
1243
+ </ol>
1244
+ <div style="font-size: 18px !important;">Now open and configure Google Authenticator.</div>
1245
+ <ol class="mo2f_ordered_list">
1246
+ <li class="mo2f_list">In Google Authenticator, tap "+", and then "Scan Barcode."</li>
1247
+ <li class="mo2f_list">Use your phone's camera to scan this barcode.
1248
+ <br><div id="displayQrCode" >
1249
+ <center>
1250
+ <?php echo '<img src="data:image/jpg;base64,' . $data . '" />'; ?>
1251
+ </center>
1252
+ </div>
1253
+ <br>
1254
+ <a data-toggle="collapse" href="#mo2f_scanbarcode_i" aria-expanded="false" ><b>Can't scan the barcode? </b></a>
1255
+ <div class="mo2f_collapse" id="mo2f_scanbarcode_i" >
1256
+ <ol class="mo2f_ordered_list">
1257
+ <li class="mo2f_list">In Google Authenticator, tap +.</li>
1258
+ <li class="mo2f_list">Key type: make sure "Time-based" is selected.</li>
1259
+ <li class="mo2f_list">In "Account" type your full email address.</li>
1260
+ <li class="mo2f_list">In "Key" type your secret key:</li>
1261
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1262
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1263
+ <?php echo $ga_secret; ?>
1264
+ </div>
1265
+ <div style="font-size: 80%;color: #666666;">
1266
+ Spaces don't matter.
1267
+ </div>
1268
+ </div>
1269
+ <li class="mo2f_list">Tap Add.</li>
1270
+ </ol>
1271
+ </div>
1272
+ </li>
1273
+ </ol>
1274
+ <br>
1275
+
1276
+ </div>
1277
+ <div id="mo2f_blackberry_div" style="<?php echo $mo2f_google_auth['ga_phone'] == 'blackberry' ? 'display:block' : 'display:none'; ?>">
1278
+ <div style="font-size: 18px !important;"><b>Install the Google Authenticator app for BlackBerry</b></div>
1279
+
1280
+ <ol class="mo2f_ordered_list">
1281
+ <li class="mo2f_list">On your phone, open a web browser.Go to <b>m.google.com/authenticator.</b></li>
1282
+ <li class="mo2f_list">Download and install the Google Authenticator application.</li>
1283
+ </ol>
1284
+ <div style="font-size: 18px !important;">Now open and configure Google Authenticator.</div>
1285
+ <ol class="mo2f_ordered_list">
1286
+ <li class="mo2f_list">In Google Authenticator, select Manual key entry.</li>
1287
+ <li class="mo2f_list">In "Enter account name" type your full email address.</li>
1288
+ <li class="mo2f_list">In "Enter key" type your secret key:</li>
1289
+ <div style="padding: 10px; background-color: #f9edbe;width: 20em;text-align: center;" >
1290
+ <div style="font-size: 14px; font-weight: bold;line-height: 1.5;" >
1291
+ <?php echo $ga_secret; ?>
1292
+ </div>
1293
+ <div style="font-size: 80%;color: #666666;">
1294
+ Spaces don't matter.
1295
+ </div>
1296
+ </div>
1297
+ <li class="mo2f_list">Choose Time-based type of key.</li>
1298
+ <li class="mo2f_list">Tap Save.</li>
1299
+ </ol>
1300
+ </div>
1301
+ <br>
1302
+ </td>
1303
+ <td class="mo2f_separator mo2f_ga_table"></td>
1304
+ <td style="vertical-align:top;border: none !important;">
1305
+ <div style="<?php echo isset($_SESSION['mo2f_google_auth']) ? 'display:block' : 'display:none'; ?>">
1306
+ <div style="font-size: 18px !important;"><b>Verify and Save</b></div><br/>
1307
+ <div style="font-size: 15px !important;">Once you have scanned the barcode, enter the 6-digit verification code generated by the Authenticator app</div>
1308
+ <span style="font-size:16px;"><b>Code: </b>
1309
+ <input class="mo2f_table_textbox_1" autofocus="true" required="true" type="text" id="google_token" name="google_token" placeholder="Enter OTP" /></span><br /><br/>
1310
+
1311
+ <input type="button" name="validate" id="validate" class="button" onclick="mo2f_inline_verify_ga_code();" value="Verify and Save" />
1312
+
1313
+ </div>
1314
+ </td>
1315
+ <tr>
1316
+ </table>
1317
+ </div>
1318
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1319
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1320
+ <?php }?>
1321
+ </div><!-- /.modal-content -->
1322
+ </div><!-- /.modal-dialog -->
1323
+ </div><!-- /.modal -->
1324
+ <style>
1325
+ .woocommerce .woocommerce-error {
1326
+ display: none !important;
1327
+ }
1328
+ .modal-backdrop{
1329
+ z-index: 0 !important;
1330
+ }
1331
+ .mo2f_ga_table{
1332
+ width: 1px !important;
1333
+ border-right: none !important;
1334
+ border-top: none !important;
1335
+ border-bottom: none !important;
1336
+ }
1337
+ </style>
1338
+ <script>
1339
+ jQuery('.woocommerce-error').hide();
1340
+ jQuery('#myModal10').modal('show');
1341
+
1342
+ function mologinback(){
1343
+ jQuery('#mo2f_2fa_form_close').submit();
1344
+ }
1345
+ jQuery('#mo2f_inline_back_btn').click(function() {
1346
+ jQuery('#mo2f_goto_two_factor_form').submit();
1347
+ });
1348
+ jQuery('input:radio[name=mo2f_inline_app_type_radio]').click(function() {
1349
+ var selectedPhone = jQuery(this).val();
1350
+ document.getElementById("mo2f_inline_app_type_ga_form").elements[0].value = selectedPhone;
1351
+ jQuery('#mo2f_inline_app_type_ga_form').submit();
1352
+ });
1353
+ function mo2f_inline_verify_ga_code(){
1354
+ var token = jQuery('#google_token').val();
1355
+ document.getElementById("mo2f_inline_verify_ga_code_form").elements[0].value = token;
1356
+ jQuery('#mo2f_inline_verify_ga_code_form').submit();
1357
+ }
1358
+
1359
+ jQuery('#google_token').keypress(function(e){
1360
+ if(e.which == 13){//Enter key pressed
1361
+ e.preventDefault();
1362
+ var token = jQuery('#google_token').val();
1363
+ document.getElementById("mo2f_inline_verify_ga_code_form").elements[0].value = token;
1364
+ jQuery('#mo2f_inline_verify_ga_code_form').submit();
1365
+ }
1366
+
1367
+ });
1368
+ </script>
1369
+ <?php }
1370
+ function prompt_user_for_phone_setup_frontend($current_user){
1371
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1372
+ ?>
1373
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal8">
1374
+ <div class="mo2f-modal-backdrop"></div>
1375
+ <div class="mo2f_modal-dialog mo2f_modal-md">
1376
+ <div class="mo2f_modal-content">
1377
+ <div class="mo2f_modal-header">
1378
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1379
+ Verify Your Phone</h4>
1380
+ </div>
1381
+ <div class="mo2f_modal-body">
1382
+ <p style="font-size: 15px !important;"><?php echo $_SESSION['mo2f-login-message']; ?></p>
1383
+
1384
+ <div class="mo_margin_left">
1385
+ <div class="mo2f_row">
1386
+ <div style="font-size:20px">Enter your phone number</div>
1387
+ <input class="mo2f_textbox" type="text" name="verify_phone" id="phone" style="padding-left:40px!important;height:30px !important;"
1388
+ value="<?php if( isset($_SESSION['mo2f_phone'])){ echo $_SESSION['mo2f_phone'];} else echo get_user_meta($current_user,'mo2f_user_phone',true); ?>" pattern="[\+]?[0-9]{1,4}\s?[0-9]{7,12}" title="Enter phone number without any space or dashes" />
1389
+ <br />
1390
+ <input type="button" name="verify" onclick="moinlineverifyphone();" class="button" value="Verify" />
1391
+ </div>
1392
+ <br />
1393
+ <div class="mo2f_row">
1394
+ <div style="font-size:20px" >Enter One Time Passcode</div>
1395
+
1396
+ <input class="mo2f_textbox" style="width:170px !important;height:30px !important;border-radius: 4px !important;" autofocus="true" type="text" name="otp_token" placeholder="Enter OTP" id="otp_token"/>
1397
+ <?php if (get_user_meta($current_user, 'mo2f_selected_2factor_method',true) == 'SMS'){ ?>
1398
+ <a href="#resendsmslink">Resend OTP ?</a>
1399
+ <?php } else {?>
1400
+ <a href="#resendsmslink">Call Again ?</a>
1401
+ <?php } ?><br>
1402
+
1403
+ </div><br />
1404
+ <?php if (sizeof($opt) > 1) { ?>
1405
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="button" value="Back" />
1406
+ <?php } ?>
1407
+ <input type="button" name="validate" onclick="moverifyotp();" class="button" value="Validate OTP" />
1408
+ </div>
1409
+ <br><br>
1410
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1411
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1412
+ <?php }?>
1413
+ </div>
1414
+
1415
+
1416
+ </div><!-- /.modal-content -->
1417
+ </div><!-- /.modal-dialog -->
1418
+ </div><!-- /.modal -->
1419
+ <style>
1420
+ .woocommerce .woocommerce-error {
1421
+ display: none !important;
1422
+ }
1423
+ .modal-backdrop{
1424
+ z-index: 0 !important;
1425
+ }
1426
+ </style>
1427
+ <script>
1428
+ jQuery('.woocommerce-error').hide();
1429
+ jQuery('#myModal8').modal('show');
1430
+ jQuery("#phone").intlTelInput();
1431
+ function mologinback(){
1432
+ jQuery('#mo2f_2fa_form_close').submit();
1433
+ }
1434
+
1435
+ jQuery('#mo2f_inline_back_btn').click(function() {
1436
+ jQuery('#mo2f_goto_two_factor_form').submit();
1437
+ });
1438
+
1439
+ jQuery('a[href=\"#resendsmslink\"]').click(function(e) {
1440
+ jQuery('#mo2fa_inline_resend_otp_form').submit();
1441
+ });
1442
+
1443
+ function moinlineverifyphone(){
1444
+ var phone = jQuery('#phone').val();
1445
+ document.getElementById("mo2f_inline_verifyphone_form").elements[0].value = phone;
1446
+ jQuery('#mo2f_inline_verifyphone_form').submit();
1447
+ }
1448
+
1449
+ jQuery('#phone').keypress(function(e){
1450
+ if(e.which == 13){//Enter key pressed
1451
+ e.preventDefault();
1452
+ var phone = jQuery('#phone').val();
1453
+ document.getElementById("mo2f_inline_verifyphone_form").elements[0].value = phone;
1454
+ jQuery('#mo2f_inline_verifyphone_form').submit();
1455
+ }
1456
+
1457
+ });
1458
+
1459
+ function moverifyotp(){
1460
+ var otp = jQuery('#otp_token').val();
1461
+ document.getElementById("mo2f_inline_validateotp_form").elements[0].value = otp;
1462
+ jQuery('#mo2f_inline_validateotp_form').submit();
1463
+ }
1464
+
1465
+ jQuery('#otp_token').keypress(function(e){
1466
+ if(e.which == 13){//Enter key pressed
1467
+ e.preventDefault();
1468
+ var otp = jQuery('#otp_token').val();
1469
+ document.getElementById("mo2f_inline_validateotp_form").elements[0].value = otp;
1470
+ jQuery('#mo2f_inline_validateotp_form').submit();
1471
+ }
1472
+
1473
+ });
1474
+
1475
+ </script>
1476
+
1477
+
1478
+
1479
+ <?php }
1480
+ function prompt_user_for_miniorange_app_setup_frontend($current_user){
1481
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1482
+ $user = isset($_SESSION['mo2f_current_user']) ? unserialize($_SESSION['mo2f_current_user']) : null;
1483
+ ?>
1484
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal9">
1485
+ <div class="mo2f-modal-backdrop"></div>
1486
+ <div class="mo2f_modal-dialog mo2f_modal-lg" style="margin:0px auto !important;">
1487
+ <div class="mo2f_modal-content">
1488
+ <div class="mo2f_modal-header">
1489
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1490
+ Setup miniOrange Authenticator App</h4>
1491
+ </div>
1492
+ <div class="mo2f_modal-body">
1493
+ <div style="font-size: 15px !important;"><?php echo $_SESSION['mo2f-login-message']; ?></div>
1494
+
1495
+ <?php download_instruction_for_mobile_app($user); ?>
1496
+ <div class="mo_margin_left">
1497
+ <div style="font-size:15px !important;"><b>Step-2 : Scan QR code</b></div><hr class="mo_hr">
1498
+ <div id="mo2f_configurePhone" style="font-size: 15px !important;">Please click on 'Configure your phone' button below to scan QR Code.
1499
+ <br>
1500
+ <?php if (sizeof($opt) > 1) { ?>
1501
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="button" value="Back" />
1502
+ <?php } ?>
1503
+ <input type="button" name="submit" onclick="moconfigureapp();" class="button" value="Configure your phone" />
1504
+ </div>
1505
+
1506
+ <?php
1507
+ if(isset($_SESSION[ 'mo2f_show_qr_code' ]) && $_SESSION[ 'mo2f_show_qr_code' ] == 'MO_2_FACTOR_SHOW_QR_CODE' && isset($_POST['miniorange_inline_show_qrcode_nonce']) && wp_verify_nonce( $_POST['miniorange_inline_show_qrcode_nonce'], 'miniorange-2-factor-inline-show-qrcode-nonce' )){
1508
+ initialize_inline_mobile_registration_frontend(); ?>
1509
+ <script>jQuery("#mo2f_app_div").hide();</script>
1510
+ <?php } ?>
1511
+
1512
+ </div>
1513
+
1514
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1515
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1516
+ <?php }?>
1517
+ </div>
1518
+ </div><!-- /.modal-content -->
1519
+ </div><!-- /.modal-dialog -->
1520
+ </div><!-- /.modal -->
1521
+ <style>
1522
+ .woocommerce .woocommerce-error {
1523
+ display: none !important;
1524
+ }
1525
+ .modal-backdrop{
1526
+ z-index: 0 !important;
1527
+ }
1528
+ #mo2f_inline_table td{
1529
+ border: none !important;
1530
+ }
1531
+ #mo2f_phone_id{
1532
+ margin: 0px !important;
1533
+ }
1534
+ </style>
1535
+ <script>
1536
+ jQuery('.woocommerce-error').hide();
1537
+ jQuery('#myModal9').modal('show');
1538
+
1539
+ function mologinback(){
1540
+ jQuery('#mo2f_2fa_form_close').submit();
1541
+ }
1542
+
1543
+ function moconfigureapp(){
1544
+ jQuery('#mo2f_inline_configureapp_form').submit();
1545
+ }
1546
+ jQuery('#mo2f_inline_back_btn').click(function() {
1547
+ jQuery('#mo2f_goto_two_factor_form').submit();
1548
+ });
1549
+ </script>
1550
+
1551
+
1552
+ <?php }
1553
+ function initialize_inline_mobile_registration_frontend(){
1554
+ $data = $_SESSION[ 'mo2f-login-qrCode' ];
1555
+ $url = get_option('mo2f_host_name');
1556
+ $opt = (array) get_option('mo2f_auth_methods_for_users');
1557
+ ?>
1558
+
1559
+ <p style="font-size: 15px !important;">Open your <b>miniOrange Authenticator</b> app and click on <b>Configure button</b> to scan the QR Code. Your phone should have internet connectivity to scan QR code.</p>
1560
+ <div class="red">
1561
+ <p style="font-size: 15px !important;color: red;">I am not able to scan the QR code, <a data-toggle="collapse" href="#mo2f_scanqrcode" aria-expanded="false" >click here </a></p></div>
1562
+ <div class="mo2f_collapse" id="mo2f_scanqrcode" style="padding-left:15px !important;">
1563
+ Follow these instructions below and try again.
1564
+ <ol>
1565
+ <li>Make sure your desktop screen has enough brightness.</li>
1566
+ <li>Open your app and click on Configure button to scan QR Code again.</li>
1567
+ <li>If you get cross mark on QR Code then click on 'Refresh QR Code' link.</li>
1568
+ </ol>
1569
+ </div>
1570
+
1571
+ <a href="#mo2f_refreshQRCode" style="font-size: 15px !important;">Click here to Refresh QR Code.</a>
1572
+ <div id="displayInlineQrCode" style="margin-left:300px;"><?php echo '<img style="width:200px;" src="data:image/jpg;base64,' . $data . '" />'; ?>
1573
+ </div>
1574
+ <?php
1575
+ if (sizeof($opt) > 1) { ?>
1576
+ <input type="button" name="back" id="mo2f_inline_back_to_btn" class="button" value="Back" />
1577
+ <?php } ?>
1578
+
1579
+
1580
+
1581
+ <script>
1582
+ jQuery('#mo2f_inline_back_to_btn').click(function() {
1583
+ jQuery('#mo2f_goto_two_factor_form').submit();
1584
+ });
1585
+ jQuery('a[href=\"#mo2f_refreshQRCode\"]').click(function(e) {
1586
+ jQuery('#mo2f_inline_configureapp_form').submit();
1587
+ });
1588
+ jQuery("#mo2f_configurePhone").hide();
1589
+ var timeout;
1590
+ pollInlineMobileRegistration();
1591
+ function pollInlineMobileRegistration()
1592
+ {
1593
+ var transId = "<?php echo $_SESSION[ 'mo2f-login-transactionId' ]; ?>";
1594
+ var jsonString = "{\"txId\":\""+ transId + "\"}";
1595
+ var postUrl = "<?php echo $url; ?>" + "/moas/api/auth/registration-status";
1596
+ jQuery.ajax({
1597
+ url: postUrl,
1598
+ type : "POST",
1599
+ dataType : "json",
1600
+ data : jsonString,
1601
+ contentType : "application/json; charset=utf-8",
1602
+ success : function(result) {
1603
+ var status = JSON.parse(JSON.stringify(result)).status;
1604
+ if (status == 'SUCCESS') {
1605
+ var content = "<br/><div id='success'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/right.png' , __FILE__ );?>" + "' /></div>";
1606
+ jQuery("#displayInlineQrCode").empty();
1607
+ jQuery("#displayInlineQrCode").append(content);
1608
+ setTimeout(function(){jQuery("#mo2f_inline_mobile_register_form").submit();}, 1000);
1609
+ } else if (status == 'ERROR' || status == 'FAILED') {
1610
+ var content = "<br/><div id='error'><img style='width:165px;margin-top:-1%;margin-left:2%;' src='" + "<?php echo plugins_url( 'includes/images/wrong.png' , __FILE__ );?>" + "' /></div>";
1611
+ jQuery("#displayInlineQrCode").empty();
1612
+ jQuery("#displayInlineQrCode").append(content);
1613
+ jQuery("#messages").empty();
1614
+
1615
+ jQuery("#messages").append("<div class='error mo2f_error_container'> <p class='mo2f_msgs'>An Error occured processing your request. Please try again to configure your phone.</p></div>");
1616
+ } else {
1617
+ timeout = setTimeout(pollInlineMobileRegistration, 3000);
1618
+ }
1619
+ }
1620
+ });
1621
+ }
1622
+ </script>
1623
+ <?php }
1624
+
1625
+ function prompt_user_for_kba_setup_frontend($current_user){
1626
+ $opt = (array) get_option('mo2f_auth_methods_for_users'); ?>
1627
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="myModal11">
1628
+ <div class="mo2f-modal-backdrop"></div>
1629
+ <div class="mo2f_modal-dialog mo2f_modal-lg">
1630
+ <div class="mo2f_modal-content">
1631
+ <div class="mo2f_modal-header">
1632
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1633
+ Setup Security Questions (KBA)</h4>
1634
+ </div>
1635
+ <div class="mo2f_modal-body">
1636
+ <p id="validation_msg"><?php echo $_SESSION['mo2f-login-message']; ?></p>
1637
+ <div class="mo_margin_left">
1638
+ <?php mo2f_configure_kba_questions(); ?>
1639
+ <br />
1640
+ <?php if (sizeof($opt) > 1) { ?>
1641
+ <input type="button" name="back" id="mo2f_inline_back_btn" class="button" value="Back" />
1642
+ <?php } ?>
1643
+ <input type="button" name="validate" onclick="moinlinesavekba();" class="button" value="Save" />
1644
+ </div>
1645
+
1646
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1647
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1648
+ <?php }?>
1649
+ </div>
1650
+ </div><!-- /.modal-content -->
1651
+ </div><!-- /.modal-dialog -->
1652
+ </div><!-- /.modal -->
1653
+ <style>
1654
+ .woocommerce .woocommerce-error {
1655
+ display: none !important;
1656
+ }
1657
+ .modal-backdrop{
1658
+ z-index: 0 !important;
1659
+ }
1660
+ </style>
1661
+ <script>
1662
+ jQuery('.woocommerce-error').hide();
1663
+ jQuery('#myModal11').modal('show');
1664
+
1665
+ function mologinback(){
1666
+ jQuery('#mo2f_2fa_form_close').submit();
1667
+ }
1668
+
1669
+ function moinlinesavekba(){
1670
+ var kba_1 = jQuery('#mo2f_kbaquestion_1').val();
1671
+ var kba_2 = jQuery('#mo2f_kba_ans1').val();
1672
+ var kba_3 = jQuery('#mo2f_kbaquestion_2').val();
1673
+ var kba_4 = jQuery('#mo2f_kba_ans2').val();
1674
+ var kba_5 = jQuery('#mo2f_kbaquestion_3').val();
1675
+ var kba_6 = jQuery('#mo2f_kba_ans3').val();
1676
+
1677
+ var regx = /^[a-zA-z0-9_@.$#&+-\s]*$/;
1678
+
1679
+ if(!(kba_2.match(regx) && kba_4.match(regx) && kba_6.match(regx))){
1680
+ jQuery('#validation_msg').append("Only alphanumeric letters with special characters (_@.$#&amp;+-) are allowed.");
1681
+ return;
1682
+ }
1683
+
1684
+ document.getElementById("mo2f_inline_save_kba_form").elements[0].value = kba_1;
1685
+ document.getElementById("mo2f_inline_save_kba_form").elements[1].value = kba_2;
1686
+ document.getElementById("mo2f_inline_save_kba_form").elements[2].value = kba_3;
1687
+ document.getElementById("mo2f_inline_save_kba_form").elements[3].value = kba_4;
1688
+ document.getElementById("mo2f_inline_save_kba_form").elements[4].value = kba_5;
1689
+ document.getElementById("mo2f_inline_save_kba_form").elements[5].value = kba_6;
1690
+ document.getElementById("mo2f_inline_save_kba_form").elements[6].value = '';
1691
+ jQuery('#mo2f_inline_save_kba_form').submit();
1692
+ }
1693
+ jQuery('#mo2f_inline_back_btn').click(function() {
1694
+ jQuery('#mo2f_goto_two_factor_form').submit();
1695
+ });
1696
+ </script>
1697
+
1698
+ <?php }
1699
+
1700
+ function prompt_user_for_setup_success_frontend($id){
1701
+ $mo2f_second_factor = get_user_meta($id,'mo2f_selected_2factor_method',true);
1702
+ if($mo2f_second_factor == 'OUT OF BAND EMAIL'){
1703
+ $mo2f_second_factor = 'Email Verification';
1704
+ }else if($mo2f_second_factor == 'SMS'){
1705
+ $mo2f_second_factor = 'OTP over SMS';
1706
+ }else if($mo2f_second_factor == 'PHONE VERIFICATION'){
1707
+ $mo2f_second_factor = 'Phone Call Verification';
1708
+ }else if($mo2f_second_factor == 'SOFT TOKEN'){
1709
+ $mo2f_second_factor = 'Soft Token';
1710
+ }else if($mo2f_second_factor == 'MOBILE AUTHENTICATION'){
1711
+ $mo2f_second_factor = 'QR Code Authentication';
1712
+ }else if($mo2f_second_factor == 'PUSH NOTIFICATIONS'){
1713
+ $mo2f_second_factor = 'Push Notification';
1714
+ }else if($mo2f_second_factor == 'GOOGLE AUTHENTICATOR'){
1715
+ $mo2f_second_factor = 'Google Authenticator';
1716
+ }else if($mo2f_second_factor == 'AUTHY 2-FACTOR AUTHENTICATION'){
1717
+ $mo2f_second_factor = 'Authy 2-Factor Authentication';
1718
+ }else if($mo2f_second_factor == 'KBA'){
1719
+ $mo2f_second_factor = 'Security Questions (KBA)';
1720
+ }
1721
+ $status = get_user_meta($id,'mo_2factor_user_registration_status',true);
1722
+ ?>
1723
+ <div class="mo2f_modal" tabindex="-1" role="dialog" id="mo2f_modal_inline_setup">
1724
+ <div class="mo2f-modal-backdrop"></div>
1725
+ <div class="mo2f_modal-dialog mo2f_modal-lg">
1726
+ <div class="mo2f_modal-content">
1727
+ <div class="mo2f_modal-header">
1728
+ <h4 class="mo2f_modal-title"><button type="button" class="mo2f_close" data-dismiss="modal" aria-label="Close" title="Back to login" onclick="mologinback();"><span aria-hidden="true">&times;</span></button>
1729
+ Two Factor Setup Complete</h4>
1730
+ </div>
1731
+ <div class="mo2f_modal-body">
1732
+ <?php if($status == 'MO_2_FACTOR_PLUGIN_SETTINGS'){
1733
+ ?>
1734
+ <center>
1735
+ <h4 style="font-size: 20px !important;><b style="color:#7EAFB7;"><?php echo $mo2f_second_factor; ?> </b>has been set your Two Factor method for login.<br>
1736
+ Next time when you will login, you will be prompted <?php echo $mo2f_second_factor; ?> as your 2nd factor.
1737
+ </h4><br />
1738
+ </center>
1739
+
1740
+ <?php } if($status != 'MO_2_FACTOR_PLUGIN_SETTINGS'){
1741
+ ?><center><div id="validation_msg" style="color:red;"></div></center>
1742
+ <div id="mo2f_show_kba_reg" class="mo2f_inline_padding">
1743
+ <div id="mo2f_kba_browser">
1744
+ <div class="mo2fa_display_message_frontend"> Please set your security questions. It will be used as an alternate login or backup method for all authentication methods. It will also be used as 2nd factor when you will try to login from mobile browser.</div>
1745
+ </div>
1746
+ <?php echo isset($_SESSION[ 'mo2f-login-message' ]) ? '<p style="color:red;" >' . $_SESSION[ 'mo2f-login-message' ] . '</p>': '';?>
1747
+ <?php mo2f_configure_kba_questions(); ?>
1748
+ <input type="button" name="validate" onclick="moinlinesavekba();" class="button" value="Save" />
1749
+ </div>
1750
+ <?php }
1751
+ if($status == 'MO_2_FACTOR_PLUGIN_SETTINGS'){ ?>
1752
+ <center>
1753
+ <br /><br />
1754
+ <div style="font-size: 16px !important"><a href="#mo2f_login_account">Click Here</a></div><div style="font-size: 16px !important">to sign-in into your account.</div>
1755
+ <br>
1756
+ </center>
1757
+ <?php } ?>
1758
+ <?php if(get_option('mo2f_disable_poweredby') != 1 ){?>
1759
+ <div class="mo2f_powered_by_div"><a target="_blank" href="http://miniorange.com/2-factor-authentication"><div class="mo2f_powered_by_miniorange" style="background-image: url('<?php if(get_option('mo2f_enable_custom_poweredby')==1) echo site_url().'/wp-content/uploads/custom.png'; else echo plugins_url('/includes/images/miniOrange2.png',__FILE__); ?>');"></div></a></div>
1760
+ <?php }?>
1761
+ </div>
1762
+
1763
+ </div>
1764
+ </div>
1765
+ </div>
1766
+ <style>
1767
+ .woocommerce .woocommerce-error {
1768
+ display: none !important;
1769
+ }
1770
+ .modal-backdrop{
1771
+ z-index: 0 !important;
1772
+ }
1773
+ .mo2f_kba_table{
1774
+ table-layout: auto !important;
1775
+ }
1776
+ .mo2f_kba_table td{
1777
+ border: none !important;
1778
+ }
1779
+ </style>
1780
+ <script>
1781
+ jQuery('.woocommerce-error').hide();
1782
+ jQuery('#mo2f_modal_inline_setup').modal('show');
1783
+
1784
+
1785
+ jQuery('a[href=\"#mo2f_login_account\"]').click(function(e) {
1786
+ jQuery('#mo2f_inline_register_skip_form').submit();
1787
+ });
1788
+ function moinlinesavekba(){
1789
+ var kba_1 = jQuery('#mo2f_kbaquestion_1').val();
1790
+ var kba_2 = jQuery('#mo2f_kba_ans1').val();
1791
+ var kba_3 = jQuery('#mo2f_kbaquestion_2').val();
1792
+ var kba_4 = jQuery('#mo2f_kba_ans2').val();
1793
+ var kba_5 = jQuery('#mo2f_kbaquestion_3').val();
1794
+ var kba_6 = jQuery('#mo2f_kba_ans3').val();
1795
+
1796
+ var regx = /^[a-zA-z0-9_@.$#&+-\s]*$/;
1797
+
1798
+ if(!(kba_2.match(regx) && kba_4.match(regx) && kba_6.match(regx))){
1799
+ jQuery('#validation_msg').empty().append("Only alphanumeric letters with special characters (_@.$#&amp;+-) are allowed.");
1800
+ return;
1801
+ }
1802
+
1803
+ document.getElementById("mo2f_inline_save_kba_form").elements[0].value = kba_1;
1804
+ document.getElementById("mo2f_inline_save_kba_form").elements[1].value = kba_2;
1805
+ document.getElementById("mo2f_inline_save_kba_form").elements[2].value = kba_3;
1806
+ document.getElementById("mo2f_inline_save_kba_form").elements[3].value = kba_4;
1807
+ document.getElementById("mo2f_inline_save_kba_form").elements[4].value = kba_5;
1808
+ document.getElementById("mo2f_inline_save_kba_form").elements[5].value = kba_6;
1809
+ document.getElementById("mo2f_inline_save_kba_form").elements[6].value = 'mo2f_inline_kba_registration';
1810
+ jQuery('#mo2f_inline_save_kba_form').submit();
1811
+ }
1812
+ function mologinback(){
1813
+ jQuery('#mo2f_2fa_form_close').submit();
1814
+ }
1815
+ </script>
1816
+ <?php
1817
+ }
readme.txt ADDED
@@ -0,0 +1,610 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Google Authenticator - Two Factor Authentication ===
2
+ Contributors: miniOrange
3
+ Tags: google authenticator, two factor authentication, two factor, 2FA, 2 factor authentication, two step verification, 1 google authenticator, login, authy, authy two factor, Clef, 2 Factor, yubico, Two-Factor Authentication, Mobile Authentication, otp, strong authentication, 2 step authentication, smartphone authentication, Multifactor authentication, multi factor authentication, multi factor, no password, passwordless login, security, website security, one time passcode, password, soft token, woocommerce, authenticate, two factor auth, two-factor, duo, QR Code, QR Code Authentication, scan QR Code, wordfence, login security, google authenticator, google , email verification, trusted device, device Id , KBA , knowledge based authentication
4
+ Requires at least: 3.0.1
5
+ Tested up to: 4.7.3
6
+ Stable tag: 4.3.4
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ Google Authenticator and Best Enterprise Grade Two Factor Authentication. Fully supported QR Code,Push Notification,Remember Device,Authy,SMS,Email.
11
+
12
+ == Description ==
13
+
14
+ <h4>Migrating from Clef - We have got you covered</h4>
15
+
16
+ If you are migrating from Clef to Google Authenticator - Two Factor Authentication plugin then follow the steps below to easily setup the plugin and have the experience of Clef like.
17
+
18
+ * Install the plugin.
19
+ * Verify you email.
20
+ * Click on QR Code Authentication method.
21
+ * Scan the QR Code from the miniOrange Authenticator App.
22
+ * Step by Step direction are given in the plugin to help you setup the plugin.
23
+
24
+ A highly secure & easy to setup Two Factor Authentication (Google Authenticator) for your WordPress site. Rather than relying on a password alone, which can be phished or guessed, miniOrange Two Factor authentication (Google Authenticator) adds a second layer of security to your WordPress accounts. It protects your website from hacks and unauthorized login attempts.
25
+
26
+ This plugin provides two factor authentication during login. If you are looking for OTP Verification of users during <b>Registration</b> then we have a separate plugin for this. <a href="https://wordpress.org/plugins/miniorange-otp-verification/"> Click Here </a> to learn more.
27
+
28
+ * You can login using username + password + two-factor or username + two-factor.
29
+ * Two-Factor can be enabled for role wise.
30
+ * It can be deployed for your entire userbase in minutes.
31
+ * All types of phones are supported Smart Phones (iPhone, Android, BlackBerry), Basic Phones, Landlines, etc.
32
+ * If your phone is lost or stolen or discharged, we offer alternate login methods like OTP Over Email and Security Questions (KBA).
33
+ * If your phone is offline, you can use a one time passcode generated by app to login.
34
+ * It offers inline registration of users so you can simply activate and configure the plugin and you are all set.
35
+ * We support multi factor authentication for all type of phones.
36
+ * Soft Token, QR Code Authentication,Push Notification are supported by miniOrange Authenticator App.
37
+ * Google Authenticator method is supported by both Google Authenticator and Authy App. You can configure Google Authenticator method by Google Authenticator as well as Authy 2-Factor Authentication App.
38
+ * If you want to login from mobile browser then any authentication method can be converted into Security Questions (KBA) by just one click.
39
+ * You can customize the Security Questions (KBA). You can add your own setup of questions in the Security Questions list. Administrator as well as users both can add custom questions. Administrator can also decide how many questions user can setup for Security Questions.
40
+
41
+ <h4>Apps Supported by miniOrange Two Factor Authentication?</h4>
42
+ * miniOrange Authenticator App.
43
+ * Google Authenticator App.
44
+ * Authy 2-Factor Authentication App.
45
+
46
+ <h4>How is miniOrange Two Factor Auth different?</h4>
47
+ * We support multilpe authentication methods along with their backup method.
48
+ * We support Device Identification. If the user select remember device then in the next login from same device, user will not be prompted for Two Factor.
49
+ * We support Two Factor for Woocommerce frontend login theme.
50
+ * ShortCode is now available for different frontend custom login page.
51
+ * Two Factor Auth using ShortCode for Premium themes are also supported. If you need help for integrating Two Factor, you can contact us.
52
+ * It is very difficult to login into your site from mobile browser with second factor enabled. We provide you option that will convert any authentication method into Security Questions (KBA) on mobile browser.
53
+
54
+ <h4>How miniOrange Authenticator App is better?</h4>
55
+
56
+ We support both miniOrange Authenticator and Google Authenticator. But, we recommend you to use miniOrange Authenticator App as
57
+
58
+ * miniOrange Authenticator App <b>encrypts all data</b>, whereas Google Authenticator stores data in plain text.
59
+ * miniOrange Authenticator App has in-build <b>Pin-Protection</b> so you can protect your google authenticator keys or whole app using pin whereas Google Authenticator is not protected at all.
60
+ * miniOrange has better backup methods.
61
+ * No need to type in the code at all. <a href="http://miniorange.com/contact" target="_blank">Contact us</a> to get <b>miniOrange Autofill Plugin</b>, it can seamlessly connect your computer to your phone. Code will get auto filled and saved.
62
+
63
+ <h4>Free/Premium Version</h4>
64
+ By default, Two-Factor Authentication (Google Authenticatot) plugin for Wordpress is free for 1 user forever. Limited Authentication methods are included in the free version of plugin. Telephony credits are needed for certain authentication methods like Phone Verification, OTP over SMS. In order to protect more accounts or use enterprise features, you need to upgrade to premium version of plugin. Besides including all authentication methods, it has inline registration for all users, user management dashboard access, remember device, manage device profiles, customize options for email and sms templates,custom redirect after login,customize Security Questions (KBA) customized UI for login screens etc. You can upgrade to premium version of plugin to have these features.
65
+
66
+
67
+ Customized solutions and Active support is available. Email us at info@miniorange.com or call at +1 9786589387.
68
+
69
+ Ability to define trusted locations, trusted time of access and User behavior rules are supported. Email us at info@miniorange.com or call at +1 9786589387.
70
+
71
+ Single Sign on into any cloud application E.g Google Apps, Salesforce, Office 365, Box, DropBox etc are supported. Check out 3000+ apps that are supported here http://miniorange.com/single-sign-on-sso
72
+
73
+ miniOrange supports 15+ authentication methods. For a complete list of authentication methods please visit http://miniorange.com/strong_auth . If you want to have any other 2-factor for your WordPress site, <a href="http://miniorange.com/contact" target="_blank">Contact us</a>.
74
+
75
+ * One time passcodes (OTP) over SMS
76
+ * OTP over Email
77
+ * OTP over SMS and Email
78
+ * Out of Band SMS
79
+ * Out of Band Email
80
+ * Google Authenticator
81
+ * Soft Token (similar to google authenticator)
82
+ * Push Notification
83
+ * USB based Hardware token (<b>yubico</b>)
84
+ * Security Questions
85
+ * Mobile Authentication ( QR Code authentication )
86
+ * Voice Authentication (Biometrics)
87
+ * Phone Verification
88
+ * Device Identification
89
+ * Location
90
+ * Time of Access
91
+ * User Behavior
92
+
93
+ You can choose from any of the above two factor auth methods to augment your password based authentication. miniOrange multi factor authentication service works with all phone types, from landlines to smart-phone platforms.
94
+
95
+ For support please email us at info@miniorange.com or call us at +1 978 658 9387
96
+
97
+
98
+ == Installation ==
99
+
100
+ = From your WordPress dashboard =
101
+ 1. Visit `Plugins > Add New`
102
+ 2. Search for `miniOrange 2 Factor Authentication`. Find and Install `miniOrange 2 Factor Authentication`
103
+ 3. Activate the plugin from your Plugins page
104
+
105
+ = From WordPress.org =
106
+ 1. Download miniOrange 2 Factor Authentication.
107
+ 2. Unzip and upload the `miniorange-2-factor-authentication` directory to your `/wp-content/plugins/` directory.
108
+ 3. Activate miniOrange 2 Factor Authentication from your Plugins page.
109
+
110
+ = Once Activated =
111
+ 1. Select miniOrange 2-Factor from the left menu and follow the instructions.
112
+ 2. Once, you complete your setup. Click on Log Out button.
113
+ 3. Enter the username and click on `Login with miniOrange`.
114
+ 4. Scan QRCode from your miniOrange mobile app.
115
+ 5. If your mobile is offline, click on `Click here if your phone is offline`.
116
+ 6. In your miniOrange mobile app, click on Soft Token and enter OTP.
117
+ 7. Click on Validate
118
+
119
+ == Frequently Asked Questions ==
120
+
121
+ = I want to enable Two-Factor( 2FA ) role wise ? =
122
+
123
+ You can select the roles under Login Settings tab to enable the plugin role wise. [PREMIUM FEATURE]
124
+
125
+ = I have enabled Two-Factor(2FA) for all users, what happens if an end user tries to login but has not yet registered ? =
126
+
127
+ If a user has not setup Two-Factor yet, user has to register by inline registration that will be invoked during the login.
128
+
129
+ = I want to enable only one authentication method for my users. What shloud I do? =
130
+
131
+ You can select the authentication methods under Login Settings tab. The selected authentication methods will be shown to the user during inline registration. [PREMIUM FEATURE]
132
+
133
+ = I am getting the fatal error of call to undefined function json_last_error(). What should I do? =
134
+
135
+ Please check your php version. The plugin is supported in php version 5.3.0 or above. You need to upgrade your php version to 5.3.0 or above to use the plugin.
136
+
137
+ = I did not recieve OTP while trying to register with miniOrange. What should I do? =
138
+
139
+ The OTP is sent to your email address with which you have registered with miniOrange. If you can't see the email from miniOrange in your mails, please make sure to check your SPAM folder. If you don't see an email even in SPAM folder, please submit a query in our Support Section in the plugin or you can contact us at info@miniorange.com.
140
+
141
+ = I want to configure 2nd factor by Google Authenticator. =
142
+
143
+ Select the radio button next to Google Authenticator/Authy App and select the phone type and then scan the QR Code by Google Authenticator App. Enter the 6 digit code in the textbox and click on Save and verify buuton.
144
+
145
+ = I want to configure 2nd factor by Authy 2-Factor Authentication App. =
146
+
147
+ Select the radio button next to Google Authenticator/Authy App and select the phone type and then scan the QR Code by Authy 2-Factor Authentication App. Enter the 6 digit code from the Authy App into the textbox available and click on Save and Verifiy button.
148
+
149
+ = I forgot the password of my miniOrange account. How can I reset it? =
150
+
151
+ There are two cases according to the page you see - <br />
152
+ 1. Login with miniOrange screen: You should click on forgot password link. You will get a new password on your email address with which you have registered with miniOrange . Now you can login with the new password.
153
+
154
+ 2. Register with miniOrange screen: Enter your email ID and any random password in password and confirm password input box. This will redirect you to Login with miniOrange screen. Now follow first step.
155
+
156
+ = I have a custom / front-end login page on my site and I want the look and feel to remain the same when I add 2 factor ? =
157
+
158
+ If you have a custom login form other than wp-login.php then we will provide you the shortcode. Shortcode will work only for the customized login page created from wordpress plugins. We are not claiming that it will work with all the customized login page. In such case, custom work is needed to integrate two factor with your customized login page. You can submit a query in our <b>Support Section</b> in the plugin or you can contact us at info@miniorange.com for more details.
159
+
160
+ = I have Woocommerce theme login page on my site. How can I enable Two Factor ? =
161
+
162
+ If you have Woocommerce theme login then go to Advanced Options Tab and check Enable Two-Factor for Woocommerce Front End Login. If you need any help setting up 2-Factor for your Woocommerce theme login form, please submit a query in our Support Section in the plugin or you can contact us at info@miniorange.com.
163
+
164
+ = I have installed plugins which limit the login attempts like Limit Login Attempt, Loginizer, Wordfence etc. Is there any incompatibilities with these kind of plugins? =
165
+
166
+ The limit login attempt kind of plugins limit the number of login attempts and block the IP temporarily. So if you are using 2 factor along with these kind of plugins then you should increase the login attempts (minimum 5) so that you dont get locked out yourself.
167
+
168
+ = If you are using any Security Plugin in WordPress like Simple Security Firewall, All in One WP Security Plugin and you are not able to login with Two-Factor. =
169
+
170
+ Our Two-Factor plugin is compatible with most of the security plugins, but if it is not working for you. Please submit a query in our Support Section in the plugin or you can contact us at info@miniorange.com.
171
+
172
+ = If you are using any render blocking javascript and css plugin like Async JS and CSS Plugin and you are not able to login with Two-Factor or your screen got blank. =
173
+
174
+ If you are using Async JS and CSS Plugin. Please go to its settings and add jquery in the list of exceptions and save settings. It will work. If you are still not able to get it right, Please submit a query in our Support Section in the plugin or you can contact us at info@miniorange.com.
175
+
176
+ = My users have different types of phones. What phones are supported? =
177
+
178
+ We support all types of phones. Smart Phones, Basic Phones, Landlines, etc. Go to Setup Two-Factor Tab and select Two-Factor method of your choice from a range of 8 different options.
179
+
180
+ = What if a user does not have a smart phone? =
181
+
182
+ You can select OTP over SMS, Phone Call Verification or Email Verification as your Two-Factor method. All these methods are supported on basic phones.
183
+
184
+ = What if a user does not have any phone? =
185
+
186
+ You can select Email Verification or Security Questions (KBA) as your Two-Factor method.
187
+
188
+ = What if I am trying to login from my phone ? =
189
+
190
+ If your Security Questions (KBA) are configured then you will be asked to answer them when you are logging in from your phone.
191
+
192
+ = I want to hide default login form and just want to show login with phone? =
193
+
194
+ You should go to <b>Login Settings Tab</b> and check <b>Login with Phone Only</b> checkbox to hide the default login form.
195
+
196
+
197
+ = My phone has no internet connectivity and configured 2nd factor with miniOrange App, how can I login? =
198
+
199
+ You can login using our alternate login method. Please follow below steps to login:
200
+
201
+ * Enter your username and click on login with your phone.
202
+ * Click on <b>Phone is Offline?</b> button below QR Code.
203
+ * You will see a textbox to enter one time passcode.
204
+ * Open miniOrange Authenticator App and Go to Soft Token Tab.
205
+ * Enter the one time passcode shown in miniOrange Authenticator App in textbox, just like google authenticator.
206
+ * Click on submit button to validate the otp.
207
+ * Once you are authenticated, you will be logged in.
208
+
209
+ = My phone is lost, stolen or discharged. How can I login? =
210
+
211
+ You can login using our alternate login method. Click on the Forgot Phone link and you will get 2 alternate methods to login. Select "Send a one time passcode to my registered email" to authenticate by OTP over EMAIL or Select "Answer your Security Questions (KBA)" to authenticate by knowledge based authenticaion.
212
+
213
+ = My phone has no internet connectivity and i am entering the one time passcode from miniOrange Authenticator App, it says Invalid OTP? =
214
+
215
+ Click on the <b>Settings Icon</b> on top right corner in <b>miniOrange Authenticator App</b> and then press <b>Sync button</b> under 'Time correction for codes' to sync your time with miniOrange Servers. If you still can't logged in then please email us at info@miniorange.com or <a href="http://miniorange.com/contact" target="_blank">Contact us</a>.Soft Token method is just like google authenticator method.
216
+
217
+ = I want to go back to default login with password? =
218
+
219
+ You should go to <b>Login Settings Tab</b> and uncheck <b>Enable Two-Factor plugin</b> checkbox. This will disable 2-Factor and you can login using wordpress default login.
220
+
221
+ = I am upgrading my phone. =
222
+
223
+ You should go to <b>Setup Two Factor</b> Tab and click on <b>Reconfigure</b> to reconfigure 2-Factor with your new phone.
224
+
225
+ = What If I want to use any other second factor like OTP Over SMS, Security Questions, Device Id, etc ? =
226
+
227
+ miniOrange authentication service has 15+ authentication methods.One time passcodes (OTP) over SMS, OTP over Email, OTP over SMS and Email, Out of Band SMS, Out of Band Email, Soft Token, Push Notification, USB based Hardware token (yubico), Security Questions, Mobile Authentication (QR Code Authentication), Voice Authentication (Biometrics), Phone Verification, Device Identification, Location, Time of Access User Behavior. To know more about authentication methods, please visit <a href="http://miniorange.com/strong_auth" target="_blank">http://miniorange.com/strong_auth </a>. If you want to have any other 2-factor for your WordPress site, please email us at info@miniorange.com or <a href="http://miniorange.com/contact" target="_blank">Contact us</a>.
228
+
229
+ == Screenshots ==
230
+
231
+ 1. Setup different 2-Factor methods
232
+ 2. 2 Factor plugin settings.
233
+ 3. Advance plugin settings
234
+ 4. Login form option1 (Enter username)
235
+ 5. Login form option2 (Enter username)
236
+ 6. QR Code Authentication Login Screen ( Authenticate your mobile )
237
+ 7. OTP Login Screen ( OTP over SMS,Phone Call Verifiction,Soft Token,Google Authenticator )
238
+ 8. Push Notification and Email Verification
239
+
240
+
241
+ == Changelog ==
242
+
243
+ = 4.3.1 =
244
+ * Google Authenticator (Two Factor): Compatible upto 4.7
245
+
246
+ = 4.3.0 =
247
+ * Google Authenticator (Two Factor): Updated miniOrange APIs.
248
+
249
+ = 4.2.9 =
250
+ * Google Authenticator (Two Factor): Tested upto WordPress 4.6.
251
+
252
+ = 4.2.7 =
253
+ * Google Authenticator (Two Factor): Session Warnig fix in the last version for some of the users.
254
+
255
+ = 4.2.6 =
256
+ * Google Authenticator (Two Factor): Compatible with wordpress caching.
257
+
258
+ = 4.2.5 =
259
+ * Google Authenticator (Two Factor): Improved the session handler.
260
+
261
+ = 4.2.4 =
262
+ * Google Authenticator (Two Factor): Updated faq for limit login attempt type of plugins.
263
+
264
+ = 4.2.3 =
265
+ * Google Authenticator Two Factor Auth ( 2FA ):
266
+ * Improved Error handling during Account Creation.
267
+
268
+ = 4.2.2 =
269
+ * Google Authenticator Two Factor Auth ( 2FA ):
270
+ * Registration Flow fixes
271
+
272
+ = 4.2.1 =
273
+ * Google Authenticator Two Factor Auth ( 2FA ):
274
+ * Change of status during login with phone flow and tested with WP 4.5
275
+
276
+ = 4.2.0 =
277
+ * Google Authenticator Two Factor Auth ( 2FA ):
278
+ * Mark as tested on Wordpress 4.5
279
+
280
+ = 4.1.8 =
281
+ * Google Authenticator Two Factor Auth ( 2FA ):
282
+ * Changed the location of images used for demo. Now being loaded from the site having SSL certificate.
283
+
284
+ = 4.1.7 =
285
+ * Google Authenticator Two Factor Auth ( 2FA ):
286
+ * Improved Error Handling for Remember Device.
287
+
288
+ = 4.1.6 =
289
+ * Google Authenticator Two Factor Auth ( 2FA ):
290
+ * Licensing Plan Updated.
291
+
292
+ = 4.1.5 =
293
+ * Google Authenticator Two Factor Auth ( 2FA ):
294
+ * Added Forgot Password functionality for miniOrange customer admin.
295
+ * Added warning message for the users who are using lower version of php.
296
+ * Added functionlity to change the customer email.
297
+
298
+ = 4.1.4 =
299
+ * Google Authenticator Two Factor Auth ( 2FA ):
300
+ * Added an option for admin to enable or disable login for XML-RPC supported applications.
301
+
302
+ = 4.1.3 =
303
+ * Google Authenticator Two Factor Auth ( 2FA ):
304
+ * Fixed CSS Conflict with the plugins in the admin dashboard.
305
+ * More intuitive UI for woocommerce login.
306
+ * Tested front-end login with themes like wordpress default theme,
307
+ customizr theme,zerif-lite theme,accesspress store theme,ishop theme and many more.
308
+
309
+ = 4.1.2 =
310
+ * Google Authenticator Two Factor Auth ( 2FA ): Google Authenticator for Windows phone
311
+ * Fixed CSS conflict with front-end of site if woocommerce is not enabled.
312
+
313
+ = 4.1.1 =
314
+ * Google Authenticator Two Factor Auth ( 2FA ): Adding Validation in choosing Security Questions (KBA).
315
+
316
+ = 4.1.0 =
317
+ * Google Authenticator Two Factor Auth ( 2FA ): Features added.
318
+ multisite support
319
+ Custom login redirection
320
+ Authy 2-Factor Authentication as separate authentication method
321
+
322
+ = 4.0.5 = Login into third party apps which support XML-RPC.
323
+
324
+ = 4.0.4 = Added a check of KBA configuration from mobile login.
325
+
326
+ = 4.0.3 = Added Support for Authy 2-Factor Authentication App.
327
+
328
+ = 4.0.2 = Added a check for selection of unique questions during KBA setup.
329
+
330
+ = 4.0.1 = Bug Fix
331
+
332
+ = 4.0 =
333
+ * Two Factor Auth ( 2FA ): Features added.
334
+ * KBA as backup method.
335
+ * mobile browser support.
336
+ * more intuitive UI for woocommerce login.
337
+
338
+ = 3.8 =
339
+ * Two Factor Auth ( 2FA ): Bug Fix.
340
+
341
+ = 3.7 =
342
+ * Two Factor Auth ( 2FA ): Activation of two factor role wise.
343
+
344
+ = 3.6 =
345
+ * Two Factor Auth ( 2FA ): email verification in inline registration flow for all users.
346
+ More descriptive setup messages and UI changes.
347
+
348
+ = 3.5 =
349
+ * Two Factor Auth ( 2FA ): Provided mobile login support.
350
+
351
+ = 3.4 =
352
+ * Two Factor Auth ( 2FA ): Features added
353
+ * Inline registration flow for users.
354
+ * Security Questions (KBA) as additional method
355
+ * Alternate way of user identification in customer creation.
356
+ * premium customizable features.
357
+
358
+ = 3.3 =
359
+ * Two Factor Auth ( 2FA ): Fix the issue of session for some versions of php.
360
+
361
+ = 3.2 =
362
+ * Two Factor Auth ( 2FA ): Fix for device-id compatibility.
363
+
364
+ = 3.1 =
365
+ * Two Factor Auth ( 2FA ): Fix for 2FA ShortCode.
366
+
367
+ = 3.0 =
368
+ * Two Factor Auth ( 2FA ): Features added
369
+ * Google Authenticator.
370
+ * Device Id (Remember device).
371
+ * Choice given to admin to enable specific authentication methods for users.
372
+ * Two Factor support for woocommerce theme.
373
+ * Short Code for various customized frontend login.
374
+ * More intuitive UI and descriptive instructions.
375
+
376
+ = 2.6 =
377
+ * Two Factor Auth ( 2FA ): Fix the compatibility issues of user session with other security plugins.
378
+
379
+ = 2.5 =
380
+ * Two Factor Auth ( 2FA ): Fix the compatibility issues with All In One WP Security & Firewall plugin.
381
+
382
+ = 2.4 =
383
+ * Two Factor Auth ( 2FA ): UI fixes for admin media library dashboard.
384
+
385
+ = 2.3 =
386
+ * Two Factor Auth ( 2FA ): More descriptive setup messages, more intuitive UI.
387
+
388
+ = 2.2 =
389
+ * Two Factor Auth ( 2FA ): Fixed css issues for existing users
390
+
391
+ = 2.1 =
392
+ * Two Factor Auth ( 2FA ): Added support for multiple Two Factor Choices like OTP Over SMS, Phone Call Verification, Push Notification, Soft Token (like Google Authenticator Code), Email Verification, etc.
393
+
394
+ = 2.0 =
395
+ * Two Factor Auth ( 2FA ): Added login with password plus second factor feature.
396
+
397
+ = 1.8 =
398
+ * Two Factor Auth ( 2FA ): Added feature of different login form choice,test authentication and help for configuration and setup.
399
+
400
+ = 1.7 =
401
+ * Bug Fixes Two Factor Auth ( 2FA ): Modifying login screen adaptable to user's login form
402
+
403
+ = 1.6 =
404
+ * Bug Fixes Two Factor Auth ( 2FA ): fetching 2 factor configuration when activating the plugin after deactivating it.
405
+
406
+ = 1.5 =
407
+ * Bug Fixes Two Factor Auth ( 2FA ): Login issues and password save issues resolved
408
+
409
+ = 1.4 =
410
+ * Bug Fixes Two Factor Auth ( 2FA ): Authentication was not working on some version of php.
411
+
412
+ = 1.3 =
413
+ * Bug Fixes
414
+
415
+ = 1.2 =
416
+ * Two Factor Auth ( 2FA ): Added 2 factor for all users along with forgot phone functionality.
417
+
418
+ = 1.1 =
419
+ * Two Factor Auth ( 2FA ): Added email ID verification during registration.
420
+
421
+ = 1.0.0 =
422
+ * First version of Two Factor Auth ( 2FA ) plugin supported with mobile auhthentication for admin only.
423
+
424
+ == Upgrade Notice ==
425
+
426
+ = 4.3.2 =
427
+ * Google Authenticator (Two Factor): Revised licensing cost for users.
428
+
429
+ = 4.3.1 =
430
+ * Google Authenticator (Two Factor): Compatible upto 4.7
431
+
432
+ = 4.3.0 =
433
+ * Google Authenticator (Two Factor): Updated miniOrange APIs.
434
+
435
+ = 4.2.9 =
436
+ * Google Authenticator (Two Factor): Tested upto WordPress 4.6.
437
+
438
+ = 4.2.7 =
439
+ * Google Authenticator (Two Factor): Session Warnig fix in the last version for some of the users.
440
+
441
+ = 4.2.6 =
442
+ * Google Authenticator (Two Factor): Compatible with wordpress caching.
443
+
444
+ = 4.2.5 =
445
+ * Google Authenticator (Two Factor): Improved the session handler.
446
+
447
+ = 4.2.4 =
448
+ * Google Authenticator (Two Factor): Updated faq for limit login attempt type of plugins.
449
+
450
+ = 4.2.3 =
451
+ * Two Factor Auth ( 2FA ):
452
+ * Improved Error handling during Account Creation.
453
+
454
+ = 4.2.2 =
455
+ * Two Factor Auth ( 2FA ):
456
+ * Registration Flow fixes
457
+
458
+ = 4.2.1 =
459
+ * Two Factor Auth ( 2FA ):
460
+ * Change of status during login with phone flow and tested with WP 4.5
461
+
462
+ = 4.2.0 =
463
+ * Two Factor Auth ( 2FA ):
464
+ * Mark as tested on Wordpress 4.5
465
+
466
+ = 4.1.8 =
467
+ * Two Factor Auth ( 2FA ):
468
+ * Changed the location of images used for demo. Now being loaded from the site having SSL certificate.
469
+
470
+ = 4.1.7 =
471
+ * Two Factor Auth ( 2FA ):
472
+ * Improved Error Handling for Remember Device.
473
+
474
+ = 4.1.6 =
475
+ * Two Factor Auth ( 2FA ):
476
+ * Licensing Plan Updated.
477
+
478
+ = 4.1.5 =
479
+ * Two Factor Auth ( 2FA ):
480
+ * Added Forgot Password functionality for miniOrange customer admin.
481
+ * Added warning message for the users who are using lower version of php.
482
+ * Added functionlity to change the customer email.
483
+
484
+ = 4.1.4 =
485
+ * Two Factor Auth ( 2FA ):
486
+ * Added an option for admin to enable or disable login for XML-RPC supported applications.
487
+
488
+ = 4.1.3 =
489
+ * Two Factor Auth ( 2FA ):
490
+ * Fixed CSS Conflict with the plugins in the admin dashboard.
491
+ * More intuitive UI for woocommerce login.
492
+ * Tested front-end login with themes like wordpress default theme,
493
+ customizr theme,zerif-lite theme,accesspress store theme,ishop theme and many more.
494
+
495
+ = 4.1.2 =
496
+ * Two Factor Auth ( 2FA ): Google Authenticator for Windows phone
497
+ * Fixed CSS conflict with front-end of site if woocommerce is not enabled.
498
+
499
+ = 4.1.1 =
500
+ * Two Factor Auth ( 2FA ): Adding Validation in choosing Security Questions (KBA).
501
+
502
+ = 4.1.0 =
503
+ * Two Factor Auth ( 2FA ): Features added.
504
+ multisite support
505
+ Custom login redirection
506
+ Authy 2-Factor Authentication as separate authentication method
507
+
508
+ = 4.0.6 = Added multisite support and custom redirection after login feature.
509
+
510
+ = 4.0.5 = Login into third party apps which support XML-RPC.
511
+
512
+ = 4.0.4 = Added a check of KBA configuration from mobile login.
513
+
514
+ = 4.0.3 = Added Support for Authy 2-Factor Authentication App.
515
+
516
+ = 4.0.2 = Added a check for selection of unique questions during KBA setup.
517
+
518
+ = 4.0.1 = Bug Fix
519
+
520
+ = 4.0 =
521
+ * Two Factor Auth ( 2FA ): Features added.
522
+ * KBA as backup method.
523
+ * mobile browser support.
524
+ * more intuitive UI for woocommerce login.
525
+
526
+ = 3.8 =
527
+ * Two Factor Auth ( 2FA ): Bug Fix for roles.
528
+
529
+ = 3.7 =
530
+ * Two Factor Auth ( 2FA ): Activation of two factor role wise.
531
+
532
+ = 3.6 =
533
+ * Two Factor ( 2FA ): email verification in inline registration flow for all users.
534
+ More descriptive setup messages and UI changes.
535
+
536
+ = 3.5 =
537
+ * Two Factor ( 2FA ): Provided mobile login support.
538
+
539
+ = 3.4 =
540
+ * Two Factor ( 2FA ): Features added
541
+ * Inline registration flow for users.
542
+ * Security Questions (KBA) as additional method
543
+ * Alternate way of user identification in customer creation.
544
+ * premium customizable features.
545
+
546
+ = 3.3 =
547
+ * Two Factor ( 2FA ): Fix the issue of session for some versions of php.
548
+
549
+ = 3.2 =
550
+ * Two Factor ( 2FA ): Fix for device-id compatibility.
551
+
552
+ = 3.1 =
553
+ * Two Factor ( 2FA ): Fix for 2FA ShortCode.
554
+
555
+ = 3.0 =
556
+ * Two Factor ( 2FA ): Features added
557
+ * Google Authenticator.
558
+ * Device Id (Remember device).
559
+ * Choice given to admin to enable specific authentication methods for users.
560
+ * Two Factor support for woocommerce theme.
561
+ * Short Code for various customized frontend login.
562
+ * More intuitive UI and descriptive instructions.
563
+
564
+ = 2.6 =
565
+ * Two Factor ( 2FA ): Fix the compatibility issues of user session with other security plugins.
566
+
567
+ = 2.5 =
568
+ * Two Factor ( 2FA ): Fix the compatibility issues with All In One WP Security & Firewall plugin.
569
+
570
+ = 2.4 =
571
+ * Two Factor ( 2FA ): UI fixes for admin media library dashboard.
572
+
573
+ = 2.3 =
574
+ * Two Factor ( 2FA ): More descriptive setup messages, more intuitive UI.
575
+
576
+ = 2.2 =
577
+ * Two Factor ( 2FA ): Fixed css issues for existing users
578
+
579
+ = 2.1 =
580
+ * Two Factor ( 2FA ): Added support for multiple Two Factor Choices like OTP Over SMS, Phone Call Verification, Push Notification, Soft Token (like Google Authenticator Code), Email Verification, etc.
581
+
582
+ = 2.0 =
583
+ * Two Factor ( 2FA ): Added login with password plus second factor feature.
584
+
585
+ = 1.8 =
586
+ * Two Factor ( 2FA ): Added feature of different login form choice,test authentication and help for configuration and setup.
587
+
588
+ = 1.7 =
589
+ * Bug Fixes Two Factor ( 2FA ): Modifying login screen adaptable to user's login form
590
+
591
+ = 1.6 =
592
+ * Bug Fixes Two Factor ( 2FA ): fetching 2 factor configuration when activating the plugin after deactivating it.
593
+
594
+ = 1.5 =
595
+ * Bug Fixes Two Factor ( 2FA ): Login issues and password save issues resolved
596
+
597
+ = 1.4 =
598
+ * Bug Fixes Two Factor ( 2FA ): Authentication was not working on some version of php.
599
+
600
+ = 1.3 =
601
+ * Bug Fixes
602
+
603
+ = 1.2 =
604
+ * Two Factor ( 2FA ): Added 2 factor for all users along with forgot phone functionality.
605
+
606
+ = 1.1 =
607
+ * Two Factor ( 2FA ): Added email ID verification during registration.
608
+
609
+ = 1.0.0 =
610
+ First version of Two Factor ( 2FA ) plugin.
uninstall.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) ) {
3
+ exit();
4
+ }
5
+
6
+ if ( !is_multisite() ) {
7
+ //delete all your options
8
+ //E.g: delete_option( {option name} );
9
+ //delete all stored key-value pairs which are available to all users
10
+ delete_option('mo2f_email');
11
+ delete_option('mo2f_host_name');
12
+ delete_option('mo2f_phone');
13
+ delete_option('mo2f_customerKey');
14
+ delete_option('mo2f_api_key');
15
+ delete_option('mo2f_customer_token');
16
+ delete_option('mo2f_message');
17
+ delete_option('mo_2factor_admin_registration_status');
18
+ delete_option('mo2f-login-message');
19
+ delete_option('mo_2f_login_type_enabled');
20
+ delete_option('mo2f_admin_disabled_status');
21
+ delete_option('mo2f_disabled_status');
22
+ delete_option('mo2f_miniorange_admin');
23
+ delete_option('mo2f_enable_forgotphone');
24
+ delete_option('mo2f_show_loginwith_phone');
25
+ delete_option('mo2f_login_policy');
26
+ delete_option( 'mo2f_msg_counter');
27
+ delete_option( 'mo2f_activate_plugin');
28
+ delete_option( 'mo2f_enable_2fa_for_woocommerce');
29
+ delete_option( 'mo2f_auth_methods_for_users');
30
+ delete_option( 'mo2f_deviceid_enabled' );
31
+ delete_option( 'mo2f_app_secret' );
32
+ delete_option( 'mo2f_inline_registration' );
33
+ delete_option( 'mo2f_enable_custom');
34
+ delete_option( 'mo2f_disable_poweredby');
35
+ delete_option( 'mo2f_custom_plugin_name');
36
+ delete_option( 'mo2f_enable_custom_poweredby' );
37
+ delete_option( 'mo2f_enable_custom_icon' );
38
+ delete_option('mo2f_enable_mobile_support');
39
+ delete_option( 'mo2f_new_customer' );
40
+
41
+ //delete all stored key-value pairs for the roles
42
+ global $wp_roles;
43
+ if (!isset($wp_roles))
44
+ $wp_roles = new WP_Roles();
45
+ foreach($wp_roles->role_names as $id => $name) {
46
+ delete_option('mo2fa_'.$id);
47
+ delete_option('mo2fa_'.$id.'_login_url');
48
+ }
49
+ }
50
+ else {
51
+ global $wpdb;
52
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
53
+ $original_blog_id = get_current_blog_id();
54
+
55
+ foreach ( $blog_ids as $blog_id ){
56
+ switch_to_blog( $blog_id );
57
+ //delete all your options
58
+ //E.g: delete_option( {option name} );
59
+ delete_option('mo2f_email');
60
+ delete_option('mo2f_host_name');
61
+ delete_option('mo2f_phone');
62
+ delete_option('mo2f_customerKey');
63
+ delete_option('mo2f_api_key');
64
+ delete_option('mo2f_customer_token');
65
+ delete_option('mo2f_message');
66
+ delete_option('mo_2factor_admin_registration_status');
67
+ delete_option('mo2f-login-message');
68
+ delete_option('mo_2f_login_type_enabled');
69
+ delete_option('mo2f_admin_disabled_status');
70
+ delete_option('mo2f_disabled_status');
71
+ delete_option('mo2f_miniorange_admin');
72
+ delete_option('mo2f_enable_forgotphone');
73
+ delete_option('mo2f_show_loginwith_phone');
74
+ delete_option('mo2f_login_policy');
75
+ delete_option( 'mo2f_msg_counter');
76
+ delete_option( 'mo2f_activate_plugin');
77
+ delete_option( 'mo2f_enable_2fa_for_woocommerce');
78
+ delete_option( 'mo2f_auth_methods_for_users');
79
+ delete_option( 'mo2f_deviceid_enabled' );
80
+ delete_option( 'mo2f_app_secret' );
81
+ delete_option( 'mo2f_inline_registration' );
82
+ delete_option( 'mo2f_enable_custom');
83
+ delete_option( 'mo2f_disable_poweredby');
84
+ delete_option( 'mo2f_custom_plugin_name');
85
+ delete_option( 'mo2f_enable_custom_poweredby' );
86
+ delete_option( 'mo2f_enable_custom_icon' );
87
+ delete_option('mo2f_enable_mobile_support');
88
+ delete_option( 'mo2f_new_customer' );
89
+
90
+ //delete all stored key-value pairs for the roles
91
+ global $wp_roles;
92
+ if (!isset($wp_roles))
93
+ $wp_roles = new WP_Roles();
94
+ foreach($wp_roles->role_names as $id => $name) {
95
+ delete_option('mo2fa_'.$id);
96
+ delete_option('mo2fa_'.$id.'_login_url');
97
+ }
98
+
99
+ }
100
+ switch_to_blog( $original_blog_id );
101
+ }
102
+
103
+
104
+ //delete user specific key-value pair
105
+ $users = get_users( array() );
106
+ foreach ( $users as $user ) {
107
+ delete_user_meta($user->ID,'mo_2factor_user_registration_status');
108
+ delete_user_meta($user->ID,'mo_2factor_mobile_registration_status');
109
+ delete_user_meta($user->ID,'mo_2factor_user_registration_with_miniorange');
110
+ delete_user_meta($user->ID,'mo_2factor_map_id_with_email');
111
+ delete_user_meta($user->ID,'mo2f_user_phone');
112
+ delete_user_meta($user->ID,'mo2f_mobile_registration_status');
113
+ delete_user_meta($user->ID,'mo2f_otp_registration_status');
114
+ delete_user_meta($user->ID,'mo2f_configure_test_option');
115
+ delete_user_meta($user->ID,'mo2f_selected_2factor_method');
116
+ delete_user_meta($user->ID,'mo2f_google_authentication_status');
117
+ delete_user_meta($user->ID,'mo2f_kba_registration_status');
118
+ delete_user_meta($user->ID,'mo2f_email_verification_status');
119
+ delete_user_meta($user->ID,'mo2f_authy_authentication_status');
120
+ }
121
+
122
+ //delete previous version key-value pairs
123
+ delete_option('mo_2factor_admin_mobile_registration_status');
124
+ delete_option('mo_2factor_registration_status');
125
+ delete_option('mo_2factor_temp_status');
126
+ delete_option('mo2f_login_username');
127
+ delete_option('mo2f-login-qrCode');
128
+ delete_option('mo2f-login-transactionId');
129
+ delete_option('mo_2factor_login_status');
130
+ delete_option('mo2f_mowplink');
131
+ ?>