Attempts to authenticate the given user
according to the passed credentials.
public authenticate ( array $credentials, boolean $remember = false ) : Cartalyst\Sentry\Users\UserInterface | ||
$credentials | array | |
$remember | boolean | |
리턴 | Cartalyst\Sentry\Users\UserInterface |
/** * 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; }