SentryのControllerの例
Sentryを使ったLaravelのController、私は以下のように書いている。
public function doLogin() { $inputs = array( 'email' => Input::get('email'), 'password' => Input::get('password'), ); try { Sentry::authenticate($inputs, false); $cookie = Cookie::forever('email', $inputs['email']); return Redirect::intended(Input::get('uri'))->withCookie($cookie); } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) { $err_msg = $e->getMessage(); } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) { $err_msg = $e->getMessage(); } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) { $err_msg = $e->getMessage(); } return Redirect::action('UserController@login') ->withInput(Input::except('password')) ->with('error', $err_msg); } public function login() { if (Sentry::check()) { return Redirect::to('/'); }