use BookStack\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
+use Illuminate\Http\Request;
+use Password;
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)]
+ );
+ }
+
}
\ No newline at end of file
use ResetsPasswords;
+ protected $redirectTo = '/';
+
/**
* Create a new controller instance.
*
$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));
+ }
}
\ No newline at end of file
'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,
];
\ No newline at end of file
border-left: 3px solid #BBB;
background-color: #EEE;
padding: $-s;
+ display: flex;
&:before {
font-family: 'Material-Design-Iconic-Font';
padding-right: $-s;
ol {
list-style: decimal;
- padding-left: $-m * 1.3;
+ padding-left: $-m * 2;
overflow: hidden;
}
@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')
@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')
@include('partials/custom-styles')
<!-- Custom user content -->
- @if(setting('app-custom-head', false))
+ @if(setting('app-custom-head'))
{!! setting('app-custom-head') !!}
@endif
</head>
table {
max-width: 800px !important;
font-size: 0.8em;
- width: auto !important;
+ width: 100% !important;
}
table td {
<!-- 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">
->seePageIs('/login');
}
+ public function test_reset_password_flow()
+ {
+ $this->visit('/login')->click('Forgot Password?')
+ ->seePageIs('/password/email')
+ ->press('Send Reset Link')
+
+ $this->seeInDatabase('password_resets', [
+ ]);
+
+ $reset = DB::table('password_resets')->where('email', '=', '
[email protected]')->first();
+ $this->visit('/password/reset/' . $reset->token)
+ ->see('Reset Password')
+ ->submitForm('Reset Password', [
+ '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
->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();
$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);
'updated_by' => $admin->id,
'name' => $imageName
]);
-
}