Is giving me the error of " in_array() expects parameter 2 to be array, bool given", the reason is that the function class_implements() is giving me an error with the class passed as argument and is returning false instead of an array.
It happens with the two-factor authentication, when is trying to see if that class implements an interface, but the class_implements() function doesn’t find the class passed as argument, is there a way to disable two-factor authentication?
A full stacktrace of your error would be usefull for us to provide you better help because the error in_array() expects parameter 2 to be array, bool given
can’t be associated with a specific problem.
Can you explain
- what you already did?
- what versions you are using?
- what did you change so its not working anymore (if it worked before)?
I installed cakedc users in my site, it gives me the error when I try to login with superuser, I am using cakedc users 9.
This is the screenshot of the error in the site:
if you copied the users.php
from the the repository to your config/users.php
then make sure you are on the correct version of that file.
Especially that line is needed because this is was causing your error.
I added the Webauthn2fa in cakedc/users/config/users.php, but now is trying to enter the site from the Authentication plugin, not the cakedc users, and is giving me an exception of “Call to a member function getResult() on null”.
What do I have to change so that it logins with cakedc users and not Authentication plugin?
This is the screenshot:
You definitely should not edit any files present in vendor
so if it wasn’t present in there you are not on CakeDC/Users version 9.3
Make sure you are on the latest version via composer update -W
Your error above means that the Authentication Component hasn’t been loaded.
Did you add
public function initialize(): void {
$this->loadComponent('CakeDC/Users.Setup');
}
in your src/Controller/AppController.php
?
Thank you now is working.
How can I get the getresult()->isvalid() with cakedc users?
Since you now have access to the AuthenticationComponent inside your controllers just use
$this->Authentication->getResult()->isValid();
Yes, thank you, now is working