From d9af664393cbff90e80a97618e47a7c7b4e1f1dc Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Tue, 1 Dec 2015 01:07:03 -0500 Subject: [PATCH] Implement basic registration and logging in/out --- app/Http/Controllers/Auth/AuthController.php | 5 +++ app/Http/routes.php | 22 +++++++++---- config/session.php | 2 +- resources/assets/less/app.less | 4 ++- resources/assets/less/auth.less | 33 +++++++++++++++++++ resources/assets/less/elements/footer.less | 3 ++ resources/assets/less/{ => elements}/nav.less | 0 resources/assets/less/var.less | 2 ++ resources/views/auth.blade.php | 11 +++++++ resources/views/auth/login.blade.php | 24 ++++++++++++++ resources/views/auth/register.blade.php | 29 ++++++++++++++++ .../views/{main.blade.php => base.blade.php} | 7 ++-- resources/views/elements/footer.blade.php | 3 ++ resources/views/public.blade.php | 9 +++++ resources/views/website/home.blade.php | 4 +-- 15 files changed, 145 insertions(+), 13 deletions(-) create mode 100644 resources/assets/less/auth.less create mode 100644 resources/assets/less/elements/footer.less rename resources/assets/less/{ => elements}/nav.less (100%) create mode 100644 resources/views/auth.blade.php create mode 100644 resources/views/auth/login.blade.php create mode 100644 resources/views/auth/register.blade.php rename resources/views/{main.blade.php => base.blade.php} (78%) create mode 100644 resources/views/elements/footer.blade.php create mode 100644 resources/views/public.blade.php diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index c0ad3b8..4e7f7cf 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -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. * diff --git a/app/Http/routes.php b/app/Http/routes.php index c193d24..d2beebe 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -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'); diff --git a/config/session.php b/config/session.php index 05c0f86..20fb26a 100644 --- a/config/session.php +++ b/config/session.php @@ -148,6 +148,6 @@ return [ | */ - 'secure' => true, + 'secure' => false, ]; diff --git a/resources/assets/less/app.less b/resources/assets/less/app.less index fe94562..9f8777f 100644 --- a/resources/assets/less/app.less +++ b/resources/assets/less/app.less @@ -1,6 +1,8 @@ @import "bootstrap"; @import "var"; -@import "nav"; +@import "auth"; + +@import "elements/**"; /* | diff --git a/resources/assets/less/auth.less b/resources/assets/less/auth.less new file mode 100644 index 0000000..893ee20 --- /dev/null +++ b/resources/assets/less/auth.less @@ -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; + } + } +} diff --git a/resources/assets/less/elements/footer.less b/resources/assets/less/elements/footer.less new file mode 100644 index 0000000..2e7f561 --- /dev/null +++ b/resources/assets/less/elements/footer.less @@ -0,0 +1,3 @@ +footer { + +} diff --git a/resources/assets/less/nav.less b/resources/assets/less/elements/nav.less similarity index 100% rename from resources/assets/less/nav.less rename to resources/assets/less/elements/nav.less diff --git a/resources/assets/less/var.less b/resources/assets/less/var.less index a3f20ca..e90b3a7 100644 --- a/resources/assets/less/var.less +++ b/resources/assets/less/var.less @@ -5,3 +5,5 @@ */ @c_text: #111; // text colour +@c_base: #0088cc; // base colour +@c_accent: #f5f5f5; // accent colour diff --git a/resources/views/auth.blade.php b/resources/views/auth.blade.php new file mode 100644 index 0000000..b10de38 --- /dev/null +++ b/resources/views/auth.blade.php @@ -0,0 +1,11 @@ +@extends('base') + +@section('page-content') +
+
+
+ @yield('auth-form') +
+
+
+@endsection diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php new file mode 100644 index 0000000..b2353e3 --- /dev/null +++ b/resources/views/auth/login.blade.php @@ -0,0 +1,24 @@ +@extends('auth') + +@section('auth-form') +
+ {!! csrf_field() !!} + +
+ +
+
+ +
+ +
+
+ +
+ + +
+ + +
+@endsection diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php new file mode 100644 index 0000000..d9fbb6d --- /dev/null +++ b/resources/views/auth/register.blade.php @@ -0,0 +1,29 @@ +@extends('auth') + +@section('auth-form') +
+ {!! csrf_field() !!} + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+@endsection diff --git a/resources/views/main.blade.php b/resources/views/base.blade.php similarity index 78% rename from resources/views/main.blade.php rename to resources/views/base.blade.php index 9b4b307..23a846d 100644 --- a/resources/views/main.blade.php +++ b/resources/views/base.blade.php @@ -14,8 +14,9 @@ @endif - - @include('elements.nav') - @yield('page') + + @yield('page-top') + @yield('page-content') + @yield('page-bottom') diff --git a/resources/views/elements/footer.blade.php b/resources/views/elements/footer.blade.php new file mode 100644 index 0000000..0ed3a6c --- /dev/null +++ b/resources/views/elements/footer.blade.php @@ -0,0 +1,3 @@ + diff --git a/resources/views/public.blade.php b/resources/views/public.blade.php new file mode 100644 index 0000000..6867ef9 --- /dev/null +++ b/resources/views/public.blade.php @@ -0,0 +1,9 @@ +@extends('base') + +@section('page-top') +@include('elements.nav') +@endsection + +@section('page-bottom') +@include('elements.footer') +@endsection diff --git a/resources/views/website/home.blade.php b/resources/views/website/home.blade.php index 0209550..8305ec4 100644 --- a/resources/views/website/home.blade.php +++ b/resources/views/website/home.blade.php @@ -1,6 +1,6 @@ -@extends('main') +@extends('public') -@section('page') +@section('page-content')