Skip to content

Commit b18e7ea

Browse files
committed
fix: cannot register when you remove email from $validFields
CodeIgniter\Shield\Exceptions\LogicException : "$user->id" is null. You should not use the incomplete User object.
1 parent d629cd4 commit b18e7ea

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/Authentication/Passwords/ValidationRules.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,9 @@ protected function buildUserFromData(array $data = []): User
102102
*/
103103
protected function prepareValidFields(): array
104104
{
105-
$config = config('Auth');
106-
$fields = array_merge($config->validFields, $config->personalFields);
107-
$fields[] = 'password';
105+
$config = config('Auth');
106+
$fields = array_merge($config->validFields, $config->personalFields, ['email', 'password']);
108107

109-
return $fields;
108+
return array_unique($fields);
110109
}
111110
}

0 commit comments

Comments
 (0)