CakeDC / users

Users Plugin for CakePHP
https://www.cakedc.com
Other
519 stars 294 forks source link

Password saved in plaintext after overriding the controler #1064

Open biracsoftware opened 5 months ago

biracsoftware commented 5 months ago

I have problems to apply password hashing when adding new users after overriding the controller to use custom roles.

Function from my controller

 public function add()
    {
        $myusers = $this->Myusers->newEmptyEntity();
        if ($this->request->is('post')) {
            $myusers = $this->Myusers->patchEntity($myusers, $this->request->getData());
            $myusers->role = $this->request->getData('role');
            if ($this->Myusers->save($myusers)) {
                $this->Flash->success(__('Success msg.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('Error msg.'));
        }
        $company = $this->Myusers->Company->find('list',['order'=>['Company.Name' => 'ASC']]);
        $roles = self::Roles;
        $this->set(compact('myusers','company', 'roles'));
    }
rochamarcelo commented 5 months ago

@biracsoftware I see that you have create a custom model Myusers please check if you extended your table and entity classes correct, see https://github.com/CakeDC/users/blob/11.next-cake4/Docs/Documentation/Extending-the-Plugin.md#extending-the-model-tableentity

ajibarra commented 2 weeks ago

@biracsoftware have you tried suggestions? Can we close the issue?