Completed
Push — branch-7.5 ( 9378b5...5f3718 )
by Jeremy
211:39 queued 203:47
created

Protect::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Automattic\Jetpack\Sync\Modules;
4
5
use Automattic\Jetpack\Constants as Jetpack_Constants;
6
7
/**
8
 * logs bruteprotect failed logins via sync
9
 */
10
class Protect extends \Jetpack_Sync_Module {
11
12
	function name() {
13
		return 'protect';
14
	}
15
16
	function init_listeners( $callback ) {
17
		add_action( 'jpp_log_failed_attempt', array( $this, 'maybe_log_failed_login_attempt' ) );
18
		add_action( 'jetpack_valid_failed_login_attempt', $callback );
19
	}
20
21
	function maybe_log_failed_login_attempt( $failed_attempt ) {
22
		$protect = \Jetpack_Protect_Module::instance();
23
		if ( $protect->has_login_ability() && ! Jetpack_Constants::is_true( 'XMLRPC_REQUEST' ) ) {
24
			do_action( 'jetpack_valid_failed_login_attempt', $failed_attempt );
25
		}
26
	}
27
}
28