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

@@ -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();