CakeDC / users

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

Password saved in plaintext after overriding the controler #1064

Closed biracsoftware closed 3 months ago

biracsoftware commented 10 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 10 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 5 months ago

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