Source for file login.php

Documentation is available at login.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Site
  4.  * @subpackage  com_users
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE.txt
  8.  */
  9.  
  10. defined('_JEXEC'or die;
  11.  
  12. /**
  13.  * Rest model class for Users.
  14.  *
  15.  * @package     Joomla.Site
  16.  * @subpackage  com_users
  17.  * @since       1.6
  18.  */
  19. class UsersModelLogin extends JModelForm
  20. {
  21.     /**
  22.      * Method to get the login form.
  23.      *
  24.      * The base form is loaded from XML and then an event is fired
  25.      * for users plugins to extend the form with extra fields.
  26.      *
  27.      * @param   array  $data        An optional array of data for the form to interogate.
  28.      * @param   boolean    $loadData    True if the form is to load its own data (default case), false if not.
  29.      * @return  JForm    A JForm object on success, false on failure
  30.      * @since   1.6
  31.      */
  32.     public function getForm($data array()$loadData true)
  33.     {
  34.         // Get the form.
  35.         $form $this->loadForm('com_users.login''login'array('load_data' => $loadData));
  36.         if (empty($form))
  37.         {
  38.             return false;
  39.         }
  40.  
  41.         return $form;
  42.     }
  43.  
  44.     /**
  45.      * Method to get the data that should be injected in the form.
  46.      *
  47.      * @return  array  The default data is an empty array.
  48.      * @since   1.6
  49.      */
  50.     protected function loadFormData()
  51.     {
  52.         // Check the session for previously entered login form data.
  53.         $app  JFactory::getApplication();
  54.         $data $app->getUserState('users.login.form.data'array());
  55.  
  56.         // check for return URL from the request first
  57.         if ($return JRequest::getVar('return''''method''base64'))
  58.         {
  59.             $data['return'base64_decode($return);
  60.             if (!JUri::isInternal($data['return']))
  61.             {
  62.                 $data['return''';
  63.             }
  64.         }
  65.  
  66.         // Set the return URL if empty.
  67.         if (!isset($data['return']|| empty($data['return']))
  68.         {
  69.             $data['return''index.php?option=com_users&view=profile';
  70.         }
  71.         $app->setUserState('users.login.form.data'$data);
  72.  
  73.         $this->preprocessData('com_users.login'$data);
  74.  
  75.         return $data;
  76.     }
  77.  
  78.     /**
  79.      * Method to auto-populate the model state.
  80.      *
  81.      * Note. Calling getState in this method will result in recursion.
  82.      *
  83.      * @since   1.6
  84.      */
  85.     protected function populateState()
  86.     {
  87.         // Get the application object.
  88.         $params    JFactory::getApplication()->getParams('com_users');
  89.  
  90.         // Load the parameters.
  91.         $this->setState('params'$params);
  92.     }
  93.  
  94.     /**
  95.      * Override JModelAdmin::preprocessForm to ensure the correct plugin group is loaded.
  96.      *
  97.      * @param   JForm   $form   A JForm object.
  98.      * @param   mixed   $data   The data expected for the form.
  99.      * @param   string  $group  The name of the plugin group to import (defaults to "content").
  100.      *
  101.      * @return  void 
  102.      *
  103.      * @since   1.6
  104.      * @throws  Exception if there is an error in the form event.
  105.      */
  106.     protected function preprocessForm(JForm $form$data$group 'user')
  107.     {
  108.         parent::preprocessForm($form$data$group);
  109.     }
  110. }

Documentation generated on Tue, 19 Nov 2013 15:07:26 +0100 by phpDocumentor 1.4.3