PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.5.0
Defender Security – Malware Scanner, Login Security & Firewall v5.5.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / src / view / two-fa / providers / totp-enabled.php

totp-enabled.php in Defender Security – Malware Scanner, Login Security & Firewall 5.5.0, at src/view/two-fa/providers/totp-enabled.php

47 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template is used to display 2FA TOTP field and reset button.
4 *
5 * @package WP_Defender
6 */
7
8 ?>
9 <p class="error"></p>
10 <div id="defender-totp"></div>
11 <script type="text/javascript">
12 jQuery(function ($) {
13 // Toggle.
14 $('body').on('click', '#field-totp', function () {
15 var el = $('.reset-totp-keys');
16 if (this.checked) {
17 el.prop('disabled', false);
18 } else {
19 el.prop('disabled', true);
20 }
21 });
22 // Reset settings.
23 $('body').on('click', '.reset-totp-keys', function () {
24 var el = $(this);
25 $.ajax({
26 type: 'POST',
27 // $url is safe because it is generated via admin_url().
28 url: '<?php echo $url; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>',
29 data: {},
30 dataType: 'JSON',
31 beforeSend: function () {
32 el.attr('disabled', 'disabled');
33 },
34 success: function (data) {
35 if (data.success == true) {
36 $('#field-totp').prop('checked', false);
37 location.reload();
38 } else {
39 el.removeAttr('disabled');
40 el.closest('.well').find('.error').text(data.data.message).show();
41 }
42 }
43 });
44 })
45 })
46 </script>
47