]> BookStack Code Mirror - bookstack/commitdiff
Merge branch 'v0.12' into release
authorDan Brown <redacted>
Sun, 30 Oct 2016 13:18:23 +0000 (13:18 +0000)
committerDan Brown <redacted>
Sun, 30 Oct 2016 13:18:23 +0000 (13:18 +0000)
16 files changed:
app/Entity.php
app/Http/Controllers/Auth/PasswordController.php
app/helpers.php
config/setting-defaults.php
resources/assets/sass/_blocks.scss
resources/assets/sass/_text.scss
resources/views/auth/password.blade.php
resources/views/auth/reset.blade.php
resources/views/base.blade.php
resources/views/emails/email-confirmation.blade.php
resources/views/emails/password.blade.php
resources/views/pages/pdf.blade.php
resources/views/public.blade.php
tests/Auth/AuthTest.php
tests/Entity/EntitySearchTest.php
tests/ImageTest.php

index 496d20a333fa1069cd7c1ac19491df94b3f82b29..2c447814f4657da11151f3cc1daf8e842bcd7658 100644 (file)
@@ -160,44 +160,46 @@ class Entity extends Ownable
     public function fullTextSearchQuery($fieldsToSearch, $terms, $wheres = [])
     {
         $exactTerms = [];
-        if (count($terms) === 0) {
-            $search = $this;
-            $orderBy = 'updated_at';
-        } else {
-            foreach ($terms as $key => $term) {
-                $term = htmlentities($term, ENT_QUOTES);
-                $term = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $term);
-                if (preg_match('/&quot;.*?&quot;/', $term)) {
-                    $term = str_replace('&quot;', '', $term);
-                    $exactTerms[] = '%' . $term . '%';
-                    $term = '"' . $term . '"';
-                } else {
-                    $term = '' . $term . '*';
-                }
-                if ($term !== '*') $terms[$key] = $term;
+        $fuzzyTerms = [];
+        $search = static::newQuery();
+        foreach ($terms as $key => $term) {
+            $safeTerm = htmlentities($term, ENT_QUOTES);
+            $safeTerm = preg_replace('/[+\-><\(\)~*\"@]+/', ' ', $safeTerm);
+            if (preg_match('/&quot;.*?&quot;/', $safeTerm) || is_numeric($safeTerm)) {
+                $safeTerm = preg_replace('/^"(.*?)"$/', '$1', $term);
+                $exactTerms[] = '%' . $safeTerm . '%';
+            } else {
+                $safeTerm = '' . $safeTerm . '*';
+                if (trim($safeTerm) !== '*') $fuzzyTerms[] = $safeTerm;
             }
-            $termString = implode(' ', $terms);
+        }
+        $isFuzzy = count($exactTerms) === 0 || count($fuzzyTerms) > 0;
+
+        // Perform fulltext search if relevant terms exist.
+        if ($isFuzzy) {
+            $termString = implode(' ', $fuzzyTerms);
             $fields = implode(',', $fieldsToSearch);
-            $search = static::selectRaw('*, MATCH(name) AGAINST(? IN BOOLEAN MODE) AS title_relevance', [$termString]);
+            $search = $search->selectRaw('*, MATCH(name) AGAINST(? IN BOOLEAN MODE) AS title_relevance', [$termString]);
             $search = $search->whereRaw('MATCH(' . $fields . ') AGAINST(? IN BOOLEAN MODE)', [$termString]);
+        }
 
-            // Ensure at least one exact term matches if in search
-            if (count($exactTerms) > 0) {
-                $search = $search->where(function ($query) use ($exactTerms, $fieldsToSearch) {
-                    foreach ($exactTerms as $exactTerm) {
-                        foreach ($fieldsToSearch as $field) {
-                            $query->orWhere($field, 'like', $exactTerm);
-                        }
+        // Ensure at least one exact term matches if in search
+        if (count($exactTerms) > 0) {
+            $search = $search->where(function ($query) use ($exactTerms, $fieldsToSearch) {
+                foreach ($exactTerms as $exactTerm) {
+                    foreach ($fieldsToSearch as $field) {
+                        $query->orWhere($field, 'like', $exactTerm);
                     }
-                });
-            }
-            $orderBy = 'title_relevance';
-        };
+                }
+            });
+        }
+        $orderBy = $isFuzzy ? 'title_relevance' : 'updated_at';
 
         // Add additional where terms
         foreach ($wheres as $whereTerm) {
             $search->where($whereTerm[0], $whereTerm[1], $whereTerm[2]);
         }
+
         // Load in relations
         if ($this->isA('page')) {
             $search = $search->with('book', 'chapter', 'createdBy', 'updatedBy');
index 038e444d24fc446fe2fb1217324e2ad43761b972..4dc6583ead708d9f1966c5b8c64f860b8bcf3168 100644 (file)
@@ -4,6 +4,8 @@ namespace BookStack\Http\Controllers\Auth;
 
 use BookStack\Http\Controllers\Controller;
 use Illuminate\Foundation\Auth\ResetsPasswords;
+use Illuminate\Http\Request;
+use Password;
 
 class PasswordController extends Controller
 {
@@ -29,4 +31,46 @@ class PasswordController extends Controller
     {
         $this->middleware('guest');
     }
+
+
+    /**
+     * Send a reset link to the given user.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @return \Illuminate\Http\Response
+     */
+    public function sendResetLinkEmail(Request $request)
+    {
+        $this->validate($request, ['email' => 'required|email']);
+
+        $broker = $this->getBroker();
+
+        $response = Password::broker($broker)->sendResetLink(
+            $request->only('email'), $this->resetEmailBuilder()
+        );
+
+        switch ($response) {
+            case Password::RESET_LINK_SENT:
+                $message = 'A password reset link has been sent to ' . $request->get('email') . '.';
+                session()->flash('success', $message);
+                return $this->getSendResetLinkEmailSuccessResponse($response);
+
+            case Password::INVALID_USER:
+            default:
+                return $this->getSendResetLinkEmailFailureResponse($response);
+        }
+    }
+
+    /**
+     * Get the response for after a successful password reset.
+     *
+     * @param  string  $response
+     * @return \Symfony\Component\HttpFoundation\Response
+     */
+    protected function getResetSuccessResponse($response)
+    {
+        $message = 'Your password has been successfully reset.';
+        session()->flash('success', $message);
+        return redirect($this->redirectPath())->with('status', trans($response));
+    }
 }
index b8abb10066a94d46bb155e2ff07c617281d49f86..c12708877c4aa73266ceedde18127e62763983c0 100644 (file)
@@ -84,6 +84,11 @@ function baseUrl($path, $forceAppDomain = false)
         $path = implode('/', array_splice($explodedPath, 3));
     }
 
+    // Return normal url path if not specified in config
+    if (config('app.url') === '') {
+        return url($path);
+    }
+
     return rtrim(config('app.url'), '/') . '/' . $path;
 }
 
index 24a49c364195ca03985f1fae198da59ed52069d9..deafceb29c2e774cee42900e8cc47739a4fffec8 100644 (file)
@@ -8,6 +8,8 @@ return [
     'app-name'        => 'BookStack',
     '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
index 3c7f7490b0de89c0b83ad694e5f110ed3db486d2..727633f757f6a98fa6e97b5aa8b2e41ea1557d78 100644 (file)
   border-left: 3px solid #BBB;
   background-color: #EEE;
   padding: $-s;
+  display: flex;
   &:before {
     font-family: 'Material-Design-Iconic-Font';
     padding-right: $-s;
index cd81bb4e21326d24e2589751438b0a8e510e217b..8bf09a626f01528c17d6f337ae60ed26c2a6b316 100644 (file)
@@ -252,7 +252,7 @@ ul {
 
 ol {
   list-style: decimal;
-  padding-left: $-m * 1.3;
+  padding-left: $-m * 2;
   overflow: hidden;
 }
 
index d8536efa723bebef008e1feb194c682fd773a394..115785ab2eb43893df69e64b3573c7aa3b3a9101 100644 (file)
@@ -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')
 
 
index 9a9a65ff094516af8ac142e3b898222f0c2589fd..612b50ff835eb069f54b77ae0bf8af91c8d09acf 100644 (file)
@@ -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')
index be47abdcaaf3e23903c63e03884f790433d3ac6a..961ead251bfdd79f9f886ed43639228c7e0d9da2 100644 (file)
@@ -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>
index 6a0dc03789e5ae07a3260fd6336f64c8f9a90fb2..0a211c369d1f498c5bca92d4b70feb9abab8e50b 100644 (file)
                             <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">
                                 Email Confirmation</h1>
                             <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
-                                Thanks for joining <a href="{{ baseUrl('/') }}">{{ setting('app-name')}}</a>. <br/>
+                                Thanks for joining <a href="{{ baseUrl('/', true) }}">{{ setting('app-name')}}</a>. <br/>
                                 Please confirm your email address by clicking the button below.</p>
                             <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">
                                 <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">
                                     <td class="padding"
                                         style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">
                                         <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">
-                                            <a class="btn-primary" href="{{ baseUrl('/register/confirm/' . $token) }}"
+                                            <a class="btn-primary" href="{{ baseUrl('/register/confirm/' . $token, true) }}"
                                                style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Confirm
                                                 Email</a></p>
                                     </td>
index dfd8f3db5bed658079c0fdfc968c0b8e6494f67d..a8f7911e0a747b528ab4169ab9e735a1d6b5e183 100644 (file)
@@ -1 +1 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\r        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r<html xmlns="http://www.w3.org/1999/xhtml"\r      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r\r<head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r    <meta name="viewport" content="width=device-width"\r          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>\r    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"\r          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>\r    <title>Password Reset From {{ setting('app-name')}}</title>\r    <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r        * {\r            margin: 0;\r            padding: 0;\r            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;\r            font-size: 100%;\r            line-height: 1.6;\r        }\r\r        img {\r            max-width: 100%;\r        }\r\r        body {\r            -webkit-font-smoothing: antialiased;\r            -webkit-text-size-adjust: none;\r            width: 100% !important;\r            height: 100%;\r        }\r\r        a {\r            color: #348eda;\r        }\r\r        .btn-primary {\r            text-decoration: none;\r            color: #FFF;\r            background-color: #348eda;\r            border: solid #348eda;\r            border-width: 10px 20px;\r            line-height: 2;\r            font-weight: bold;\r            margin-right: 10px;\r            text-align: center;\r            cursor: pointer;\r            display: inline-block;\r            border-radius: 4px;\r        }\r\r        .btn-secondary {\r            text-decoration: none;\r            color: #FFF;\r            background-color: #aaa;\r            border: solid #aaa;\r            border-width: 10px 20px;\r            line-height: 2;\r            font-weight: bold;\r            margin-right: 10px;\r            text-align: center;\r            cursor: pointer;\r            display: inline-block;\r            border-radius: 25px;\r        }\r\r        .last {\r            margin-bottom: 0;\r        }\r\r        .first {\r            margin-top: 0;\r        }\r\r        .padding {\r            padding: 10px 0;\r        }\r\r        table.body-wrap {\r            width: 100%;\r            padding: 20px;\r        }\r\r        table.body-wrap .container {\r            border: 1px solid #f0f0f0;\r        }\r\r        h1,\r        h2,\r        h3 {\r            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\r            color: #444;\r            margin: 10px 0 10px;\r            line-height: 1.2;\r            font-weight: 200;\r        }\r\r        h1 {\r            font-size: 36px;\r        }\r\r        h2 {\r            font-size: 28px;\r        }\r\r        h3 {\r            font-size: 22px;\r        }\r\r        p,\r        ul,\r        ol {\r            margin-bottom: 10px;\r            font-weight: normal;\r            font-size: 14px;\r            color: #888888;\r        }\r\r        ul li,\r        ol li {\r            margin-left: 5px;\r            list-style-position: inside;\r        }\r\r        .container {\r            display: block !important;\r            max-width: 600px !important;\r            margin: 0 auto !important;\r            clear: both !important;\r        }\r\r        .body-wrap .container {\r            padding: 20px;\r        }\r\r        .content {\r            max-width: 600px;\r            margin: 0 auto;\r            display: block;\r        }\r\r        .content table {\r            width: 100%;\r        }\r    </style>\r</head>\r\r<body bgcolor="#f6f6f6"\r      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">\r<!-- body -->\r<table class="body-wrap" bgcolor="#f6f6f6"\r       style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">\r    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>\r        <td class="container" bgcolor="#FFFFFF"\r            style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">\r            <!-- content -->\r            <div class="content"\r                 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">\r                <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">\r                    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                            <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">\r                                Password Reset</h1>\r                            <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">\r                                A password reset was requested for this email address on <a\r                                        href="{{ baseUrl('/') }}">{{ setting('app-name')}}</a>. If you did not request\r                                a password change please ignore this email.</p>\r                            <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">\r                                <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                                    <td class="padding"\r                                        style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">\r                                        <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">\r                                            <a class="btn-primary" href="{{ baseUrl('/password/reset/' . $token) }}"\r                                               style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Click\r                                                here to reset your password</a></p>\r                                    </td>\r                                </tr>\r                            </table>\r                        </td>\r                    </tr>\r                </table>\r            </div>\r            <!-- /content -->\r        </td>\r        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>\r    </tr>\r</table>\r<!-- /body -->\r</body>\r\r</html>\r
\ No newline at end of file
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\r        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r<html xmlns="http://www.w3.org/1999/xhtml"\r      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r\r<head style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r    <meta name="viewport" content="width=device-width"\r          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>\r    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"\r          style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"/>\r    <title>Password Reset From {{ setting('app-name')}}</title>\r    <style style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r        * {\r            margin: 0;\r            padding: 0;\r            font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;\r            font-size: 100%;\r            line-height: 1.6;\r        }\r\r        img {\r            max-width: 100%;\r        }\r\r        body {\r            -webkit-font-smoothing: antialiased;\r            -webkit-text-size-adjust: none;\r            width: 100% !important;\r            height: 100%;\r        }\r\r        a {\r            color: #348eda;\r        }\r\r        .btn-primary {\r            text-decoration: none;\r            color: #FFF;\r            background-color: #348eda;\r            border: solid #348eda;\r            border-width: 10px 20px;\r            line-height: 2;\r            font-weight: bold;\r            margin-right: 10px;\r            text-align: center;\r            cursor: pointer;\r            display: inline-block;\r            border-radius: 4px;\r        }\r\r        .btn-secondary {\r            text-decoration: none;\r            color: #FFF;\r            background-color: #aaa;\r            border: solid #aaa;\r            border-width: 10px 20px;\r            line-height: 2;\r            font-weight: bold;\r            margin-right: 10px;\r            text-align: center;\r            cursor: pointer;\r            display: inline-block;\r            border-radius: 25px;\r        }\r\r        .last {\r            margin-bottom: 0;\r        }\r\r        .first {\r            margin-top: 0;\r        }\r\r        .padding {\r            padding: 10px 0;\r        }\r\r        table.body-wrap {\r            width: 100%;\r            padding: 20px;\r        }\r\r        table.body-wrap .container {\r            border: 1px solid #f0f0f0;\r        }\r\r        h1,\r        h2,\r        h3 {\r            font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;\r            color: #444;\r            margin: 10px 0 10px;\r            line-height: 1.2;\r            font-weight: 200;\r        }\r\r        h1 {\r            font-size: 36px;\r        }\r\r        h2 {\r            font-size: 28px;\r        }\r\r        h3 {\r            font-size: 22px;\r        }\r\r        p,\r        ul,\r        ol {\r            margin-bottom: 10px;\r            font-weight: normal;\r            font-size: 14px;\r            color: #888888;\r        }\r\r        ul li,\r        ol li {\r            margin-left: 5px;\r            list-style-position: inside;\r        }\r\r        .container {\r            display: block !important;\r            max-width: 600px !important;\r            margin: 0 auto !important;\r            clear: both !important;\r        }\r\r        .body-wrap .container {\r            padding: 20px;\r        }\r\r        .content {\r            max-width: 600px;\r            margin: 0 auto;\r            display: block;\r        }\r\r        .content table {\r            width: 100%;\r        }\r    </style>\r</head>\r\r<body bgcolor="#f6f6f6"\r      style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100%!important;height:100%;">\r<!-- body -->\r<table class="body-wrap" bgcolor="#f6f6f6"\r       style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;">\r    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>\r        <td class="container" bgcolor="#FFFFFF"\r            style="font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;display:block!important;max-width:600px!important;margin-top:0 !important;margin-bottom:0 !important;margin-right:auto !important;margin-left:auto !important;clear:both!important;padding-top:20px;padding-bottom:20px;padding-right:20px;padding-left:20px;border-width:1px;border-style:solid;border-color:#f0f0f0;">\r            <!-- content -->\r            <div class="content"\r                 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;max-width:600px;margin-top:0;margin-bottom:0;margin-right:auto;margin-left:auto;display:block;">\r                <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">\r                    <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                            <h1 style="padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;color:#444;margin-top:10px;margin-bottom:10px;margin-right:0;margin-left:0;line-height:1.2;font-weight:200;font-size:36px;">\r                                Password Reset</h1>\r                            <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">\r                                A password reset was requested for this email address on <a\r                                        href="{{ baseUrl('/', true) }}">{{ setting('app-name')}}</a>. If you did not request\r                                a password change please ignore this email.</p>\r                            <table style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;width:100%;">\r                                <tr style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;">\r                                    <td class="padding"\r                                        style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;padding-top:10px;padding-bottom:10px;padding-right:0;padding-left:0;">\r                                        <p style="margin-top:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;line-height:1.6;margin-bottom:10px;font-weight:normal;font-size:14px;color:#888888;">\r                                            <a class="btn-primary" href="{{ baseUrl('/password/reset/' . $token, true) }}"\r                                               style="margin-top:0;margin-bottom:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;text-decoration:none;color:#FFF;background-color:#348eda;border-style:solid;border-color:#348eda;border-width:10px 20px;line-height:2;font-weight:bold;margin-right:10px;text-align:center;cursor:pointer;display:inline-block;border-radius:4px;">Click\r                                                here to reset your password</a></p>\r                                    </td>\r                                </tr>\r                            </table>\r                        </td>\r                    </tr>\r                </table>\r            </div>\r            <!-- /content -->\r        </td>\r        <td style="margin-top:0;margin-bottom:0;margin-right:0;margin-left:0;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0;font-family:'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif;font-size:100%;line-height:1.6;"></td>\r    </tr>\r</table>\r<!-- /body -->\r</body>\r\r</html>\r
\ No newline at end of file
index 0cbf4df02a32ec16f7ee99f00e4730236a034ec1..5c9fd5eea8707fad42b2ea5b982f3b78266a5f1c 100644 (file)
@@ -14,7 +14,7 @@
         table {
             max-width: 800px !important;
             font-size: 0.8em;
-            width: auto !important;
+            width: 100% !important;
         }
 
         table td {
index 2de4d968a650fe6310684e2be8d1c3f636f60617..2bce4157028a8ca2b1595021dfaa582cb3b67ae0 100644 (file)
     <!-- 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">
 
index 306771ed5a98883b4fb87b2242ecd90709a054fc..99885d552c7a0dcdf9b4b24e2d680502d614cad3 100644 (file)
@@ -216,6 +216,37 @@ class AuthTest extends TestCase
             ->seePageIs('/login');
     }
 
+    public function test_reset_password_flow()
+    {
+        $this->visit('/login')->click('Forgot Password?')
+            ->seePageIs('/password/email')
+            ->type('[email protected]', 'email')
+            ->press('Send Reset Link')
+            ->see('A password reset link has been sent to [email protected]');
+
+        $this->seeInDatabase('password_resets', [
+            'email' => '[email protected]'
+        ]);
+
+        $reset = DB::table('password_resets')->where('email', '=', '[email protected]')->first();
+        $this->visit('/password/reset/' . $reset->token)
+            ->see('Reset Password')
+            ->submitForm('Reset Password', [
+                'email' => '[email protected]',
+                '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
index 8adfd35a3e3c59037c2cb8e8e1f7574bf46adc66..cfdabdb0ac9efbe500aa2a20017538899e4d0bb7 100644 (file)
@@ -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();
index 806a36acc11fcb507987ba4e9ab2fc6935afa2fd..23373419f21792413a97706aee439787c13dc6aa 100644 (file)
@@ -57,10 +57,12 @@ 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);
 
         $this->seeInDatabase('images', [
-            'url' => $relPath,
+            'url' => url($relPath),
             'type' => 'gallery',
             'uploaded_to' => $page->id,
             'path' => $relPath,
@@ -68,8 +70,7 @@ class ImageTest extends TestCase
             'updated_by' => $admin->id,
             'name' => $imageName
         ]);
-        
-        $this->deleteImage($relPath);
+
     }
 
     public function test_image_delete()