1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2024-11-23 11:22:33 +01:00

Added auth login control

This commit is contained in:
Dan Brown 2015-08-05 20:59:39 +01:00
parent 2aca1794de
commit 71e2e057cb
11 changed files with 213 additions and 46 deletions

View File

@ -23,6 +23,10 @@ class AuthController extends Controller
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
protected $loginPath = '/login';
protected $redirectPath = '/';
/**
* Create a new authentication controller instance.
*

View File

@ -12,47 +12,57 @@
*/
Route::group(['prefix' => 'books'], function() {
Route::get('/', 'BookController@index');
Route::get('/create', 'BookController@create');
Route::post('/', 'BookController@store');
Route::get('/{slug}/edit', 'BookController@edit');
Route::put('/{slug}', 'BookController@update');
Route::delete('/{id}', 'BookController@destroy');
Route::get('/{slug}', 'BookController@show');
Route::get('/{slug}/delete', 'BookController@showDelete');
// Authentication routes...
Route::group(['middleware' => 'auth'], function() {
Route::get('/{bookSlug}/page/create', 'PageController@create');
Route::post('/{bookSlug}/page', 'PageController@store');
Route::get('/{bookSlug}/sort', 'PageController@sortPages');
Route::put('/{bookSlug}/sort', 'PageController@savePageSort');
Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
Route::group(['prefix' => 'books'], function() {
Route::get('/', 'BookController@index');
Route::get('/create', 'BookController@create');
Route::post('/', 'BookController@store');
Route::get('/{slug}/edit', 'BookController@edit');
Route::put('/{slug}', 'BookController@update');
Route::delete('/{id}', 'BookController@destroy');
Route::get('/{slug}', 'BookController@show');
Route::get('/{slug}/delete', 'BookController@showDelete');
Route::get('/{bookSlug}/page/create', 'PageController@create');
Route::post('/{bookSlug}/page', 'PageController@store');
Route::get('/{bookSlug}/sort', 'PageController@sortPages');
Route::put('/{bookSlug}/sort', 'PageController@savePageSort');
Route::get('/{bookSlug}/page/{pageSlug}', 'PageController@show');
Route::get('/{bookSlug}/page/{pageSlug}/edit', 'PageController@edit');
Route::get('/{bookSlug}/page/{pageSlug}/delete', 'PageController@showDelete');
Route::put('/{bookSlug}/page/{pageSlug}', 'PageController@update');
Route::delete('/{bookSlug}/page/{pageSlug}', 'PageController@destroy');
Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', 'PageController@create');
Route::get('/{bookSlug}/chapter/create', 'ChapterController@create');
Route::post('/{bookSlug}/chapter/create', 'ChapterController@store');
Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
});
Route::post('/upload/image', 'ImageController@upload');
Route::get('/images/all', 'ImageController@getAll');
Route::get('/images/all/{page}', 'ImageController@getAll');
Route::get('/images/{any}', 'ImageController@getImage')->where('any', '.*');
Route::get('/link/{id}', 'PageController@redirectFromLink');
Route::get('/pages/search/all', 'PageController@searchAll');
Route::get('/', function () {
return view('base');
});
Route::get('/{bookSlug}/chapter/{chapterSlug}/create-page', 'PageController@create');
Route::get('/{bookSlug}/chapter/create', 'ChapterController@create');
Route::post('/{bookSlug}/chapter/create', 'ChapterController@store');
Route::get('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@show');
Route::put('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@update');
Route::get('/{bookSlug}/chapter/{chapterSlug}/edit', 'ChapterController@edit');
Route::get('/{bookSlug}/chapter/{chapterSlug}/delete', 'ChapterController@showDelete');
Route::delete('/{bookSlug}/chapter/{chapterSlug}', 'ChapterController@destroy');
});
Route::post('/upload/image', 'ImageController@upload');
Route::get('/images/all', 'ImageController@getAll');
Route::get('/images/all/{page}', 'ImageController@getAll');
Route::get('/images/{any}', 'ImageController@getImage')->where('any', '.*');
Route::get('/link/{id}', 'PageController@redirectFromLink');
Route::get('/pages/search/all', 'PageController@searchAll');
Route::get('/', function () {
return view('base');
});
Route::get('/login', 'Auth\AuthController@getLogin');
Route::post('/login', 'Auth\AuthController@postLogin');
Route::get('/logout', 'Auth\AuthController@getLogout');

View File

@ -15,6 +15,11 @@ class DatabaseSeeder extends Seeder
Model::unguard();
// $this->call(UserTableSeeder::class);
\Oxbow\User::create([
'name' => 'Admin',
'email' => 'admin@admin.com',
'password' => \Illuminate\Support\Facades\Hash::make('password')
]);
Model::reguard();
}

BIN
public/images/bg-books.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

View File

@ -60,6 +60,12 @@ $button-border-radius: 3px;
}
}
.button.block {
width: 100%;
text-align: center;
display: block;
}
// Floating action button
//.fab {
// $size: 70px;

View File

@ -59,6 +59,10 @@ a {
i {
padding-right: $-s;
}
i.zmdi-hc-flip-horizontal {
padding-right: 0;
padding-left: $-s;
}
}
/*

View File

@ -27,7 +27,7 @@ header {
top: 0;
z-index: 1;
//padding-top: $-m;
width: 300px;
width: 340px;
border-right: 1px solid #DDD;
h4, li, p, a {
color: #CCC;
@ -36,19 +36,26 @@ header {
#content {
//margin-top: 63px;
margin-left: 300px;
margin-left: 340px;
display: block;
position: relative;
padding: 0 16px;
}
.logo {
font-size: 2em;
padding: $-xl $-s;
font-weight: bold;
.logo-container {
padding: $-xl $-s $-l $-s;
color: #CCC;
.logo {
font-size: 2em;
font-weight: bold;
margin-bottom: $-m;
}
i {
padding-right: $-s;
}
}
.search-box {
input {
width: 100%;
@ -311,6 +318,7 @@ h1, h2, h3, h4, h5, h6 {
.book-tree .sidebar-page-list {
list-style: none;
margin: 0;
border-left: 1px solid #7BD06E;
li a {
display: block;
border-bottom: 1px solid #3A3939;
@ -375,3 +383,59 @@ body.dragging, body.dragging * {
.sortable-page-list li.placeholder:before {
position: absolute;
}
.image-cover {
height: 100vh;
width: 100%;
overflow: hidden;
background-size: cover;
&.login {
background-image: url('/images/bg-books.jpg');
}
}
.sidebar-bg {
background-image: url('/images/bg-books.jpg');
background-size: cover;
background-position: 50% 50%;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
.overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
background-color: rgba(0,0,0,0.7);
}
}
.image-cover #sidebar {
width: auto;
border: 0;
background-color: rgba(0, 0, 0, 0.38);
}
.center-box {
margin-top: 15vh;
padding: $-m $-xxl $-xl*2 $-xxl;
max-width: 346px;
h1, label {
color: #EEE;
}
h1 {
margin-bottom: $-m;
}
.button {
margin-top: $-xl;
}
input {
background-color: transparent;
color: #EEE;
}
}

View File

@ -0,0 +1,41 @@
@extends('public')
@section('body-class', 'image-cover login')
@section('sidebar')
{{--<div class="row faded-small">--}}
{{--<div class="col-md-6"></div>--}}
{{--<div class="col-md-6 faded">--}}
{{--<div class="action-buttons">--}}
{{--<a href="/books/create" class="text-pos"><i class="zmdi zmdi-plus"></i>Add new book</a>--}}
{{--</div>--}}
{{--</div>--}}
{{--</div>--}}
<div class="text-center">
<div class="center-box text-left">
<h1>Login</h1>
<form action="/login" method="POST">
{!! csrf_field() !!}
<div class="form-group">
<label for="email">Email</label>
@include('form/text', ['name' => 'email'])
</div>
<div class="form-group">
<label for="password">Password</label>
@include('form/password', ['name' => 'password'])
</div>
<div class="from-group">
<button class="button block pos">Login</button>
</div>
</form>
</div>
</div>
@stop

View File

@ -29,11 +29,13 @@
<body>
<section id="sidebar">
<div class="sidebar-bg"><div class="overlay"></div></div>
<header>
<div class="padded row clearfix">
<div class="col-md-12">
<div class="col-md-12 logo-container">
{{--<div ><img class="logo float left" src="/bookstack.svg" alt="BookStack"></div>--}}
<div class="logo">BookStack</div>
<div><i class="zmdi zmdi-account"></i> {{ \Illuminate\Support\Facades\Auth::user()->name }}</div>
</div>
</div>
</header>
@ -44,6 +46,7 @@
</div>
<ul class="menu">
<li><a href="/books"><i class="zmdi zmdi-book"></i>Books</a></li>
<li><a href="/logout"><i class="zmdi zmdi-run zmdi-hc-flip-horizontal"></i>Logout</a></li>
</ul>
@if(isset($book) && !isset($books))
<div class="book-tree">

View File

@ -0,0 +1,7 @@
<input type="password" id="{{ $name }}" name="{{ $name }}"
@if($errors->has($name)) class="neg" @endif
@if(isset($placeholder)) placeholder="{{$placeholder}}" @endif
@if(isset($model) || old($name)) value="{{ old($name) ? old($name) : $model->$name}}" @endif>
@if($errors->has($name))
<div class="text-neg text-small">{{ $errors->first($name) }}</div>
@endif

View File

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<title>BookStack</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/css/app.css">
<link href='//fonts.googleapis.com/css?family=Roboto:400,400italic,500,500italic,700,700italic,300italic,100,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="/bower/material-design-iconic-font/dist/css/material-design-iconic-font.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body class="@yield('body-class')">
<section id="sidebar">
@yield('sidebar')
</section>
<section class="container">
@yield('content')
</section>
</body>
</html>