The reason why I’m here is one of my clients asked me to fix his CakePhp script. Unfortunately I don’t have any experience of work with this framework, it’s my first time.
Client have a site - where cakephp is istalled in admin/ folder. When I’m trying to open this url … domain.com/admin/users/login - i see login form and error mentioned above. Unfortunately all user accounts provided by client - doesn’t work. When I try to Reset Password - I got another errorDeprecated (16384): Validation::notEmpty() is deprecated. Use Validation::notBlank() instead. [CORE/Cake/Utility/Validation.php, line 60] Warning (2): rand() expects parameter 2 to be integer, float given [APP/Model/User.php, line 156]
according to config file 0.2.9 version is installed on PHP Version 7.2.7-1+0 server.
It could be cakephp 2.9.0…
If it is so:
In the user model file app/Model/User.php check for validation rules and change notEmpty rule to notBlank.
For ‘action’ deprecated problem find find app/view/Users/login.ctp and find $this->Form->create(…)
and change ‘action’ to array(‘url’=>array(‘controller’=>‘users’,‘action’=>‘whatever action name was in it before’))
If cakephp base version is 3, then the files you need to change are in app/src, but there is a completly different story.
check http://book.cakephp.org for more info (don’t forget to change the book version to your cakephp version, I guess to 2.x). You could find infos about deprecated things also.
Unfortunately I can’t login, using the Login pass that I have - I got another error -
[ Deprecated (16384)](javascript:void(0);): Validation::notEmpty() is deprecated. Use Validation::notBlank() instead. [ CORE/Cake/Utility/Validation.php , line 60 ]
How can I change password from database?
used MD5 and other various algorithms with no luck
Your Cakephp version is 2.10.15
I guess your app is using the cakephp auth component, so it uses sha algorithm with a ‘salt’ so insert password through e.g. phpmyadmin is not possible.
Make an action in users controller like this:
public function resetadminpw() {
$user = $this->User->find('first', array('conditions' => array('User.' . $this->User->primaryKey => 1)));
$user['User']['password'] = 'abc123';
$this->User->save($user);
$this->redirect(array('action'=>'login'));
}
In order to use it you need to allow the resetadminpw action in your app without login. If the Auth component has been set to use controller authentication then you could allow it in the controller’s beforeFilter method:
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('login','logout','resetadminpw');
}
Then you only have to call http://yourappurl/users/resetadminpw and login after it with the username of the ID1 user (from users table) and abc123 as password
Thank Sipiatti, deprecated error is gone on load, but it returns when trying to log in. definitely has something to do with validating the login/password now.