english/components/com_users/controllers/user.php
/**
	 * Method to log in a user.
	 *
	 * @since	1.6
	 */
Method to log in a user.
Method to log in a user .
public function login()
	{
		JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token'));
		$app = JFactory::getApplication();
		$data = array();
		$data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64'));
		$data['username'] = JRequest::getVar('username', '', 'method', 'username');
		$data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW);
		if (empty($data['return'])) {
			$data['return'] = 'index.php?option=com_users&view=profile';
		}
		$options = array();
		$options['remember'] = JRequest::getBool('remember', false);
		$options['return'] = $data['return'];
		$credentials = array();
		$credentials['username'] = $data['username'];
		$credentials['password'] = $data['password'];
		$error = $app->login($credentials, $options);
		if (!JError::isError($error)) {
			$app->setUserState('users.login.form.data', array());
			$app->redirect(JRoute::_($data['return'], false));
		} else {
			$data['remember'] = (int)$options['remember'];
			$app->setUserState('users.login.form.data', $data);
			$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
		}
	}
public function login ( ) { JRequest :: checkToken ( 'post' ) or jexit ( JText :: _ ( 'JInvalid_Token' ) ) ; $ app = JFactory :: getApplication ( ) ; $ data = array ( ) ; $ data [ 'return' ] = base64_decode ( JRequest :: getVar ( 'return' , '' , 'POST' , 'BASE64' ) ) ; $ data [ 'username' ] = JRequest :: getVar ( 'username' , '' , 'method' , 'username' ) ; $ data [ 'password' ] = JRequest :: getString ( 'password' , '' , 'post' , JREQUEST_ALLOWRAW ) ; if ( empty ( $ data [ 'return' ] ) ) { $ data [ 'return' ] = 'index.php?option=com_users&view=profile' ; } $ options = array ( ) ; $ options [ 'remember' ] = JRequest :: getBool ( 'remember' , false ) ; $ options [ 'return' ] = $ data [ 'return' ] ; $ credentials = array ( ) ; $ credentials [ 'username' ] = $ data [ 'username' ] ; $ credentials [ 'password' ] = $ data [ 'password' ] ; $ error = $ app -> login ( $ credentials , $ options ) ; if ( ! JError :: isError ( $ error ) ) { $ app -> setUserState ( 'users.login.form.data' , array ( ) ) ; $ app -> redirect ( JRoute :: _ ( $ data [ 'return' ] , false ) ) ; } else { $ data [ 'remember' ] = ( int ) $ options [ 'remember' ] ; $ app -> setUserState ( 'users.login.form.data' , $ data ) ; $ app -> redirect ( JRoute :: _ ( 'index.php?option=com_users&view=login' , false ) ) ; } }
Method to log in a user.
Method to log in a user .
// Populate the data array: // Set the return URL if empty. // Get the log in options. // Get the log in credentials. // Perform the log in. // Check if the log in succeeded.