users icon indicating copy to clipboard operation
users copied to clipboard

Password saved in plaintext after overriding the controler

Open biracsoftware opened this issue 1 year ago • 2 comments

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'));
    }

biracsoftware avatar Jan 31 '24 10:01 biracsoftware

@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

rochamarcelo avatar Feb 01 '24 14:02 rochamarcelo

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

ajibarra avatar Jun 28 '24 05:06 ajibarra