Jump to content

API - Reset client password


project183

Recommended Posts

Hello,

 

On the documentation for the WHMCS API - http://docs.whmcs.com/API:Send_Email it states:

 

The following email templates cannot be sent in this way:

 

Automated Password Reset

Password Reset Confirmation

Password Reset Validation

...

 

However i am able to perform these actions, below is a code snippet:

 

    public function resetAction()
   { 
       $request = $this->getRequest();
       if ( $request->isPost() )
       {
            $params['action'] = 'getclientsdetails';
            $params['email']  = $request->getPost( 'email' );
            $reset = $this->backend->apiCall( $params );
            if ( $reset->result == 'success' ) 
            {
                 $params['action']        = 'sendemail';
                 $params['messagename']   = 'Password Reset Validation';
                 $params['id']            = $reset->userid;
                 $params['customvars']    = base64_encode(serialize([
                     'pw_reset_url'       => 'http://domain.tld/page/args...'
                 ]));
                 $this->backend->apiCall( $params );
            }
            $this->getView()->assign( 'done', 1 );
       }
   }

 

This piece of code simply sends a email to WHMCS via the api, upon success we get the users client id to pass to the

send e-mail command.

 

This works well and using the templates i am able to build a password recovery system using the api but what im wondering is if i am missing something because the documentation is stating that these templates cannot be used.

 

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated