mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-09-19 15:56:22 +00:00
Merge branch 'nesges/development' into development
This commit is contained in:
commit
dd251d9e62
@ -15,24 +15,13 @@ use Illuminate\Validation\Rules\Password;
|
|||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
{
|
{
|
||||||
protected SocialDriverManager $socialDriverManager;
|
|
||||||
protected RegistrationService $registrationService;
|
|
||||||
protected LoginService $loginService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new controller instance.
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
SocialDriverManager $socialDriverManager,
|
protected SocialDriverManager $socialDriverManager,
|
||||||
RegistrationService $registrationService,
|
protected RegistrationService $registrationService,
|
||||||
LoginService $loginService
|
protected LoginService $loginService
|
||||||
) {
|
) {
|
||||||
$this->middleware('guest');
|
$this->middleware('guest');
|
||||||
$this->middleware('guard:standard');
|
$this->middleware('guard:standard');
|
||||||
|
|
||||||
$this->socialDriverManager = $socialDriverManager;
|
|
||||||
$this->registrationService = $registrationService;
|
|
||||||
$this->loginService = $loginService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -87,6 +76,8 @@ class RegisterController extends Controller
|
|||||||
'name' => ['required', 'min:2', 'max:100'],
|
'name' => ['required', 'min:2', 'max:100'],
|
||||||
'email' => ['required', 'email', 'max:255', 'unique:users'],
|
'email' => ['required', 'email', 'max:255', 'unique:users'],
|
||||||
'password' => ['required', Password::default()],
|
'password' => ['required', Password::default()],
|
||||||
|
// Basic honey for bots that must not be filled in
|
||||||
|
'username' => ['prohibited'],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,6 +389,20 @@ input[type=color] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-group.ambrosia-container, .form-group.ambrosia-container * {
|
||||||
|
position:absolute !important;
|
||||||
|
height:1px !important;
|
||||||
|
width:1px !important;
|
||||||
|
margin:-1px !important;
|
||||||
|
padding:0 !important;
|
||||||
|
background:transparent !important;
|
||||||
|
color:transparent !important;
|
||||||
|
border:none !important;
|
||||||
|
overflow: hidden !important;
|
||||||
|
clip: rect(0,0,0,0) !important;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
|
||||||
.title-input input[type="text"] {
|
.title-input input[type="text"] {
|
||||||
display: block;
|
display: block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -538,4 +552,4 @@ input.shortcut-input {
|
|||||||
width: auto;
|
width: auto;
|
||||||
max-width: 120px;
|
max-width: 120px;
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,14 @@
|
|||||||
<form action="{{ url("/register") }}" method="POST" class="mt-l stretch-inputs">
|
<form action="{{ url("/register") }}" method="POST" class="mt-l stretch-inputs">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
|
|
||||||
|
{{-- Simple honeypot field --}}
|
||||||
|
<div class="form-group ambrosia-container" aria-hidden="true">
|
||||||
|
<label for="username">{{ trans('auth.name') }}</label>
|
||||||
|
@include('form.text', ['name' => 'username'])
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="email">{{ trans('auth.name') }}</label>
|
<label for="name">{{ trans('auth.name') }}</label>
|
||||||
@include('form.text', ['name' => 'name'])
|
@include('form.text', ['name' => 'name'])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -184,4 +184,23 @@ class RegistrationTest extends TestCase
|
|||||||
$resp->assertSee('The email must be a valid email address.');
|
$resp->assertSee('The email must be a valid email address.');
|
||||||
$resp->assertSee('The password must be at least 8 characters.');
|
$resp->assertSee('The password must be at least 8 characters.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_registration_simple_honeypot_active()
|
||||||
|
{
|
||||||
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
|
|
||||||
|
$resp = $this->get('/register');
|
||||||
|
$this->withHtml($resp)->assertElementExists('form input[name="username"]');
|
||||||
|
|
||||||
|
$resp = $this->post('/register', [
|
||||||
|
'name' => 'Barry',
|
||||||
|
'email' => 'barrybot@example.com',
|
||||||
|
'password' => 'barryIsTheBestBot',
|
||||||
|
'username' => 'MyUsername'
|
||||||
|
]);
|
||||||
|
$resp->assertRedirect('/register');
|
||||||
|
|
||||||
|
$resp = $this->followRedirects($resp);
|
||||||
|
$this->withHtml($resp)->assertElementExists('form input[name="username"].text-neg');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user