API/Authentication

From aMember Pro Documentation
Revision as of 16:12, 9 November 2011 by Alex (Talk | contribs)

Jump to: navigation, search

There are 2 classes available to handle user and admin authentication: Am_Auth_User and Am_Auth_Admin Usage is the same:

Am_Di::getInstance()->authUser->getUser(); // returns User object or null
Am_Di::getInstance()->authUser->getUserId() // returns user_id or null
$result = Am_Di::getInstance()->authUser->login('login', 'password', '11.22.33.44');
echo $result->isValid() ? "OK" : ("failed: " . $result->getMessage());
 
Am_Di::getInstance()->authUser->logout();