mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-04-16 09:41:05 +00:00
Merge fixes from branch 'v0.12'
This commit is contained in:
commit
ac80723058
13 changed files with 115 additions and 6 deletions
app/Http/Controllers/Auth
config
resources
assets/sass
views
tests
|
@ -4,6 +4,8 @@ namespace BookStack\Http\Controllers\Auth;
|
|||
|
||||
use BookStack\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
use Illuminate\Http\Request;
|
||||
use Password;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
|
@ -30,4 +32,37 @@ class ForgotPasswordController extends Controller
|
|||
$this->middleware('guest');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function sendResetLinkEmail(Request $request)
|
||||
{
|
||||
$this->validate($request, ['email' => 'required|email']);
|
||||
|
||||
// We will send the password reset link to this user. Once we have attempted
|
||||
// to send the link, we will examine the response then see the message we
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
$response = $this->broker()->sendResetLink(
|
||||
$request->only('email')
|
||||
);
|
||||
|
||||
if ($response === Password::RESET_LINK_SENT) {
|
||||
$message = 'A password reset link has been sent to ' . $request->get('email') . '.';
|
||||
session()->flash('success', $message);
|
||||
return back()->with('status', trans($response));
|
||||
}
|
||||
|
||||
// If an error was returned by the password broker, we will get this message
|
||||
// translated so we can notify a user of the problem. We'll redirect back
|
||||
// to where the users came from so they can attempt this process again.
|
||||
return back()->withErrors(
|
||||
['email' => trans($response)]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -20,6 +20,8 @@ class ResetPasswordController extends Controller
|
|||
|
||||
use ResetsPasswords;
|
||||
|
||||
protected $redirectTo = '/';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
|
@ -30,4 +32,18 @@ class ResetPasswordController extends Controller
|
|||
$this->middleware('guest');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the response for a successful password reset.
|
||||
*
|
||||
* @param string $response
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
protected function sendResetResponse($response)
|
||||
{
|
||||
$message = 'Your password has been successfully reset.';
|
||||
session()->flash('success', $message);
|
||||
return redirect($this->redirectPath())
|
||||
->with('status', trans($response));
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@ return [
|
|||
'app-name-header' => true,
|
||||
'app-editor' => 'wysiwyg',
|
||||
'app-color' => '#0288D1',
|
||||
'app-color-light' => 'rgba(21, 101, 192, 0.15)'
|
||||
'app-color-light' => 'rgba(21, 101, 192, 0.15)',
|
||||
'app-custom-head' => false,
|
||||
'registration-enabled' => false,
|
||||
|
||||
];
|
|
@ -135,6 +135,7 @@
|
|||
border-left: 3px solid #BBB;
|
||||
background-color: #EEE;
|
||||
padding: $-s;
|
||||
display: flex;
|
||||
&:before {
|
||||
font-family: 'Material-Design-Iconic-Font';
|
||||
padding-right: $-s;
|
||||
|
|
|
@ -262,7 +262,7 @@ ul {
|
|||
|
||||
ol {
|
||||
list-style: decimal;
|
||||
padding-left: $-m * 1.3;
|
||||
padding-left: $-m * 2;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
@extends('public')
|
||||
|
||||
@section('header-buttons')
|
||||
<a href="{{ baseUrl("/login") }}"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
|
||||
@if(setting('registration-enabled'))
|
||||
<a href="{{ baseUrl("/register") }}"><i class="zmdi zmdi-account-add"></i>Sign up</a>
|
||||
@endif
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
@extends('public')
|
||||
|
||||
@section('header-buttons')
|
||||
<a href="{{ baseUrl("/login") }}"><i class="zmdi zmdi-sign-in"></i>Sign in</a>
|
||||
@if(setting('registration-enabled'))
|
||||
<a href="{{ baseUrl("/register") }}"><i class="zmdi zmdi-account-add"></i>Sign up</a>
|
||||
@endif
|
||||
@stop
|
||||
|
||||
@section('body-class', 'image-cover login')
|
||||
|
||||
@section('content')
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
@include('partials/custom-styles')
|
||||
|
||||
<!-- Custom user content -->
|
||||
@if(setting('app-custom-head', false))
|
||||
@if(setting('app-custom-head'))
|
||||
{!! setting('app-custom-head') !!}
|
||||
@endif
|
||||
</head>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
table {
|
||||
max-width: 800px !important;
|
||||
font-size: 0.8em;
|
||||
width: auto !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
table td {
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
<!-- Scripts -->
|
||||
<script src="{{ baseUrl("/libs/jquery/jquery.min.js?version=2.1.4") }}"></script>
|
||||
@include('partials/custom-styles')
|
||||
|
||||
<!-- Custom user content -->
|
||||
@if(setting('app-custom-head'))
|
||||
{!! setting('app-custom-head') !!}
|
||||
@endif
|
||||
</head>
|
||||
<body class="@yield('body-class')" ng-app="bookStack">
|
||||
|
||||
|
|
|
@ -218,6 +218,37 @@ class AuthTest extends TestCase
|
|||
->seePageIs('/login');
|
||||
}
|
||||
|
||||
public function test_reset_password_flow()
|
||||
{
|
||||
$this->visit('/login')->click('Forgot Password?')
|
||||
->seePageIs('/password/email')
|
||||
->type('admin@admin.com', 'email')
|
||||
->press('Send Reset Link')
|
||||
->see('A password reset link has been sent to admin@admin.com');
|
||||
|
||||
$this->seeInDatabase('password_resets', [
|
||||
'email' => 'admin@admin.com'
|
||||
]);
|
||||
|
||||
$reset = DB::table('password_resets')->where('email', '=', 'admin@admin.com')->first();
|
||||
$this->visit('/password/reset/' . $reset->token)
|
||||
->see('Reset Password')
|
||||
->submitForm('Reset Password', [
|
||||
'email' => 'admin@admin.com',
|
||||
'password' => 'randompass',
|
||||
'password_confirmation' => 'randompass'
|
||||
])->seePageIs('/')
|
||||
->see('Your password has been successfully reset');
|
||||
}
|
||||
|
||||
public function test_reset_password_page_shows_sign_links()
|
||||
{
|
||||
$this->setSettings(['registration-enabled' => 'true']);
|
||||
$this->visit('/password/email')
|
||||
->seeLink('Sign in')
|
||||
->seeLink('Sign up');
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a login
|
||||
* @param string $email
|
||||
|
|
|
@ -91,6 +91,12 @@ class EntitySearchTest extends TestCase
|
|||
->see('Book Search Results')->see('.entity-list', $book->name);
|
||||
}
|
||||
|
||||
public function test_searching_hypen_doesnt_break()
|
||||
{
|
||||
$this->visit('/search/all?term=cat+-')
|
||||
->seeStatusCode(200);
|
||||
}
|
||||
|
||||
public function test_ajax_entity_search()
|
||||
{
|
||||
$page = \BookStack\Page::all()->last();
|
||||
|
|
|
@ -57,7 +57,7 @@ class ImageTest extends TestCase
|
|||
$relPath = $this->uploadImage($imageName, $page->id);
|
||||
$this->assertResponseOk();
|
||||
|
||||
$this->assertTrue(file_exists(public_path($relPath)), 'Uploaded image exists');
|
||||
$this->assertTrue(file_exists(public_path($relPath)), 'Uploaded image not found at path: '. public_path($relPath));
|
||||
|
||||
$this->deleteImage($relPath);
|
||||
|
||||
|
@ -70,7 +70,6 @@ class ImageTest extends TestCase
|
|||
'updated_by' => $admin->id,
|
||||
'name' => $imageName
|
||||
]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue