Implement basic registration and logging in/out

This commit is contained in:
Kevin MacMartin 2015-12-01 01:07:03 -05:00
parent ae031fd488
commit d9af664393
15 changed files with 145 additions and 13 deletions

View file

@ -23,6 +23,11 @@ class AuthController extends Controller
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
/**
* Page the user is redirected to after successfully registering
*/
protected $redirectPath = '/dashboard';
/**
* Create a new authentication controller instance.
*

View file

@ -2,15 +2,25 @@
/*
|--------------------------------------------------------------------------
| Application Routes
| Public Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function () {
return view('website.home');
});
/*
|--------------------------------------------------------------------------
| Content Management Routes
|--------------------------------------------------------------------------
*/
// Authentication
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');
// Registration
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

View file

@ -148,6 +148,6 @@ return [
|
*/
'secure' => true,
'secure' => false,
];

View file

@ -1,6 +1,8 @@
@import "bootstrap";
@import "var";
@import "nav";
@import "auth";
@import "elements/**";
/*
|

33
resources/assets/less/auth.less vendored Normal file
View file

@ -0,0 +1,33 @@
.auth-container {
form {
margin-top: 50px;
padding: 25px 25px 50px 25px;
border-radius: 5px;
border: 1px solid darken(@c_accent, 5%);
background-color: @c_accent;
.form-field {
label {
float: left;
min-width: 125px;
}
.input {
display: block;
overflow: hidden;
margin-bottom: 10px;
input {
width: 100%;
height: 24px;
}
}
}
button {
position: absolute;
right: 41px;
bottom: 25px;
}
}
}

View file

@ -0,0 +1,3 @@
footer {
}

View file

@ -5,3 +5,5 @@
*/
@c_text: #111; // text colour
@c_base: #0088cc; // base colour
@c_accent: #f5f5f5; // accent colour

View file

@ -0,0 +1,11 @@
@extends('base')
@section('page-content')
<div class="container auth-container">
<div class="row">
<div class="col-xs-6 col-xs-push-3">
@yield('auth-form')
</div>
</div>
</div>
@endsection

View file

@ -0,0 +1,24 @@
@extends('auth')
@section('auth-form')
<form method="POST" action="/auth/login">
{!! csrf_field() !!}
<div class="form-field">
<label for="email">Email</label>
<div class="input"><input type="email" name="email" value="{{ old('email') }}" /></div>
</div>
<div class="form-field">
<label for="password">Password</label>
<div class="input"><input type="password" name="password" id="password" /></div>
</div>
<div class="form-field">
<label for="remember">Remember Me</label>
<input type="checkbox" name="remember" />
</div>
<button type="submit">Login</button>
</form>
@endsection

View file

@ -0,0 +1,29 @@
@extends('auth')
@section('auth-form')
<form method="POST" action="/auth/register">
{!! csrf_field() !!}
<div class="form-field">
<label for="name">Name</label>
<div class="input"><input type="text" name="name" value="{{ old('name') }}" /></div>
</div>
<div class="form-field">
<label for="email">Email</label>
<div class="input"><input type="email" name="email" value="{{ old('email') }}" /></div>
</div>
<div class="form-field">
<label for="password">Password</label>
<div class="input"><input type="password" name="password" id="password" /></div>
</div>
<div class="form-field">
<label for="password_confirmation">Confirm</label>
<div class="input"><input type="password" name="password_confirmation" id="password_confirmation" /></div>
</div>
<button type="submit">Register</button>
</form>
@endsection

View file

@ -14,8 +14,9 @@
@endif
<link rel="stylesheet" href="{{ elixir('css/app.css') }}">
</head>
<body class="{{ Request::path() == "/" ? "index" : Request::path() }}">
@include('elements.nav')
@yield('page')
<body class="{{ Request::path() == "/" ? "index" : preg_replace('/\//', '-', Request::path()) }}">
@yield('page-top')
@yield('page-content')
@yield('page-bottom')
</body>
</html>

View file

@ -0,0 +1,3 @@
<footer>
</footer>

View file

@ -0,0 +1,9 @@
@extends('base')
@section('page-top')
@include('elements.nav')
@endsection
@section('page-bottom')
@include('elements.footer')
@endsection

View file

@ -1,6 +1,6 @@
@extends('main')
@extends('public')
@section('page')
@section('page-content')
<div class="container">
<div class="content">