Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F256798
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/app/Rules/SignupExternalEmail.php b/src/app/Rules/SignupExternalEmail.php
index 957dec6c..ecb6fd71 100644
--- a/src/app/Rules/SignupExternalEmail.php
+++ b/src/app/Rules/SignupExternalEmail.php
@@ -1,50 +1,50 @@
<?php
namespace App\Rules;
use App\SignupCode;
class SignupExternalEmail extends ExternalEmail
{
/**
* {@inheritDoc}
*/
public function passes($attribute, $email): bool
{
if (!parent::passes($attribute, $email)) {
return false;
}
// Check the max length, according to the database column length
if (strlen($email) > 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 00000000..0e45729f
--- /dev/null
+++ b/src/database/migrations/2022_01_03_120000_signup_codes_indices.php
@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+// phpcs:ignore
+class SignupCodesIndices extends Migration
+{
+ /**
+ * Run the migrations.
+ *
+ * @return void
+ */
+ public function up()
+ {
+ Schema::table(
+ 'signup_codes',
+ function (Blueprint $table) {
+ $table->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');
+ }
+ );
+ }
+}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Jun 9, 8:13 PM (1 d, 12 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
196858
Default Alt Text
(3 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment