Valid Fields Config Not Working
Elvis254 opened this issue · comments
PHP Version
8.2.0
CodeIgniter4 Version
4.4.5
Shield Version
1.0.1
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MariaDB 10.2
Did you customize Shield?
I customized the UserModel
class to include a function to generate a full name of a user from their first and last name before insert and before update. I also customized the User
entity class to include two functions to set the first and last name of a user after cleaning the string input and performing formatting on it like capitalization.
What happened?
When using this config public array $validFields = ['email', 'username'];
and this html input field in my hand written login view <input type="text" name="username" class="form-control" placeholder="<?= lang('Auth.username') ?>" autocomplete="off" required />
the credentials fail to validate and give out an error that the email address field is required even though I have also specified username as part of the valid fields. But when I change the html input field to this <input type="email" name="email" class="form-control" placeholder="<?= lang('Auth.username') ?>" autocomplete="off" required />
the credentials are validated successfully.
Steps to Reproduce
Take a look on this config public array $validFields = ['email', 'username'];
whether it works because it works for email only. When I specify 'username'
only in the array it also doesn't work.
Expected Output
When the valid fields are specified in the array the one giving a match to the one used on the login form should be used when validating the credentials.
Anything else?
No response