Révision 01dfd3b5
Ajouté par Assos Assos il y a plus de 3 ans
drupal7/modules/user/user.api.php | ||
---|---|---|
472 | 472 |
->execute(); |
473 | 473 |
} |
474 | 474 |
|
475 |
/** |
|
476 |
* Respond to user flood control events. |
|
477 |
* |
|
478 |
* This hook allows you act when an unsuccessful user login has triggered |
|
479 |
* flood control. This means that either an IP address or a specific user |
|
480 |
* account has been temporarily blocked from logging in. |
|
481 |
* |
|
482 |
* @param $ip |
|
483 |
* The IP address that triggered flood control. |
|
484 |
* @param $username |
|
485 |
* The username that has been temporarily blocked. |
|
486 |
* |
|
487 |
* @see user_login_final_validate() |
|
488 |
*/ |
|
489 |
function hook_user_flood_control($ip, $username = FALSE) { |
|
490 |
if (!empty($username)) { |
|
491 |
// Do something with the blocked $username and $ip. For example, send an |
|
492 |
// e-mail to the user and/or site administrator. |
|
493 |
|
|
494 |
// Drupal core uses this hook to log the event: |
|
495 |
watchdog('user', 'Flood control blocked login attempt for %user from %ip.', array('%user' => $username, '%ip' => $ip)); |
|
496 |
} |
|
497 |
else { |
|
498 |
// Do something with the blocked $ip. For example, add it to a block-list. |
|
499 |
|
|
500 |
// Drupal core uses this hook to log the event: |
|
501 |
watchdog('user', 'Flood control blocked login attempt from %ip.', array('%ip' => $ip)); |
|
502 |
} |
|
503 |
} |
|
504 |
|
|
475 | 505 |
/** |
476 | 506 |
* @} End of "addtogroup hooks". |
477 | 507 |
*/ |
Formats disponibles : Unified diff
Udpate to 7.77