public function loginsubmit() { $input = Input::all(); $rules = array('password' => array('required'), 'email' => array('required')); $validation = Validator::make(Input::all(), $rules); if ($validation->fails()) { return Redirect::to('user/login'); } $credentials = array('email' => $input['email'], 'password' => $input['password']); try { $user = Sentry::findUserByLogin($input['email']); } catch (UserNotFoundException $e) { Session::flash('message', 'User or Password not match.'); return Redirect::to('user/login'); } //check password if (!$user->checkPassword($input['password'])) { Session::flash('message', 'User or Password not match.'); return Redirect::to('user/login'); } $throttle = Sentry::findThrottlerByUserId($user['id']); //check Suspended if ($suspended = $throttle->isSuspended()) { Session::flash('message', ' User is Suspended.'); return Redirect::to('user/login'); } //check banned if ($banned = $throttle->isBanned()) { Session::flash('message', 'User banned.'); return Redirect::to('user/login'); } //check deactive if (!$user->isActivated()) { Session::flash('message', 'User not activated.'); return Redirect::to('user/login'); } if (isset($input['rememberme']) && $input['rememberme'] == 1) { Sentry::authenticateAndRemember($credentials); } else { Sentry::authenticate($credentials, false); } if ($user->hasAccess('dashboard')) { return Redirect::to('manager/videos'); } else { return Redirect::to('/'); } }