function _login_security_remove_events in Login Security 8
Same name and namespace in other branches
- 6 login_security.module \_login_security_remove_events()
- 7 login_security.module \_login_security_remove_events()
- 2.x login_security.module \_login_security_remove_events()
Remove tracked events or expire old ones.
Parameters
string $name: If specified, events for this user name will be removed.
string $host: If specified, IP Address of the name-ip pair to be removed.
4 calls to _login_security_remove_events()
- login_security_cron in ./
login_security.module - Implements hook_cron().
- login_security_user_login in ./
login_security.module - Implements hook_user_login().
- login_security_user_update in ./
login_security.module - Implements hook_ENTITY_TYPE_update().
- login_security_validate in ./
login_security.module - Implements hook_validate().
File
- ./
login_security.module, line 277 - Login Security module hooks.
Code
function _login_security_remove_events($name = NULL, $host = NULL) {
$conf = \Drupal::config('login_security.settings');
// Remove selected events.
if (!empty($name)) {
if (!empty($host)) {
db_delete('login_security_track')
->condition('name', $name)
->condition('host', $host)
->execute();
}
else {
db_delete('login_security_track')
->condition('name', $name)
->execute();
}
}
else {
// Calculate protection time window and remove expired events.
$time = REQUEST_TIME - $conf
->get('track_time') * 3600;
_login_security_remove_all_events($time);
}
}