public function changePassword()
    {
        $user = $this->Users->get($this->Auth->user('id'));

        if ($this->request->is(['patch', 'post', 'put'])) {
            $user = $this->Users->patchEntity($user, $this->request->getData());

            if ($this->Users->save($user)) {
                //Sends email
                $this->getMailer('MeCms.User')->send('changePassword', [$user]);
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['_name' => 'dashboard']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('user'));
    }
public function changePassword()
    {
        $user = $this->Users->get($this->Auth->user('id'));

        if ($this->request->is(['patch', 'post', 'put'])) {
            $user = $this->Users->patchEntity($user, $this->request->getData());

            if ($this->Users->save($user)) {
                //Sends email
                $this->getMailer('MeCms.User')->send('changePassword', [$user]);
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['_name' => 'dashboard']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('user'));
    }
public function changePassword ( ) { $ user = $ this -> Users -> get ( $ this -> Auth -> user ( 'id' ) ) ; if ( $ this -> request -> is ( [ 'patch' , 'post' , 'put' ] ) ) { $ user = $ this -> Users -> patchEntity ( $ user , $ this -> request -> getData ( ) ) ; if ( $ this -> Users -> save ( $ user ) ) { //Sends email $ this -> getMailer ( 'MeCms.User' ) -> send ( 'changePassword' , [ $ user ] ) ; $ this -> Flash -> success ( I18N_OPERATION_OK ) ; return $ this -> redirect ( [ '_name' => 'dashboard' ] ) ; } $ this -> Flash -> error ( I18N_OPERATION_NOT_OK ) ; } $ this -> set ( compact ( 'user' ) ) ; }
Changes the user's password
@return \Cake\Network\Response|null|void
@uses MeCms\Mailer\UserMailer::changePassword()
Changes the user s password