PluginProbe
Two Factor Authentication / 1.2.6
Two Factor Authentication v1.2.6
1.12.2 1.13.0 1.14.10 1.14.11 1.14.14 1.14.15 1.14.16 1.14.17 1.14.23 1.14.24 1.14.26 1.14.27 1.14.3 1.14.4 1.14.5 1.14.7 1.14.8 1.15.5 1.16.0 1.2.10 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 All 98 releases
two-factor-authentication / includes / user_settings.php

user_settings.php in Two Factor Authentication 1.2.6, at includes/user_settings.php

76 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) die('Access denied.');
4
5 global $current_user, $simba_two_factor_authentication, $wpdb;
6
7 // if (is_multisite() && (!is_super_admin() || !is_object($wpdb) || !isset($wpdb->blogid) || 1 != $wpdb->blogid)) {
8 // die("How did you get here?");
9 // return;
10 // }
11
12 if(!empty($_POST['tfa_enable_tfa']) && !empty($_GET['settings-updated'])) {
13 $tfa->changeEnableTFA($current_user->ID, $_POST['tfa_enable_tfa']);
14 $tfa_settings_saved = true;
15 } elseif (!empty($_POST['tfa_algorithm_type']) && !empty($_GET['settings-updated'])) {
16 $old_algorithm = $tfa->getUserAlgorithm($current_user->ID);
17
18 if($old_algorithm != $_POST['tfa_algorithm_type']) {
19 $tfa->changeUserAlgorithmTo($current_user->ID, $_POST['tfa_algorithm_type']);
20 }
21
22 $tfa_settings_saved = true;
23 }
24
25 if(isset($_GET['warning_button_clicked']) && $_GET['warning_button_clicked'] == 1) {
26 delete_user_meta($current_user->ID, 'tfa_hotp_off_sync');
27 }
28 ?>
29 <style>
30 #icon-tfa-plugin {
31 background: transparent url('<?php print plugin_dir_url(__FILE__); ?>img/tfa_admin_icon_32x32.png' ) no-repeat;
32 }
33 .inside > h3, .normal {
34 cursor: default;
35 margin-top: 20px;
36 }
37 </style>
38 <div class="wrap">
39
40 <?php screen_icon('tfa-plugin'); ?>
41 <h2><?php echo __('Two Factor Authentication', SIMBA_TFA_TEXT_DOMAIN).' '.__('Settings', SIMBA_TFA_TEXT_DOMAIN); ?></h2>
42
43 <?php
44
45 if (isset($tfa_settings_saved)) {
46 echo '<div class="updated notice is-dismissible">'."<p><strong>".__('Settings saved.', SIMBA_TFA_TEXT_DOMAIN)."</strong></p></div>";
47 }
48
49 $simba_two_factor_authentication->settings_intro_notices();
50
51 ?>
52
53 <!-- New Radios to enable/disable tfa -->
54 <form method="post" action="<?php print esc_url(add_query_arg('settings-updated', 'true', $_SERVER['REQUEST_URI'])); ?>">
55 <h2><?php _e('Activate two factor authentication', SIMBA_TFA_TEXT_DOMAIN); ?></h2>
56 <p>
57 <?php
58 $date_now = get_date_from_gmt(gmdate('Y-m-d H:i:s'), 'Y-m-d H:i:s');
59 echo sprintf(__('N.B. Generating two-factor codes depends upon your web-server and your TFA app/device agreeing upon the time. The current UTC time according to the server when this page loaded: %s', SIMBA_TFA_TEXT_DOMAIN), htmlspecialchars($date_now));
60 ?>
61 </p>
62 <p>
63 <?php
64 $simba_two_factor_authentication->tfaListEnableRadios($current_user->ID);
65 ?></p>
66 <?php submit_button(); ?>
67 </form>
68 <?php
69
70 $simba_two_factor_authentication->current_codes_box();
71
72 $simba_two_factor_authentication->advanced_settings_box();
73
74 ?>
75
76 </div>