Log message #4193738

# At Username Text
# Jul 17th 2019, 13:34 itmpls clearly something is off
# Jul 17th 2019, 13:34 itmpls directory, namespace, class name
# Jul 17th 2019, 13:33 scuadra @itmpls the filename is Member.php
# Jul 17th 2019, 13:33 itmpls @scuadra ?
# Jul 17th 2019, 13:32 itmpls what is the filename, and directory and class name and namespace?
# Jul 17th 2019, 13:32 itmpls where do . you have your Member class?
# Jul 17th 2019, 13:07 scuadra the Entity class not being used? :face_with_rolling_eyes:
# Jul 17th 2019, 13:07 scuadra maybe I'm missing something but where's the problem
# Jul 17th 2019, 13:05 admad we already found the problem. you need to find the solution :slightly_smiling_face:
# Jul 17th 2019, 13:04 scuadra thank you for your time
# Jul 17th 2019, 13:04 scuadra I still can't find the problem but anyway you were very patient
# Jul 17th 2019, 12:48 scuadra In my app.php I set the Security.salt to the one that was used in my Cake2 app
# Jul 17th 2019, 12:48 admad there's no caching involved in class loading (unless you have turned on opcode caching)
# Jul 17th 2019, 12:47 scuadra I also tried to clear the cache but still no result
# Jul 17th 2019, 12:47 scuadra yes, I tried debug($password); exit(); in the _setPassword() method but it wasn't triggered
# Jul 17th 2019, 12:46 admad So in spite of your claims you either havent named it properly or put in proper location
# Jul 17th 2019, 12:46 admad `object(Cake\ORM\Entity)` so your `Member` entity class isn't used.
# Jul 17th 2019, 12:45 scuadra the password field in the object is plain text
# Jul 17th 2019, 12:42 scuadra '[new]' => false, '[accessible]' => [ '*' => true ], '[dirty]' => [ 'password' => true ], '[original]' => [ 'password' => 'the original hash from db' ], '[virtual]' => [], '[hasErrors]' => false, '[errors]' => [], '[invalid]' => [], '[repository]' => 'Members'
# Jul 17th 2019, 12:42 scuadra The other keys are
# Jul 17th 2019, 12:42 scuadra It shows object(Cake\ORM\Entity) {} and all the fields of the table
# Jul 17th 2019, 12:37 admad what does `dd($user)` show after you set `$user->password`
# Jul 17th 2019, 12:36 scuadra I already checked it a couple of times and it is in the right place
# Jul 17th 2019, 12:33 admad make sure you have put the Member entity class in right place with proper class ame.
# Jul 17th 2019, 12:32 scuadra here it is
# Jul 17th 2019, 12:32 slackebot } return $this->redirect($this->Auth->redirectUrl()); } $this->Flash->error(__('Invalid username or password')); } }
# Jul 17th 2019, 12:32 slackebot !empty($this->getRequest()->getData())) { $user = $this->Auth->identify(); if ($user) { $this->Auth->setUser($user); if ($this->Auth->authenticationProvider()->needsPasswordRehash()) { $user = $this->Members->get($this->Auth->user('id')); $user->password = $this->getRequest()->getData('password'); $this->Members->save($user);
# Jul 17th 2019, 12:32 scuadra public function login() { if(empty($this->getRequest()->getParam('lang'))) { throw new NotFoundException(); } $lang = $this->getRequest()->getParam('lang'); if($this->Auth->user('id')) { return $this->redirect(['lang' => $lang, 'action' => 'index']); } $this->loadModel('Members'); if ($this->getRequest()->is('post') andand
# Jul 17th 2019, 12:29 admad show you actual login() action code
# Jul 17th 2019, 12:28 scuadra protected function _setPassword($password) { if (strlen($password) > 0) { return (new DefaultPasswordHasher)->hash($password); } }
# Jul 17th 2019, 12:27 admad it is
# Jul 17th 2019, 12:27 scuadra yes
# Jul 17th 2019, 12:27 scuadra maybe this is the problem
# Jul 17th 2019, 12:27 admad and have you added the `_setPassword()` method to your `Member` entity?
# Jul 17th 2019, 12:27 scuadra I did dd(get_class($this->Members)) because my table is named `members`
# Jul 17th 2019, 12:26 scuadra @admad it shows 'App\Model\Table\MembersTable'
# Jul 17th 2019, 12:24 admad @scuadra what does `dd(get_class($this->Users))` show?
# Jul 17th 2019, 12:22 ndm @scuadra The `$_accessible` property isn't involved if you're setting the property directly. If your entity has the hashing part implemented, then you might not be using that entity class. Check what exactly `$this->Users` is and what `$this->Users->get()` returns.
# Jul 17th 2019, 12:22 scuadra @admad I used exactly the same function in the link I provided
# Jul 17th 2019, 12:22 admad sorry, I see you linked the manual which shows how to update password
# Jul 17th 2019, 12:20 admad authcomponent (or it's classes) don't make any queries to update db, so don't see how simply logging in updated the password in db. It's your app code that's doing so.