PHP Version
8.1.0
CodeIgniter4 Version
4.2.6
Shield Version
dev-develop
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
MySQL 8.0.27
Did you customize Shield?
No
What happened?
I develop API for registration. To secure an API, I implement tokens on before-filters. When calling registration API, I sent my developer tokens in the Authorization header.
But when I post password contains personal information, it can be passed. strong_password valdiation is not working.
Steps to Reproduce
- make simple API for registration
- implements tokens on before-filter to secure the API routes
- Set the token in the Authorization header
- post any password contains personal information
Expected Output
Api should return error that "Passwords cannot contain re-hashed personal information."
Anything else?
I am new in this library, so this report could be false, maybe I do wrong setup or implementation of this library. But for now, I am thinking, the cause could be this line:
if (function_exists('auth') && auth()->user()) {
$user = auth()->user();
}
when I change those line to:
if (function_exists('auth') && auth('session')->user()) {
$user = auth('session')->user();
}
then strong_password validation is working as expected.