Cachet/app/controllers/AuthController.php
Graham Campbell 9d8d89248f CS fixes
2014-12-20 21:20:17 +00:00

43 lines
939 B
PHP

<?php
/**
* Logs users into their account
*/
class AuthController extends Controller
{
/**
* Shows the login view.
* @return \Illuminate\View\View
*/
public function showLogin()
{
return View::make('auth.login');
}
/**
* Logs the user in.
* @return \Illuminate\Http\RedirectResponse
*/
public function postLogin()
{
if (Auth::attempt(Input::only(['email', 'password']))) {
return Redirect::intended('dashboard');
} else {
return Redirect::back()
->withInput(Input::except('password'))
->with('error', 'Invalid email or password');
}
}
/**
* Logs the user out, deleting their session etc.
* @return \Illuminate\Http\RedirectResponse
*/
public function logoutAction()
{
Auth::logout();
return Redirect::to('/');
}
}