2014-11-24 15:33:36 +00:00
|
|
|
<?php
|
|
|
|
|
2014-11-27 16:05:00 +00:00
|
|
|
/**
|
|
|
|
* Logs users into their account
|
|
|
|
*/
|
|
|
|
class AuthController extends Controller {
|
|
|
|
public function showLogin() {
|
|
|
|
return View::make('auth.login');
|
|
|
|
}
|
2014-11-24 15:33:36 +00:00
|
|
|
|
2014-11-27 16:05:00 +00:00
|
|
|
public function postLogin() {
|
|
|
|
if (Auth::attempt(Input::only(['email', 'password']))) {
|
|
|
|
return Redirect::intended('dashboard');
|
|
|
|
} else {
|
2014-12-01 08:34:37 +00:00
|
|
|
return Redirect::back()
|
|
|
|
->withInput(Input::except('password'))
|
|
|
|
->with('error', 'Invalid email or password');
|
2014-11-27 16:05:00 +00:00
|
|
|
}
|
|
|
|
}
|
2014-11-24 15:33:36 +00:00
|
|
|
|
2014-11-27 16:05:00 +00:00
|
|
|
public function logoutAction() {
|
|
|
|
Auth::logout();
|
|
|
|
|
|
|
|
return Redirect::to('/');
|
|
|
|
}
|
2014-11-27 22:08:28 +00:00
|
|
|
}
|