Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Change password

$
0
0

Hi,

I can abale to register a new user in the openfire database through my client but unable to change the password , though I have enable the openfire admin setting that "User can change their password"..

 

Please help me

 

My code is

 

 

public function change_password($name, $oldPassword, $newPassword) {

 

        $this->server = '192.168.2.74';

        $id = 'exec_' . $this->getID();

       // $id = 'change' . $this->getID();

 

 

 

//

//        $out = "<iq type='set' to='{$this->server}' id='{$id}'/>";

//        $out .= "<query xmlns='jabber:iq:register'>";

//        $out .= "<username>{$name}</username>";

//        $out .= "<email>{$name}@wrctechnologies.com</email>";

//        $out .= "<password>{$newPassword}</password>";

//        $out .= "</query>";

//        $out .="</iq>";

//      //  @fwrite($this->socket, $out, strlen($out));

//         

//

//       return $this->send($out);

//      

//               $xml = "<iq type='set' to='{$this->server}' id='$id'>

//                         <command xmlns='http://jabber.org/protocol/commands'

//                                  node='http://jabber.org/protocol/admin#change-user-password'>

//                           <x xmlns='jabber:x:data' type='submit'>

//                             <field var='accountjid'>

//                               <value>$name@{$this->server}</value>

//                             </field>

//                             <field var='password'>

//                               <value>$newPassword</value>

//                             </field>

//                           </x>

//                         </command>

//                       </iq>";

 

 

 

        $out = "<iq type='set' to='{$this->server}' id='$id'>";

        $out .= "<query xmlns='jabber:iq:auth'>";

        $out .= "<x xmlns='jabber:x:data' type='submit'>";

        $out .= "<field var='username'>";

        $out .= "<value>$name</value>";

        $out .= "</field>";

        $out .= "<field var='password'>";

        $out .= "<value>$newPassword</value>";

        $out .= "</field>";

//        $out .= "<field var='name'>";

//        $out .= "<value>new_user</value>";

//        $out .= "</field>";

//        $out .= "<field var='email'>";

//        $out .= "<value>new_user@wrctechnologies.com</value>";

//        $out .= "</field>";

        $out .= "</x>";

        $out .= "</query>";

        $out .= "</iq>";

 

     

        $this->send($out);

         // $this->addIdHandler($id, 'change_password_handler');

    }

 

    protected function change_password_handler($xml) {

       

        switch ($xml->attrs['type']) {

            case 'error':

                $this->event('password_changed', 'error');

                break;

            case 'result':

                $this->event('password_changed', 'result');

                break;

            default:

                $this->event('pasword_changed', 'default');

        }

    }


Viewing all articles
Browse latest Browse all 10742

Trending Articles