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' => [