Skip to content

Commit e9696ef

Browse files
committed
fix: clean up register
1 parent 58dc085 commit e9696ef

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Auth.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ public function login(array $credentials): bool
195195
unset($credentials[$passwordKey]);
196196
}
197197

198+
if (isset($credentials['email'])) {
199+
$credentials['email'] = strtolower($credentials['email']);
200+
}
201+
198202
try {
199203
$user = $this->db->select($table)->where($credentials)->first();
200204

@@ -252,6 +256,10 @@ public function register(array $userData): bool
252256
$userData['updated_at'] = $now;
253257
}
254258

259+
if (isset($userData['email'])) {
260+
$userData['email'] = strtolower($userData['email']);
261+
}
262+
255263
if (isset($credentials[Config::get('id.key')])) {
256264
$userData[Config::get('id.key')] = is_callable($userData[Config::get('id.key')])
257265
? call_user_func($userData[Config::get('id.key')])
@@ -306,6 +314,10 @@ public function update(array $userData): bool
306314
$userData['updated_at'] = (new Date())->tick()->format(Config::get('timestamps.format'));
307315
}
308316

317+
if (isset($userData['email'])) {
318+
$userData['email'] = strtolower($userData['email']);
319+
}
320+
309321
if (count(Config::get('unique')) > 0) {
310322
foreach (Config::get('unique') as $unique) {
311323
if (!isset($userData[$unique])) {
@@ -482,6 +494,10 @@ public function createUserFor($userData)
482494
$userData['updated_at'] = $now;
483495
}
484496

497+
if (isset($userData['email'])) {
498+
$userData['email'] = strtolower($userData['email']);
499+
}
500+
485501
if (isset($credentials[Config::get('id.key')])) {
486502
$userData[Config::get('id.key')] = is_callable($userData[Config::get('id.key')])
487503
? call_user_func($userData[Config::get('id.key')])

0 commit comments

Comments
 (0)