summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/class.jetpack-tracks.php')
-rw-r--r--plugins/jetpack/class.jetpack-tracks.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/plugins/jetpack/class.jetpack-tracks.php b/plugins/jetpack/class.jetpack-tracks.php
index f6c8aa3c..414cadfa 100644
--- a/plugins/jetpack/class.jetpack-tracks.php
+++ b/plugins/jetpack/class.jetpack-tracks.php
@@ -14,11 +14,12 @@ class JetpackTracking {
}
// For tracking stuff via js/ajax
- add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_tracks_scripts' ) );
+ add_action( 'admin_enqueue_scripts', array( __CLASS__, 'enqueue_tracks_scripts' ) );
add_action( 'jetpack_activate_module', array( __CLASS__, 'track_activate_module'), 1, 1 );
add_action( 'jetpack_deactivate_module', array( __CLASS__, 'track_deactivate_module'), 1, 1 );
- add_action( 'jetpack_user_authorized', array( __CLASS__, 'track_user_linked' ) );
+ add_action( 'jetpack_user_authorized', array( __CLASS__, 'track_user_linked' ) );
+ add_action( 'wp_login_failed', array( __CLASS__, 'track_failed_login_attempts' ) );
}
static function enqueue_tracks_scripts() {
@@ -58,9 +59,17 @@ class JetpackTracking {
self::record_user_event( 'module_deactivated', array( 'module' => $module ) );
}
- static function record_user_event( $event_type, $data= array() ) {
+ /* Failed login attempts */
+ static function track_failed_login_attempts( $login ) {
+ require_once( JETPACK__PLUGIN_DIR . 'modules/protect/shared-functions.php' );
+ self::record_user_event( 'failed_login', array( 'origin_ip' => jetpack_protect_get_ip(), 'login' => $login ) );
+ }
+
+ static function record_user_event( $event_type, $data= array(), $user = null ) {
- $user = wp_get_current_user();
+ if ( ! $user ) {
+ $user = wp_get_current_user();
+ }
$site_url = get_option( 'siteurl' );
$data['_via_ua'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT'] : '';