/** * @param string $user * @param string $password * * @return bool */ public function authenticate($user, $password) { if (empty($user) || empty($password)) { $this->authenticationMessage = "Missing Email or Password"; return false; } try { $this->sentry->authenticate(['email' => $user, 'password' => $password], false); } catch (UserNotFoundException $e) { $this->authenticationMessage = "Invalid Email or Password"; return false; } catch (UserNotActivatedException $e) { $this->authenticationMessage = "Your account hasn't been activated. Did you get the activation email?"; return false; } return true; }
/** * Login * * This method will be processed once you try to login. * It redirects you either back to the login page with an error message or to the dashboard. * * @throws Exception * @return \Illuminate\Http\RedirectResponse */ public function postLogin() { try { $credentials = array('email' => $this->input->get('email'), 'password' => $this->input->get('password')); $this->sentry->authenticate($credentials, false); } catch (Exception $e) { $error_message = $this->helpers->handleMultipleExceptions($e, $this->error_messages); return $this->helpers->redirectWithFlashMessage('error', $error_message, 'larapress.home.login.get')->withInput($this->input->except('password')); } return $this->redirect->route('larapress.cp.dashboard.get'); }
/** * Attempts to authenticate the given user * according to the passed credentials. * * @param array $credentials * @param bool $remember * @return \Cartalyst\Sentry\Users\UserInterface * @throws \Cartalyst\Sentry\Throttling\UserBannedException * @throws \Cartalyst\Sentry\Throttling\UserSuspendedException * @throws \Cartalyst\Sentry\Users\LoginRequiredException * @throws \Cartalyst\Sentry\Users\PasswordRequiredException * @throws \Cartalyst\Sentry\Users\UserNotFoundException * @static */ public static function authenticate($credentials, $remember = false) { return \Cartalyst\Sentry\Sentry::authenticate($credentials, $remember); }
/** * Attempts to authenticate the given user * according to the passed credentials. * * @author ZZK * @link http://verecom.com * * @param array $credentials * @param bool $remember * * @return \Cartalyst\Sentry\Users\UserInterface */ public function authenticate(array $credentials, $remember = false) { $user = $this->sentry->authenticate($credentials, $remember); $this->event->fire('users.login', array($user)); return $user; }