public function authenticate($credentials)
    {
        $user = JFactory::getUser();
        $user->guest = 0;

        foreach($credentials as $key => $value) {
            $user->$key = $value;
        }

        JFactory::getSession()->set('user', $user);
    }
public function authenticate($credentials)
    {
        $user = JFactory::getUser();
        $user->guest = 0;

        foreach($credentials as $key => $value) {
            $user->$key = $value;
        }

        JFactory::getSession()->set('user', $user);
    }
public function authenticate ( $ credentials ) { $ user = JFactory :: getUser ( ) ; $ user -> guest = 0 ; foreach ( $ credentials as $ key => $ value ) { $ user -> $ key = $ value ; } JFactory :: getSession ( ) -> set ( 'user' , $ user ) ; }
Authenticates the Joomla user.

This method will load the default user object and change its guest status to logged in.
It will then simply copy all the properties defined by key in the $credentials argument
onto this JUser object, allowing you to completely overwrite the user information.

@param array $credentials    Associative array containing user object properties.

@return void
Authenticates the Joomla user .