An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
fix(user): ensure email attributes are stored in lowercase for consistency and prevent case-related issues
Andras Bacsai9c3345318a12
diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.phpindex ea2befd3a8..9f97dd0d4c 100644--- a/app/Actions/Fortify/CreateNewUser.php+++ b/app/Actions/Fortify/CreateNewUser.php@@ -40,7 +40,7 @@ class CreateNewUser implements CreatesNewUsers$user = User::create(['id' => 0,'name' => $input['name'],- 'email' => strtolower($input['email']),+ 'email' => $input['email'],'password' => Hash::make($input['password']),]);$team = $user->teams()->first();@@ -52,7 +52,7 @@ class CreateNewUser implements CreatesNewUsers} else {$user = User::create(['name' => $input['name'],- 'email' => strtolower($input['email']),+ 'email' => $input['email'],'password' => Hash::make($input['password']),]);$team = $user->teams()->first();diff --git a/app/Livewire/Profile/Index.php b/app/Livewire/Profile/Index.phpindex a6b4dbe9ed..4a419a12f3 100644--- a/app/Livewire/Profile/Index.php+++ b/app/Livewire/Profile/Index.php@@ -78,6 +78,8 @@ class Index extends Component'new_email' => ['required', 'email', 'unique:users,email'],]);+ $this->new_email = strtolower($this->new_email);+// Skip rate limiting in development modeif (! isDev()) {// Rate limit by current user's email (1 request per 2 minutes)@@ -90,7 +92,7 @@ class Index extends Component}// Rate limit by new email address (3 requests per hour per email)- $newEmailKey = 'email-change:email:'.md5(strtolower($this->new_email));+ $newEmailKey = 'email-change:email:'.md5($this->new_email);if (! RateLimiter::attempt($newEmailKey, 3, function () {}, 3600)) {$this->dispatch('error', 'This email address has received too many verification requests. Please try again later.');diff --git a/app/Models/User.php b/app/Models/User.phpindex 48651d2922..9ab9fefe93 100644--- a/app/Models/User.php+++ b/app/Models/User.php@@ -56,6 +56,22 @@ class User extends Authenticatable implements SendsEmail'email_change_code_expires_at' => 'datetime',];+ /**+ * Set the email attribute to lowercase.+ */+ public function setEmailAttribute($value)+ {+ $this->attributes['email'] = strtolower($value);+ }++ /**+ * Set the pending_email attribute to lowercase.+ */+ public function setPendingEmailAttribute($value)+ {+ $this->attributes['pending_email'] = $value ? strtolower($value) : null;+ }+protected static function boot(){parent::boot();