From c0826f2a9f1ee595ef880d992879a876168d16a5 Mon Sep 17 00:00:00 2001 From: Blair2004 Date: Sat, 31 Jul 2021 09:56:49 +0100 Subject: [PATCH] Update fix #224 --- app/Http/Controllers/AuthController.php | 16 ++++++++++++++++ app/Http/Requests/SignUpRequest.php | 4 ++-- config/nexopos.php | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 438e20623..ce4776b1d 100755 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -204,6 +204,22 @@ public function postSignUp( SignUpRequest $request ) { Hook::action( 'ns-register-form', $request ); + /** + * check user existence + */ + $user = User::where( 'email', $request->input( 'email' ) )->first(); + if ( $user instanceof User ) { + throw new NotAllowedException( __( 'Unable to register using this email.' ) ); + } + + /** + * check user existence + */ + $user = User::where( 'username', $request->input( 'username' ) )->first(); + if ( $user instanceof User ) { + throw new NotAllowedException( __( 'Unable to register using this username.' ) ); + } + $options = app()->make( Options::class ); $role = $options->get( 'ns_registration_role' ); $registration_validated = $options->get( 'ns_registration_validated', 'yes' ); diff --git a/app/Http/Requests/SignUpRequest.php b/app/Http/Requests/SignUpRequest.php index 158ae620c..3b3c09b5d 100755 --- a/app/Http/Requests/SignUpRequest.php +++ b/app/Http/Requests/SignUpRequest.php @@ -32,8 +32,8 @@ public function authorize() public function rules() { return [ - 'username' => 'required|min:6|unique:nexopos_users', - 'email' => 'email|unique:nexopos_users', + 'username' => 'required|min:6', + 'email' => 'email', 'password' => 'required', 'password_confirm' => 'same:password' ]; diff --git a/config/nexopos.php b/config/nexopos.php index dbec858f9..35a4506c6 100755 --- a/config/nexopos.php +++ b/config/nexopos.php @@ -1,6 +1,6 @@ '4.4.0', + 'version' => '4.4.1', 'pos' => [ // deprecated 'payments' => [