diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index da4f42bb1..79d696652 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -70,7 +70,7 @@ class RegisterController extends Controller protected function validator(array $data) { return Validator::make($data, [ - 'name' => 'required|max:255', + 'name' => 'required|min:2|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|min:6', ]); diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php index 436734816..1065945c0 100644 --- a/resources/lang/en/auth.php +++ b/resources/lang/en/auth.php @@ -26,6 +26,8 @@ return [ 'remember_me' => 'Remember Me', 'ldap_email_hint' => 'Please enter an email to use for this 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_registration' => 'Social Registration', 'social_registration_text' => 'Register and sign in using another service.', diff --git a/resources/views/auth/forms/login/standard.blade.php b/resources/views/auth/forms/login/standard.blade.php index a12fbd753..ea63cf7ac 100644 --- a/resources/views/auth/forms/login/standard.blade.php +++ b/resources/views/auth/forms/login/standard.blade.php @@ -6,5 +6,7 @@
@include('form.password', ['name' => 'password', 'tabindex' => 1]) - {{ trans('auth.forgot_password') }} -
\ No newline at end of file + + {{ trans('auth.forgot_password') }} + + diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index eb7ca2da8..35c117800 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -6,10 +6,10 @@
 
-
+

{{ title_case(trans('auth.log_in')) }}

-
+ {!! csrf_field() !!}
@@ -25,6 +25,7 @@ 'label' => trans('auth.remember_me'), ])
+
@@ -43,6 +44,13 @@
@endforeach @endif + + @if(setting('registration-enabled', false)) +
+
+ {{ trans('auth.dont_have_account') }} +
+ @endif
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index d1e69e0a0..38904f63b 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -5,7 +5,7 @@
 
-
+

{{ title_case(trans('auth.sign_up')) }}

@@ -28,7 +28,7 @@
diff --git a/resources/views/common/header.blade.php b/resources/views/common/header.blade.php index c9c301572..7fab6cfda 100644 --- a/resources/views/common/header.blade.php +++ b/resources/views/common/header.blade.php @@ -41,7 +41,7 @@ @if(!signedInUser()) @if(setting('registration-enabled', false)) - @icon('new-user') {{ trans('auth.sign_up') }} + @icon('new-user') {{ trans('auth.sign_up') }} @endif @icon('login') {{ trans('auth.log_in') }} @endif diff --git a/tests/Auth/AuthTest.php b/tests/Auth/AuthTest.php index 0aa0e2a23..c39ef68e5 100644 --- a/tests/Auth/AuthTest.php +++ b/tests/Auth/AuthTest.php @@ -69,6 +69,31 @@ class AuthTest extends BrowserKitTest ->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() {