fix(user): ensure email attributes are stored in lowercase for consistency and prevent case-related issues

This commit is contained in:
Andras Bacsai
2025-09-05 17:44:34 +02:00
parent 49bd0a2a01
commit 9c3345318a
3 changed files with 21 additions and 3 deletions

View File

@@ -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 mode
if (! 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.');