From 0d2770f67d0662014dbe062ddac2848f2a24ff56 Mon Sep 17 00:00:00 2001 From: Pete Simmons Date: Fri, 22 May 2020 17:24:29 +0100 Subject: [PATCH 1/5] Update UsersManagementController.php --- src/App/Http/Controllers/UsersManagementController.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App/Http/Controllers/UsersManagementController.php b/src/App/Http/Controllers/UsersManagementController.php index aa48a52..74abe0b 100755 --- a/src/App/Http/Controllers/UsersManagementController.php +++ b/src/App/Http/Controllers/UsersManagementController.php @@ -91,7 +91,7 @@ public function create() public function store(Request $request) { $rules = [ - 'name' => 'required|string|max:255|unique:users', + 'name' => 'required|string|max:255|unique:users|alphanum', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|string|confirmed|min:6', 'password_confirmation' => 'required|string|same:password', @@ -104,6 +104,7 @@ public function store(Request $request) $messages = [ 'name.unique' => trans('laravelusers::laravelusers.messages.userNameTaken'), 'name.required' => trans('laravelusers::laravelusers.messages.userNameRequired'), + 'name.name' => trans('laravelusers::laravelusers.messages.userNameInvalid'), 'email.required' => trans('laravelusers::laravelusers.messages.emailRequired'), 'email.email' => trans('laravelusers::laravelusers.messages.emailInvalid'), 'password.required' => trans('laravelusers::laravelusers.messages.passwordRequired'), @@ -199,7 +200,7 @@ public function update(Request $request, $id) ]; if ($emailCheck) { - $rules['email'] = 'required|email|max:255|unique:users'; + $rules['email'] = 'required|email|max:255|unique:users|alphanum'; } if ($passwordCheck) { From 57309e03cea562c502e41ec139522befab2aae53 Mon Sep 17 00:00:00 2001 From: Pete Simmons Date: Fri, 22 May 2020 17:26:35 +0100 Subject: [PATCH 2/5] Update UsersManagementController.php --- src/App/Http/Controllers/UsersManagementController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App/Http/Controllers/UsersManagementController.php b/src/App/Http/Controllers/UsersManagementController.php index 74abe0b..ac13f01 100755 --- a/src/App/Http/Controllers/UsersManagementController.php +++ b/src/App/Http/Controllers/UsersManagementController.php @@ -91,7 +91,7 @@ public function create() public function store(Request $request) { $rules = [ - 'name' => 'required|string|max:255|unique:users|alphanum', + 'name' => 'required|string|max:255|unique:users|alpha_num', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|string|confirmed|min:6', 'password_confirmation' => 'required|string|same:password', @@ -200,7 +200,7 @@ public function update(Request $request, $id) ]; if ($emailCheck) { - $rules['email'] = 'required|email|max:255|unique:users|alphanum'; + $rules['email'] = 'required|email|max:255|unique:users|alpha_num'; } if ($passwordCheck) { From 942aed520b8f6dad327f926884d67ff2e4ce1007 Mon Sep 17 00:00:00 2001 From: Pete Simmons Date: Fri, 22 May 2020 17:28:11 +0100 Subject: [PATCH 3/5] Update laravelusers.php --- src/resources/lang/en/laravelusers.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/resources/lang/en/laravelusers.php b/src/resources/lang/en/laravelusers.php index 1154d11..f4ae4e6 100644 --- a/src/resources/lang/en/laravelusers.php +++ b/src/resources/lang/en/laravelusers.php @@ -54,6 +54,7 @@ 'messages' => [ 'userNameTaken' => 'Username is taken', 'userNameRequired' => 'Username is required', + 'userNameInvalid' => 'Username is invalid', 'fNameRequired' => 'First Name is required', 'lNameRequired' => 'Last Name is required', 'emailRequired' => 'Email is required', From 711318c855db1334605936db4694357b0af3dd0d Mon Sep 17 00:00:00 2001 From: Pete Simmons Date: Fri, 22 May 2020 17:30:30 +0100 Subject: [PATCH 4/5] Update UsersManagementController.php --- src/App/Http/Controllers/UsersManagementController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App/Http/Controllers/UsersManagementController.php b/src/App/Http/Controllers/UsersManagementController.php index ac13f01..211e13f 100755 --- a/src/App/Http/Controllers/UsersManagementController.php +++ b/src/App/Http/Controllers/UsersManagementController.php @@ -104,7 +104,7 @@ public function store(Request $request) $messages = [ 'name.unique' => trans('laravelusers::laravelusers.messages.userNameTaken'), 'name.required' => trans('laravelusers::laravelusers.messages.userNameRequired'), - 'name.name' => trans('laravelusers::laravelusers.messages.userNameInvalid'), + 'name' => trans('laravelusers::laravelusers.messages.userNameInvalid'), 'email.required' => trans('laravelusers::laravelusers.messages.emailRequired'), 'email.email' => trans('laravelusers::laravelusers.messages.emailInvalid'), 'password.required' => trans('laravelusers::laravelusers.messages.passwordRequired'), From 2acbbdebaf9205b940ceedca23c6534ec5479665 Mon Sep 17 00:00:00 2001 From: Pete Simmons Date: Fri, 22 May 2020 17:35:28 +0100 Subject: [PATCH 5/5] Changed to allow dashes in validator --- src/App/Http/Controllers/UsersManagementController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/App/Http/Controllers/UsersManagementController.php b/src/App/Http/Controllers/UsersManagementController.php index 211e13f..0e6bb2a 100755 --- a/src/App/Http/Controllers/UsersManagementController.php +++ b/src/App/Http/Controllers/UsersManagementController.php @@ -91,7 +91,7 @@ public function create() public function store(Request $request) { $rules = [ - 'name' => 'required|string|max:255|unique:users|alpha_num', + 'name' => 'required|string|max:255|unique:users|alpha_dash', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|string|confirmed|min:6', 'password_confirmation' => 'required|string|same:password', @@ -200,7 +200,7 @@ public function update(Request $request, $id) ]; if ($emailCheck) { - $rules['email'] = 'required|email|max:255|unique:users|alpha_num'; + $rules['email'] = 'required|email|max:255|unique:users|alpha_dash'; } if ($passwordCheck) {