Skip to content

Instantly share code, notes, and snippets.

@tiansial
Created July 21, 2014 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tiansial/0a2e713513b2286d1e77 to your computer and use it in GitHub Desktop.
Save tiansial/0a2e713513b2286d1e77 to your computer and use it in GitHub Desktop.
public function postLogin() {
$rules = array("username" => "required", "password" => "required");
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::route("login")->withErrors($validator);
}
$auth = Auth::attempt(array(
"name" => Input::get("username"),
"password" => Input::get("password")
), false);
if (!$auth) {
return Redirect::route("login")->withErrors(array(
"Invalid credentials were provided."
));
}
return Redirect::route("home");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment