Login page
This commit is contained in:
@@ -5,7 +5,15 @@
|
||||
*/
|
||||
class AuthController extends Controller {
|
||||
public function showLogin() {
|
||||
return 'Coming soon...';
|
||||
return View::make('auth.login');
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
public function logoutAction() {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
});
|
||||
|
||||
Route::get('/auth/login', 'AuthController@showLogin')->before('guest');
|
||||
Route::post('/auth/login', 'AuthController@postLogin')->before('guest|csrf');
|
||||
|
||||
Route::group(['before' => 'auth'], function() {
|
||||
// Dashboard/Management Panel etc.
|
||||
Route::get('/dashboard', 'DashboardController@showDashboard');
|
||||
|
||||
35
app/views/auth/login.blade.php
Normal file
35
app/views/auth/login.blade.php
Normal file
@@ -0,0 +1,35 @@
|
||||
@extends('layout.master')
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-6 col-md-offset-3'>
|
||||
{{ Form::open() }}
|
||||
<fieldset>
|
||||
<legend>Login</legend>
|
||||
|
||||
@if(Session::has('error'))
|
||||
<span class='text-danger'>{{ Session::get('error') }}</span>
|
||||
@endif
|
||||
|
||||
<div class='form-group'>
|
||||
<label class='sr-only'>Email</label>
|
||||
{{ Form::email('email', Input::old('email'), [
|
||||
'class' => 'form-control', 'placeholder' => 'Email', 'required' => 'required'
|
||||
]) }}
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label class='sr-only'>Password</label>
|
||||
{{ Form::password('password', [
|
||||
'class' => 'form-control', 'placeholder' => 'Password', 'required' => 'required'
|
||||
]) }}
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<button type='submit' class='btn btn-default'>Login!</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@stop
|
||||
Reference in New Issue
Block a user