mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-04 18:14:04 +08:00
Merge branch 'cw1998-fix/registraion-form-validation'
This commit is contained in:
commit
fc761784a1
@ -70,7 +70,7 @@ class RegisterController extends Controller
|
|||||||
protected function validator(array $data)
|
protected function validator(array $data)
|
||||||
{
|
{
|
||||||
return Validator::make($data, [
|
return Validator::make($data, [
|
||||||
'name' => 'required|max:255',
|
'name' => 'required|min:2|max:255',
|
||||||
'email' => 'required|email|max:255|unique:users',
|
'email' => 'required|email|max:255|unique:users',
|
||||||
'password' => 'required|min:6',
|
'password' => 'required|min:6',
|
||||||
]);
|
]);
|
||||||
|
@ -26,6 +26,8 @@ return [
|
|||||||
'remember_me' => 'Remember Me',
|
'remember_me' => 'Remember Me',
|
||||||
'ldap_email_hint' => 'Please enter an email to use for this account.',
|
'ldap_email_hint' => 'Please enter an email to use for this account.',
|
||||||
'create_account' => 'Create Account',
|
'create_account' => 'Create Account',
|
||||||
|
'already_have_account' => 'Already have an account?',
|
||||||
|
'dont_have_account' => 'Don\'t have an account?',
|
||||||
'social_login' => 'Social Login',
|
'social_login' => 'Social Login',
|
||||||
'social_registration' => 'Social Registration',
|
'social_registration' => 'Social Registration',
|
||||||
'social_registration_text' => 'Register and sign in using another service.',
|
'social_registration_text' => 'Register and sign in using another service.',
|
||||||
|
@ -6,5 +6,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="password">{{ trans('auth.password') }}</label>
|
<label for="password">{{ trans('auth.password') }}</label>
|
||||||
@include('form.password', ['name' => 'password', 'tabindex' => 1])
|
@include('form.password', ['name' => 'password', 'tabindex' => 1])
|
||||||
<span class="block small mt-s"><a href="{{ baseUrl('/password/email') }}">{{ trans('auth.forgot_password') }}</a></span>
|
<span class="block small mt-s">
|
||||||
</div>
|
<a href="{{ baseUrl('/password/email') }}">{{ trans('auth.forgot_password') }}</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
<div class="my-l"> </div>
|
<div class="my-l"> </div>
|
||||||
|
|
||||||
<div class="card content-wrap">
|
<div class="card content-wrap auto-height">
|
||||||
<h1 class="list-heading">{{ title_case(trans('auth.log_in')) }}</h1>
|
<h1 class="list-heading">{{ title_case(trans('auth.log_in')) }}</h1>
|
||||||
|
|
||||||
<form action="{{ baseUrl("/login") }}" method="POST" id="login-form" class="mt-l">
|
<form action="{{ baseUrl('/login') }}" method="POST" id="login-form" class="mt-l">
|
||||||
{!! csrf_field() !!}
|
{!! csrf_field() !!}
|
||||||
|
|
||||||
<div class="stretch-inputs">
|
<div class="stretch-inputs">
|
||||||
@ -25,6 +25,7 @@
|
|||||||
'label' => trans('auth.remember_me'),
|
'label' => trans('auth.remember_me'),
|
||||||
])
|
])
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<button class="button primary" tabindex="3">{{ title_case(trans('auth.log_in')) }}</button>
|
<button class="button primary" tabindex="3">{{ title_case(trans('auth.log_in')) }}</button>
|
||||||
</div>
|
</div>
|
||||||
@ -43,6 +44,13 @@
|
|||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
@if(setting('registration-enabled', false))
|
||||||
|
<div class="text-center">
|
||||||
|
<hr class="my-l">
|
||||||
|
<a href="{{ baseUrl('/register') }}">{{ trans('auth.dont_have_account') }}</a>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<div class="my-l"> </div>
|
<div class="my-l"> </div>
|
||||||
|
|
||||||
<div class="card content-wrap">
|
<div class="card content-wrap auto-height">
|
||||||
<h1 class="list-heading">{{ title_case(trans('auth.sign_up')) }}</h1>
|
<h1 class="list-heading">{{ title_case(trans('auth.sign_up')) }}</h1>
|
||||||
|
|
||||||
<form action="{{ baseUrl("/register") }}" method="POST" class="mt-l stretch-inputs">
|
<form action="{{ baseUrl("/register") }}" method="POST" class="mt-l stretch-inputs">
|
||||||
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<div class="grid half collapse-xs gap-xl v-center mt-m">
|
<div class="grid half collapse-xs gap-xl v-center mt-m">
|
||||||
<div class="text-small">
|
<div class="text-small">
|
||||||
<a href="{{ baseUrl('/login') }}">Already have an account?</a>
|
<a href="{{ baseUrl('/login') }}">{{ trans('auth.already_have_account') }}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="from-group text-right">
|
<div class="from-group text-right">
|
||||||
<button class="button primary">{{ trans('auth.create_account') }}</button>
|
<button class="button primary">{{ trans('auth.create_account') }}</button>
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
@if(!signedInUser())
|
@if(!signedInUser())
|
||||||
@if(setting('registration-enabled', false))
|
@if(setting('registration-enabled', false))
|
||||||
<a href="{{ baseUrl("/register") }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
|
<a href="{{ baseUrl('/register') }}">@icon('new-user') {{ trans('auth.sign_up') }}</a>
|
||||||
@endif
|
@endif
|
||||||
<a href="{{ baseUrl('/login') }}">@icon('login') {{ trans('auth.log_in') }}</a>
|
<a href="{{ baseUrl('/login') }}">@icon('login') {{ trans('auth.log_in') }}</a>
|
||||||
@endif
|
@endif
|
||||||
|
@ -69,6 +69,31 @@ class AuthTest extends BrowserKitTest
|
|||||||
->seePageIs('/register');
|
->seePageIs('/register');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function test_registration_validation()
|
||||||
|
{
|
||||||
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
|
|
||||||
|
$this->visit('/register')
|
||||||
|
->type('1', '#name')
|
||||||
|
->type('1', '#email')
|
||||||
|
->type('1', '#password')
|
||||||
|
->press('Create Account')
|
||||||
|
->see('The name must be at least 2 characters.')
|
||||||
|
->see('The email must be a valid email address.')
|
||||||
|
->see('The password must be at least 6 characters.')
|
||||||
|
->seePageIs('/register');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_sign_up_link_on_login()
|
||||||
|
{
|
||||||
|
$this->visit('/login')
|
||||||
|
->dontSee('Sign up');
|
||||||
|
|
||||||
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
|
|
||||||
|
$this->visit('/login')
|
||||||
|
->see('Sign up');
|
||||||
|
}
|
||||||
|
|
||||||
public function test_confirmed_registration()
|
public function test_confirmed_registration()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user