コード例 #1
0
ファイル: LocalStrategy.php プロジェクト: kl07/authentication
 /**
  * Attempt to authenticate the username and password pair.
  *
  * @return  string|boolean  A string containing a username if authentication is successful, false otherwise.
  *
  * @since   1.0
  */
 public function authenticate()
 {
     $username = $this->input->get('username', false, 'username');
     $password = $this->input->get('password', false, 'raw');
     if (!$username || !$password) {
         $this->status = Authentication::NO_CREDENTIALS;
         return false;
     }
     return $this->doAuthenticate($username, $password);
 }
コード例 #2
0
ファイル: LocalStrategy.php プロジェクト: vess/authentication
 /**
  * Attempt to authenticate the username and password pair.
  *
  * @return  string|boolean  A string containing a username if authentication is successful, false otherwise.
  *
  * @since   1.0
  */
 public function authenticate()
 {
     $username = $this->input->get('username', false);
     $password = $this->input->get('password', false);
     if (!$username || !$password) {
         $this->status = Authentication::NO_CREDENTIALS;
         return false;
     }
     if (isset($this->credentialStore[$username])) {
         $hash = $this->credentialStore[$username];
     } else {
         $this->status = Authentication::NO_SUCH_USER;
         return false;
     }
     if (password_verify($password, $hash)) {
         $this->status = Authentication::SUCCESS;
         return $username;
     } else {
         $this->status = Authentication::INVALID_CREDENTIALS;
         return false;
     }
 }
コード例 #3
0
ファイル: Cli.php プロジェクト: beingsane/quickcontent
 /**
  * Gets a value from the input data.
  *
  * @param   string  $name     Name of the value to get.
  * @param   mixed   $default  Default value to return if variable does not exist.
  * @param   string  $filter   Filter to apply to the value.
  *
  * @return  mixed  The filtered input value.
  *
  * @since   1.0
  */
 public function get($name, $default = null, $filter = 'string')
 {
     return parent::get($name, $default, $filter);
 }
コード例 #4
0
ファイル: Session.php プロジェクト: MATsxm/session
 /**
  * Start a session.
  *
  * Creates a session (or resumes the current one based on the state of the session)
  *
  * @return  boolean  true on success
  *
  * @since   1.0
  * @deprecated  2.0
  */
 protected function _start()
 {
     // Start session if not started
     if ($this->getState() === 'restart') {
         session_regenerate_id(true);
     } else {
         $session_name = session_name();
         // Get the Joomla\Input\Cookie object
         $cookie = $this->input->cookie;
         if (is_null($cookie->get($session_name))) {
             $session_clean = $this->input->get($session_name, false, 'string');
             if ($session_clean) {
                 session_id($session_clean);
                 $cookie->set($session_name, '', time() - 3600);
             }
         }
     }
     /**
      * Write and Close handlers are called after destructing objects since PHP 5.0.5.
      * Thus destructors can use sessions but session handler can't use objects.
      * So we are moving session closure before destructing objects.
      *
      * Replace with session_register_shutdown() when dropping compatibility with PHP 5.3
      */
     register_shutdown_function('session_write_close');
     session_cache_limiter('none');
     session_start();
     return true;
 }
コード例 #5
0
 /**
  * Test the Joomla\Input\Input::get method.
  *
  * @return  void
  *
  * @covers  Joomla\Input\Input::get
  * @since   1.0
  */
 public function testGet()
 {
     $_REQUEST['foo'] = 'bar';
     $instance = new Input();
     // Test the get method.
     $this->assertThat($instance->get('foo'), $this->equalTo('bar'), 'Line: ' . __LINE__ . '.');
     $_GET['foo'] = 'bar2';
     // Test the get method.
     $this->assertThat($instance->get->get('foo'), $this->equalTo('bar2'), 'Checks first use of new super-global.');
     // Test the get method.
     $this->assertThat($instance->get('default_value', 'default'), $this->equalTo('default'), 'Line: ' . __LINE__ . '.');
 }