public function login() { $this->document->title = "Log In"; if (Auth::capable()) { $this->redirect(URI::get('user')); } if ($_POST) { if (!Form::check_request_token()) { Flash::set('Error processing your request!'); $this->redirect('user/login'); } if (Auth::login($_POST['username'], $_POST['password'])) { Flash::set('Logged you in.'); $this->redirect(URI::get('user')); } else { Flash::set('Bad e-mail or password.'); $this->redirect(URI::get('user/login')); } } }