Friday, January 14, 2022

[FIXED] CakePHP query record does not show password

Issue

I have a simple model (User) which contains of the attributes id, username and password.

If I query for records with $this->User->find()->all()->toArray(), the output shows the attributes id and username. Password is not displayed.

No matter if the password is a hash or not, somehow it must be possible to retrieve it only for processing reasons.

Anyone has experienced this issue before?


Solution

not sure if its a good thing to want to display a password(hashed of not)

but outputting a user should show it to you.

You can check if there are any hidden properties set with $entity->hiddenProperties()

You can pass Either an array of properties to hide or null to get the hidden properties.



Answered By - Alex Stallen

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.