diff --git a/src/app/Rules/SignupExternalEmail.php b/src/app/Rules/SignupExternalEmail.php index 957dec6..ecb6fd7 100644 --- a/src/app/Rules/SignupExternalEmail.php +++ b/src/app/Rules/SignupExternalEmail.php @@ -1,50 +1,50 @@ 191) { $this->message = \trans('validation.emailinvalid'); return false; } // Don't allow multiple open registrations against the same email address if (($limit = \config('app.signup.email_limit')) > 0) { $signups = SignupCode::where('email', $email) - ->whereDate('expires_at', '>', \Carbon\Carbon::now()); + ->where('expires_at', '>', \Carbon\Carbon::now()); if ($signups->count() >= $limit) { // @kanarip: this is deliberately an "email invalid" message $this->message = \trans('validation.emailinvalid'); return false; } } // Don't allow multiple open registrations against the same source ip address if (($limit = \config('app.signup.ip_limit')) > 0) { $signups = SignupCode::where('ip_address', request()->ip()) - ->whereDate('expires_at', '>', \Carbon\Carbon::now()); + ->where('expires_at', '>', \Carbon\Carbon::now()); if ($signups->count() >= $limit) { // @kanarip: this is deliberately an "email invalid" message $this->message = \trans('validation.emailinvalid'); return false; } } return true; } } diff --git a/src/database/migrations/2022_01_03_120000_signup_codes_indices.php b/src/database/migrations/2022_01_03_120000_signup_codes_indices.php new file mode 100644 index 0000000..0e45729 --- /dev/null +++ b/src/database/migrations/2022_01_03_120000_signup_codes_indices.php @@ -0,0 +1,43 @@ +index('email'); + $table->index('ip_address'); + $table->index('expires_at'); + } + ); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table( + 'signup_codes', + function (Blueprint $table) { + $table->dropIndex('email'); + $table->dropIndex('ip_address'); + $table->dropIndex('expires_at'); + } + ); + } +}