Last active
August 29, 2015 14:13
-
-
Save shinigamicorei7/c61f0e6838410f311a1e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class AuthController extends BaseController | |
{ | |
public function loginUser() | |
{ | |
return View::make('user.login'); | |
} | |
public function authUser() | |
{ | |
$credentials = Input::only('username', 'password'); | |
$rules = ['username' => 'required', 'password' => 'required']; | |
$validator = Validator::make($credentials, $rules); | |
if($validator->fails()){ | |
return Redirect::route('login-user')->withErrors($validator)->withInput(Input::only('username')); | |
} | |
$attempt = Auth::user()->attempt($credentials,false); | |
if(!$attempt){ | |
return Redirect::route('login-user')->with('error','Las credenciales proporcionadas no son correctas!'); | |
} | |
return Redirect::intended('admsis/dashboard'); | |
} | |
public function loginAdmin() | |
{ | |
return View::make('admin.login'); | |
} | |
public function authAdmin() | |
{ | |
$credentials = Input::only('username', 'password'); | |
$rules = ['username' => 'required', 'password' => 'required']; | |
$validator = Validator::make($credentials, $rules); | |
if($validator->fails()){ | |
return Redirect::route('login-admin')->withErrors($validator)->withInput(Input::only('username')); | |
} | |
$attempt = Auth::admin()->attempt($credentials,false); | |
if(!$attempt){ | |
return Redirect::route('login-admin')->with('error','Las credenciales proporcionadas no son correctas!'); | |
} | |
return Redirect::intended('admsis/dashboard'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment