| @@ -344,23 +344,9 @@ | ||
| 344 | 344 | * @param string $scenario The scenario constant (e.g., SCENARIO_LOGIN_FAIL). |
| 345 | 345 | * @param string $message Additional message for the log. |
| 346 | 346 | */ |
| 347 | 347 | public function log_event( $ip, $username, $scenario, $message = '' ) { |
| 348 | - $user_agent = defender_get_data_from_request( 'HTTP_USER_AGENT', 's' ); | |
| 349 | - $model = new Lockout_Log(); | |
| 350 | - $model->ip = $ip; | |
| 351 | - $model->user_agent = isset( $user_agent ) | |
| 352 | - ? User_Agent::fast_cleaning( $user_agent ) | |
| 353 | - : null; | |
| 354 | - $model->date = time(); | |
| 355 | - $model->tried = $username; | |
| 356 | - $model->blog_id = get_current_blog_id(); | |
| 357 | - | |
| 358 | - $ip_to_country = $this->ip_to_country( $ip ); | |
| 359 | - | |
| 360 | - if ( isset( $ip_to_country['iso'] ) ) { | |
| 361 | - $model->country_iso_code = $ip_to_country['iso']; | |
| 362 | - } | |
| 348 | + $model = Lockout_Log::create( $ip, $username ); | |
| 363 | 349 | |
| 364 | 350 | switch ( $scenario ) { |
| 365 | 351 | case self::SCENARIO_LOGIN_FAIL: |
| 366 | 352 | $model->type = Lockout_Log::AUTH_FAIL; |