Changeset 20282


Ignore:
Timestamp:
Jan 20, 2013, 12:50:08 PM (11 years ago)
Author:
mistic100
Message:

feature:2823 Add triggers for login system

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r19703 r20282  
    10641064
    10651065  $user['id'] = $_SESSION['pwg_uid'];
     1066  trigger_action('user_login', $user['id']);
    10661067}
    10671068
     
    11781179function try_log_user($username, $password, $remember_me)
    11791180{
     1181  return trigger_event('try_log_user', false, $username, $password, $remember_me);
     1182}
     1183
     1184add_event_handler('try_log_user', 'pwg_login', EVENT_HANDLER_PRIORITY_NEUTRAL, 4);
     1185
     1186function pwg_login($success, $username, $password, $remember_me)
     1187{
     1188  if ($success===true)
     1189  {
     1190    return true;
     1191  }
     1192 
    11801193  // we force the session table to be clean
    11811194  pwg_session_gc();
     
    12041217{
    12051218  global $conf;
     1219 
     1220  trigger_action('user_logout', @$_SESSION['pwg_uid']);
     1221 
    12061222  $_SESSION = array();
    12071223  session_unset();
  • trunk/tools/triggers_list.php

    r20192 r20282  
    791791  'vars' => array('bool', null, 'string', 'methodName', 'array', 'params'),
    792792  'files' => array('include\ws_core.inc.php (PwgServer::invoke)'),
     793),
     794array(
     795  'name' => 'user_logout',
     796  'type' => 'trigger_action',
     797  'vars' => array('int', 'user_id'),
     798  'files' => array('include\functions_user.inc.php (logout_user)'),
     799),
     800array(
     801  'name' => 'user_login',
     802  'type' => 'trigger_action',
     803  'vars' => array('int', 'user_id'),
     804  'files' => array('include\functions_user.inc.php (log_user)'),
     805),
     806array(
     807  'name' => 'try_log_user',
     808  'type' => 'trigger_event',
     809  'vars' => array('boolean', 'success', 'string', 'username', 'string', 'password', 'bool', 'remember_me'),
     810  'files' => array('include\functions_user.inc.php (try_log_user)'),
     811  'infos' => 'Used by identification form to check user credentials and log user. If success is true, another login method already succeed. Return true if your method succeed.',
    793812),
    794813);
Note: See TracChangeset for help on using the changeset viewer.