Created
July 21, 2014 15:41
-
-
Save tiansial/0a2e713513b2286d1e77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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