PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.2.0
Defender Security – Malware Scanner, Login Security & Firewall v6.2.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 / biometric.php

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

71 lines 2.2 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 notices.
4 *
5 * @package WP_Defender
6 */
7
8 foreach ( $notices as $notice ) {
9 $class = array( 'wpdef-notice', $notice['type'], $notice['extra_class'] );
10 $class[] = isset( $notice['is_dismissible'] ) && true === $notice['is_dismissible'] ? 'is-dismissible' : '';
11 $class = implode(
12 ' ',
13 array_filter(
14 $class,
15 function ( $value ) {
16 return is_string( $value ) && '' !== trim( $value );
17 }
18 )
19 );
20 ?>
21 <div class="<?php echo esc_attr( $class ); ?>" <?php echo $notice['style'] ? 'style="' . esc_attr( $notice['style'] ) . '"' : ''; ?>>
22 <p>
23 <span class="dashicons dashicons-<?php echo esc_attr( $notice['type'] ); ?>"></span>
24 <span class="wpdef-notice-message"><?php echo wp_kses_post( $notice['message'] ); ?></span>
25 </p>
26 <?php
27 if ( isset( $notice['is_dismissible'] ) && true === $notice['is_dismissible'] ) {
28 ?>
29 <button type="button" class="notice-dismiss">
30 <span class="screen-reader-text"><?php esc_attr_e( 'Dismiss', 'defender-security' ); ?></span>
31 </button>
32 <?php
33 }
34 ?>
35 </div>
36 <?php } ?>
37
38 <script type="text/javascript">
39 jQuery(function ($) {
40 maybeShowAdditionalAuthMethodNotice();
41 $('body').on('click', '.auth-methods-table .wpdef-ui-toggle', maybeShowAdditionalAuthMethodNotice);
42
43 $('.wpdef-notice.has-server-error .browser-incompatible-msg, .wpdef-notice.browser-notice').hide();
44 if (!checkBrowserSupportForWebauthn()) {
45 disableWebauthnFeature();
46 $('.wpdef-notice.has-server-error .browser-incompatible-msg, .wpdef-notice.browser-notice').show();
47 }
48
49 function checkBrowserSupportForWebauthn() {
50 return 'undefined' !== typeof PublicKeyCredential && ('credentials' in navigator);
51 }
52
53 function disableWebauthnFeature() {
54 $('.defender-biometric-wrap .wpdef-device-btn').attr('disabled', 'disabled');
55 }
56
57 function maybeShowAdditionalAuthMethodNotice() {
58 let $authTable = $('.auth-methods-table');
59
60 if (
61 1 === $authTable.find('.wpdef-ui-toggle:checked').length &&
62 1 === $authTable.find('#field-webauthn:checked').length
63 ) {
64 $authTable.find('.wpdef-notice.additional-2fa-method').show();
65 } else {
66 $authTable.find('.wpdef-notice.additional-2fa-method').hide();
67 }
68 }
69 });
70 </script>
71