authenticate() public method

Attempts to authenticate the given user according to the passed credentials.
Author: Steve Montambeault
public authenticate ( array $credentials, boolean $remember = false ) : Cartalyst\Sentry\Users\UserInterface
$credentials array
$remember boolean
return Cartalyst\Sentry\Users\UserInterface
示例#1
0
 /**
  * Validate and log in a user
  *
  * @author Steve Montambeault
  * @link   http://stevemo.ca
  *
  * @param array $credentials
  * @param bool  $remember
  *
  * @return bool
  */
 public function login(array $credentials, $remember)
 {
     try {
         $this->users->authenticate($credentials, $remember);
         return true;
     } catch (LoginRequiredException $e) {
         $this->validator->add('LoginRequiredException', $e->getMessage());
     } catch (PasswordRequiredException $e) {
         $this->validator->add('PasswordRequiredException', $e->getMessage());
     } catch (WrongPasswordException $e) {
         $this->validator->add('WrongPasswordException', $e->getMessage());
     } catch (UserNotActivatedException $e) {
         $this->validator->add('UserNotActivatedException', $e->getMessage());
     } catch (UserNotFoundException $e) {
         $this->validator->add('UserNotFoundException', $e->getMessage());
     } catch (UserSuspendedException $e) {
         $this->validator->add('UserSuspendedException', $e->getMessage());
     } catch (UserBannedException $e) {
         $this->validator->add('UserBannedException', $e->getMessage());
     }
     return false;
 }