Dan Brown

Added auth login control

...@@ -23,6 +23,10 @@ class AuthController extends Controller ...@@ -23,6 +23,10 @@ class AuthController extends Controller
23 23
24 use AuthenticatesAndRegistersUsers, ThrottlesLogins; 24 use AuthenticatesAndRegistersUsers, ThrottlesLogins;
25 25
26 + protected $loginPath = '/login';
27 + protected $redirectPath = '/';
28 +
29 +
26 /** 30 /**
27 * Create a new authentication controller instance. 31 * Create a new authentication controller instance.
28 * 32 *
......
...@@ -12,7 +12,11 @@ ...@@ -12,7 +12,11 @@
12 */ 12 */
13 13
14 14
15 -Route::group(['prefix' => 'books'], function() { 15 +
16 +// Authentication routes...
17 +Route::group(['middleware' => 'auth'], function() {
18 +
19 + Route::group(['prefix' => 'books'], function() {
16 20
17 Route::get('/', 'BookController@index'); 21 Route::get('/', 'BookController@index');
18 Route::get('/create', 'BookController@create'); 22 Route::get('/create', 'BookController@create');
...@@ -42,17 +46,23 @@ Route::group(['prefix' => 'books'], function() { ...@@ -42,17 +46,23 @@ Route::group(['prefix' => 'books'], function() {
42 Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete'); 46 Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
43 Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy'); 47 Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
44 48
45 -}); 49 + });
46 50
47 -Route::post('/upload/image', 'ImageController@upload'); 51 + Route::post('/upload/image', 'ImageController@upload');
48 52
49 -Route::get('/images/all', 'ImageController@getAll'); 53 + Route::get('/images/all', 'ImageController@getAll');
50 -Route::get('/images/all/{page}', 'ImageController@getAll'); 54 + Route::get('/images/all/{page}', 'ImageController@getAll');
51 -Route::get('/images/{any}', 'ImageController@getImage')->where('any', '.*'); 55 + Route::get('/images/{any}', 'ImageController@getImage')->where('any', '.*');
52 56
53 -Route::get('/link/{id}', 'PageController@redirectFromLink'); 57 + Route::get('/link/{id}', 'PageController@redirectFromLink');
54 -Route::get('/pages/search/all', 'PageController@searchAll'); 58 + Route::get('/pages/search/all', 'PageController@searchAll');
55 59
56 -Route::get('/', function () { 60 + Route::get('/', function () {
57 return view('base'); 61 return view('base');
62 + });
63 +
64 +
58 }); 65 });
66 +Route::get('/login', 'Auth\AuthController@getLogin');
67 +Route::post('/login', 'Auth\AuthController@postLogin');
68 +Route::get('/logout', 'Auth\AuthController@getLogout');
......
...@@ -15,6 +15,11 @@ class DatabaseSeeder extends Seeder ...@@ -15,6 +15,11 @@ class DatabaseSeeder extends Seeder
15 Model::unguard(); 15 Model::unguard();
16 16
17 // $this->call(UserTableSeeder::class); 17 // $this->call(UserTableSeeder::class);
18 + \Oxbow\User::create([
19 + 'name' => 'Admin',
20 + 'email' => 'admin@admin.com',
21 + 'password' => \Illuminate\Support\Facades\Hash::make('password')
22 + ]);
18 23
19 Model::reguard(); 24 Model::reguard();
20 } 25 }
......
...@@ -60,6 +60,12 @@ $button-border-radius: 3px; ...@@ -60,6 +60,12 @@ $button-border-radius: 3px;
60 } 60 }
61 } 61 }
62 62
63 +.button.block {
64 + width: 100%;
65 + text-align: center;
66 + display: block;
67 +}
68 +
63 // Floating action button 69 // Floating action button
64 //.fab { 70 //.fab {
65 // $size: 70px; 71 // $size: 70px;
......
...@@ -59,6 +59,10 @@ a { ...@@ -59,6 +59,10 @@ a {
59 i { 59 i {
60 padding-right: $-s; 60 padding-right: $-s;
61 } 61 }
62 + i.zmdi-hc-flip-horizontal {
63 + padding-right: 0;
64 + padding-left: $-s;
65 + }
62 } 66 }
63 67
64 /* 68 /*
......
...@@ -27,7 +27,7 @@ header { ...@@ -27,7 +27,7 @@ header {
27 top: 0; 27 top: 0;
28 z-index: 1; 28 z-index: 1;
29 //padding-top: $-m; 29 //padding-top: $-m;
30 - width: 300px; 30 + width: 340px;
31 border-right: 1px solid #DDD; 31 border-right: 1px solid #DDD;
32 h4, li, p, a { 32 h4, li, p, a {
33 color: #CCC; 33 color: #CCC;
...@@ -36,19 +36,26 @@ header { ...@@ -36,19 +36,26 @@ header {
36 36
37 #content { 37 #content {
38 //margin-top: 63px; 38 //margin-top: 63px;
39 - margin-left: 300px; 39 + margin-left: 340px;
40 display: block; 40 display: block;
41 position: relative; 41 position: relative;
42 padding: 0 16px; 42 padding: 0 16px;
43 } 43 }
44 44
45 -.logo { 45 +.logo-container {
46 + padding: $-xl $-s $-l $-s;
47 + color: #CCC;
48 + .logo {
46 font-size: 2em; 49 font-size: 2em;
47 - padding: $-xl $-s;
48 font-weight: bold; 50 font-weight: bold;
49 - color: #CCC; 51 + margin-bottom: $-m;
52 + }
53 + i {
54 + padding-right: $-s;
55 + }
50 } 56 }
51 57
58 +
52 .search-box { 59 .search-box {
53 input { 60 input {
54 width: 100%; 61 width: 100%;
...@@ -311,6 +318,7 @@ h1, h2, h3, h4, h5, h6 { ...@@ -311,6 +318,7 @@ h1, h2, h3, h4, h5, h6 {
311 .book-tree .sidebar-page-list { 318 .book-tree .sidebar-page-list {
312 list-style: none; 319 list-style: none;
313 margin: 0; 320 margin: 0;
321 + border-left: 1px solid #7BD06E;
314 li a { 322 li a {
315 display: block; 323 display: block;
316 border-bottom: 1px solid #3A3939; 324 border-bottom: 1px solid #3A3939;
...@@ -375,3 +383,59 @@ body.dragging, body.dragging * { ...@@ -375,3 +383,59 @@ body.dragging, body.dragging * {
375 .sortable-page-list li.placeholder:before { 383 .sortable-page-list li.placeholder:before {
376 position: absolute; 384 position: absolute;
377 } 385 }
386 +
387 +.image-cover {
388 + height: 100vh;
389 + width: 100%;
390 + overflow: hidden;
391 + background-size: cover;
392 + &.login {
393 + background-image: url('/images/bg-books.jpg');
394 + }
395 +}
396 +
397 +.sidebar-bg {
398 + background-image: url('/images/bg-books.jpg');
399 + background-size: cover;
400 + background-position: 50% 50%;
401 + position: absolute;
402 + top: 0;
403 + left: 0;
404 + width: 100%;
405 + height: 100%;
406 + z-index: -1;
407 + .overlay {
408 + position: absolute;
409 + top: 0;
410 + left: 0;
411 + width: 100%;
412 + height: 100%;
413 + z-index: -1;
414 + background-color: rgba(0,0,0,0.7);
415 + }
416 +}
417 +
418 +.image-cover #sidebar {
419 + width: auto;
420 + border: 0;
421 + background-color: rgba(0, 0, 0, 0.38);
422 +}
423 +
424 +.center-box {
425 + margin-top: 15vh;
426 + padding: $-m $-xxl $-xl*2 $-xxl;
427 + max-width: 346px;
428 + h1, label {
429 + color: #EEE;
430 + }
431 + h1 {
432 + margin-bottom: $-m;
433 + }
434 + .button {
435 + margin-top: $-xl;
436 + }
437 + input {
438 + background-color: transparent;
439 + color: #EEE;
440 + }
441 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 +@extends('public')
2 +
3 +@section('body-class', 'image-cover login')
4 +
5 +@section('sidebar')
6 +
7 +
8 + {{--<div class="row faded-small">--}}
9 + {{--<div class="col-md-6"></div>--}}
10 + {{--<div class="col-md-6 faded">--}}
11 + {{--<div class="action-buttons">--}}
12 + {{--<a href="/books/create" class="text-pos"><i class="zmdi zmdi-plus"></i>Add new book</a>--}}
13 + {{--</div>--}}
14 + {{--</div>--}}
15 + {{--</div>--}}
16 +
17 + <div class="text-center">
18 + <div class="center-box text-left">
19 + <h1>Login</h1>
20 +
21 + <form action="/login" method="POST">
22 + {!! csrf_field() !!}
23 +
24 + <div class="form-group">
25 + <label for="email">Email</label>
26 + @include('form/text', ['name' => 'email'])
27 + </div>
28 +
29 + <div class="form-group">
30 + <label for="password">Password</label>
31 + @include('form/password', ['name' => 'password'])
32 + </div>
33 +
34 + <div class="from-group">
35 + <button class="button block pos">Login</button>
36 + </div>
37 + </form>
38 + </div>
39 + </div>
40 +
41 +@stop
...\ No newline at end of file ...\ No newline at end of file
...@@ -29,11 +29,13 @@ ...@@ -29,11 +29,13 @@
29 <body> 29 <body>
30 30
31 <section id="sidebar"> 31 <section id="sidebar">
32 + <div class="sidebar-bg"><div class="overlay"></div></div>
32 <header> 33 <header>
33 <div class="padded row clearfix"> 34 <div class="padded row clearfix">
34 - <div class="col-md-12"> 35 + <div class="col-md-12 logo-container">
35 {{--<div ><img class="logo float left" src="/bookstack.svg" alt="BookStack"></div>--}} 36 {{--<div ><img class="logo float left" src="/bookstack.svg" alt="BookStack"></div>--}}
36 <div class="logo">BookStack</div> 37 <div class="logo">BookStack</div>
38 + <div><i class="zmdi zmdi-account"></i> {{ \Illuminate\Support\Facades\Auth::user()->name }}</div>
37 </div> 39 </div>
38 </div> 40 </div>
39 </header> 41 </header>
...@@ -44,6 +46,7 @@ ...@@ -44,6 +46,7 @@
44 </div> 46 </div>
45 <ul class="menu"> 47 <ul class="menu">
46 <li><a href="/books"><i class="zmdi zmdi-book"></i>Books</a></li> 48 <li><a href="/books"><i class="zmdi zmdi-book"></i>Books</a></li>
49 + <li><a href="/logout"><i class="zmdi zmdi-run zmdi-hc-flip-horizontal"></i>Logout</a></li>
47 </ul> 50 </ul>
48 @if(isset($book) && !isset($books)) 51 @if(isset($book) && !isset($books))
49 <div class="book-tree"> 52 <div class="book-tree">
......
1 +<input type="password" id="{{ $name }}" name="{{ $name }}"
2 + @if($errors->has($name)) class="neg" @endif
3 + @if(isset($placeholder)) placeholder="{{$placeholder}}" @endif
4 + @if(isset($model) || old($name)) value="{{ old($name) ? old($name) : $model->$name}}" @endif>
5 +@if($errors->has($name))
6 + <div class="text-neg text-small">{{ $errors->first($name) }}</div>
7 +@endif
...\ No newline at end of file ...\ No newline at end of file
1 +<!DOCTYPE html>
2 +<html>
3 +<head>
4 + <title>BookStack</title>
5 + <meta name="viewport" content="width=device-width">
6 + <link rel="stylesheet" href="/css/app.css">
7 + <link href='//fonts.googleapis.com/css?family=Roboto:400,400italic,500,500italic,700,700italic,300italic,100,300' rel='stylesheet' type='text/css'>
8 + <link rel="stylesheet" href="/bower/material-design-iconic-font/dist/css/material-design-iconic-font.min.css">
9 + <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
10 +
11 +</head>
12 +<body class="@yield('body-class')">
13 +
14 +<section id="sidebar">
15 + @yield('sidebar')
16 +</section>
17 +
18 +<section class="container">
19 + @yield('content')
20 +</section>
21 +
22 +</body>
23 +</html>