english/libraries/joomla/application/application.php
/**
	 * Login authentication function.
	 *
	 * Username and encoded password are passed the the onUserLogin event which
	 * is responsible for the user validation. A successful validation updates
	 * the current session record with the user's details.
	 *
	 * Username and encoded password are sent as credentials (along with other
	 * possibilities) to each observer (authentication plugin) for user
	 * validation.  Successful validation will update the current session with
	 * the user details.
	 *
	 * @param   array  $credentials  Array('username' => string, 'password' => string)
	 * @param   array  $options      Array('remember' => boolean)
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   11.1
	 */
Login authentication function.
Username and encoded password are passed the the onUserLogin event which
is responsible for the user validation. A successful validation updates
the current session record with the user's details.

Username and encoded password are sent as credentials (along with other
possibilities) to each observer (authentication plugin) for user
validation.  Successful validation will update the current session with
the user details.



@return  boolean  True on success.


Login authentication function . Username and encoded password are passed the the onUserLogin event which is responsible for the user validation . A successful validation updates the current session record with the user ' s details . Username and encoded password are sent as credentials ( along with other possibilities ) to each observer ( authentication plugin ) for user validation . Successful validation will update the current session with the user details . @return boolean True on success .
public function login($credentials, $options = array())
	{
		jimport('joomla.user.authentication');
		$authenticate = JAuthentication::getInstance();
		$response	= $authenticate->authenticate($credentials, $options);
		if ($response->status === JAUTHENTICATE_STATUS_SUCCESS) {
			JPluginHelper::importPlugin('user');
			$results = $this->triggerEvent('onUserLogin', array((array)$response, $options));
			if (!in_array(false, $results, true)) {
				if (isset($options['remember']) && $options['remember']) {
					jimport('joomla.utilities.simplecrypt');
					jimport('joomla.utilities.utility');
					$key = JUtility::getHash(@$_SERVER['HTTP_USER_AGENT']);
					$crypt = new JSimpleCrypt($key);
					$rcookie = $crypt->encrypt(serialize($credentials));
					$lifetime = time() + 365*24*60*60;
					$cookie_domain = $this->getCfg('cookie_domain', '');
					$cookie_path = $this->getCfg('cookie_path', '/');
					setcookie( JUtility::getHash('JLOGIN_REMEMBER'), $rcookie, $lifetime, $cookie_path, $cookie_domain );
				}
				return true;
			}
		}
		$this->triggerEvent('onUserLoginFailure', array((array)$response));
		if (isset($options['silent']) && $options['silent']) {
			return false;
		}
		if ($response->status !== JAUTHENTICATE_STATUS_SUCCESS) {
			JError::raiseWarning('SOME_ERROR_CODE', JText::_('JLIB_LOGIN_AUTHENTICATE'));
		}
		return false;
	}
public function login ( $ credentials , $ options = array ( ) ) { jimport ( 'joomla.user.authentication' ) ; $ authenticate = JAuthentication :: getInstance ( ) ; $ response = $ authenticate -> authenticate ( $ credentials , $ options ) ; if ( $ response -> status === JAUTHENTICATE_STATUS_SUCCESS ) { JPluginHelper :: importPlugin ( 'user' ) ; $ results = $ this -> triggerEvent ( 'onUserLogin' , array ( ( array ) $ response , $ options ) ) ; if ( ! in_array ( false , $ results , true ) ) { if ( isset ( $ options [ 'remember' ] ) && $ options [ 'remember' ] ) { jimport ( 'joomla.utilities.simplecrypt' ) ; jimport ( 'joomla.utilities.utility' ) ; $ key = JUtility :: getHash ( @ $ _SERVER [ 'HTTP_USER_AGENT' ] ) ; $ crypt = new JSimpleCrypt ( $ key ) ; $ rcookie = $ crypt -> encrypt ( serialize ( $ credentials ) ) ; $ lifetime = time ( ) + 365 * 24 * 60 * 60 ; $ cookie_domain = $ this -> getCfg ( 'cookie_domain' , '' ) ; $ cookie_path = $ this -> getCfg ( 'cookie_path' , '/' ) ; setcookie ( JUtility :: getHash ( 'JLOGIN_REMEMBER' ) , $ rcookie , $ lifetime , $ cookie_path , $ cookie_domain ) ; } return true ; } } $ this -> triggerEvent ( 'onUserLoginFailure' , array ( ( array ) $ response ) ) ; if ( isset ( $ options [ 'silent' ] ) && $ options [ 'silent' ] ) { return false ; } if ( $ response -> status !== JAUTHENTICATE_STATUS_SUCCESS ) { JError :: raiseWarning ( 'SOME_ERROR_CODE' , JText :: _ ( 'JLIB_LOGIN_AUTHENTICATE' ) ) ; } return false ; }
Login authentication function.
Login authentication function .
// Get the global JAuthentication object. // Import the user plugin group. // OK, the credentials are authenticated.  Lets fire the onLogin event. /*
			 * If any of the user plugins did not successfully complete the login routine
			 * then the whole method fails.
			 *
			 * Any errors raised should be done in the plugin as this provides the ability
			 * to provide much more information about why the routine may have failed.
			 */ // Set the remember me cookie if enabled. // Create the encryption key, apply extra hardening using the user agent string. // Use domain and path set in config for cookie if it exists. // Trigger onUserLoginFailure Event. // If silent is set, just return false. // If status is success, any error will ahve been raised by the user plugin