PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.3.1
Defender Security – Malware Scanner, Login Security & Firewall v5.3.1
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 5.3.1, at src/view/two-fa/providers/biometric.php

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