diff options
author | mistic100 <mistic@piwigo.org> | 2013-01-20 11:50:08 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-01-20 11:50:08 +0000 |
commit | ff5568afecfd15d7463eaab0fe2000b6c49e3ec2 (patch) | |
tree | da35ba474fbae288a1c91aad9d73c405c06bef3e /include | |
parent | 3d81c8d2cbf63523c7285b46ea2f4d62ee4aef80 (diff) |
feature:2823 Add triggers for login system
git-svn-id: http://piwigo.org/svn/trunk@20282 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/functions_user.inc.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index 40d9fcd34..b1f55ea2e 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -1063,6 +1063,7 @@ function log_user($user_id, $remember_me) $_SESSION['pwg_uid'] = (int)$user_id; $user['id'] = $_SESSION['pwg_uid']; + trigger_action('user_login', $user['id']); } /* @@ -1177,6 +1178,18 @@ function pwg_password_verify($password, $hash, $user_id=null) */ function try_log_user($username, $password, $remember_me) { + return trigger_event('try_log_user', false, $username, $password, $remember_me); +} + +add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4); + +function pwg_login($success, $username, $password, $remember_me) +{ + if ($success===true) + { + return true; + } + // we force the session table to be clean pwg_session_gc(); @@ -1203,6 +1216,9 @@ SELECT '.$conf['user_fields']['id'].' AS id, function logout_user() { global $conf; + + trigger_action('user_logout', @$_SESSION['pwg_uid']); + $_SESSION = array(); session_unset(); session_destroy(); |