Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2016-11-12 11:40:54 +0000
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Commit
ac80723058ab4c86e6bf024e0c75b60ab6c59624
ac807230
2 parents
ab468bac
2af0021c
Merge fixes from branch 'v0.12'
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
115 additions
and
6 deletions
app/Http/Controllers/Auth/ForgotPasswordController.php
app/Http/Controllers/Auth/ResetPasswordController.php
config/setting-defaults.php
resources/assets/sass/_blocks.scss
resources/assets/sass/_text.scss
resources/views/auth/passwords/email.blade.php
resources/views/auth/passwords/reset.blade.php
resources/views/base.blade.php
resources/views/pages/pdf.blade.php
resources/views/public.blade.php
tests/Auth/AuthTest.php
tests/Entity/EntitySearchTest.php
tests/ImageTest.php
app/Http/Controllers/Auth/ForgotPasswordController.php
View file @
ac80723
...
...
@@ -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
)]
);
}
}
\ No newline at end of file
...
...
app/Http/Controllers/Auth/ResetPasswordController.php
View file @
ac80723
...
...
@@ -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
));
}
}
\ No newline at end of file
...
...
config/setting-defaults.php
View file @
ac80723
...
...
@@ -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
,
];
\ No newline at end of file
...
...
resources/assets/sass/_blocks.scss
View file @
ac80723
...
...
@@ -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
;
...
...
resources/assets/sass/_text.scss
View file @
ac80723
...
...
@@ -262,7 +262,7 @@ ul {
ol
{
list-style
:
decimal
;
padding-left
:
$-m
*
1
.3
;
padding-left
:
$-m
*
2
;
overflow
:
hidden
;
}
...
...
resources/views/auth/passwords/email.blade.php
View file @
ac80723
@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')
...
...
resources/views/auth/passwords/reset.blade.php
View file @
ac80723
@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')
...
...
resources/views/base.blade.php
View file @
ac80723
...
...
@@ -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>
...
...
resources/views/pages/pdf.blade.php
View file @
ac80723
...
...
@@ -14,7 +14,7 @@
table
{
max-width
:
800px
!important
;
font-size
:
0.8em
;
width
:
auto
!important
;
width
:
100%
!important
;
}
table
td
{
...
...
resources/views/public.blade.php
View file @
ac80723
...
...
@@ -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"
>
...
...
tests/Auth/AuthTest.php
View file @
ac80723
...
...
@@ -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
...
...
tests/Entity/EntitySearchTest.php
View file @
ac80723
...
...
@@ -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
();
...
...
tests/ImageTest.php
View file @
ac80723
...
...
@@ -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
]);
}
...
...
Please
register
or
sign in
to post a comment