Reset Password

After the successful registration of a user, you can reset the password using the following code snippet. While calling the resetPassword() method, a reset password link will be generated and sent to the user’s Email address. The userManagement reference used in the below code snippet is the component instance.

  • EmailID and Platform type are the mandatory attributes.

  • You can configure the sender’s email address, subject and the email message. You must add the email address in the Catalyst Mail Component and get it verified before using it in the SDK code.

Create a Configuration JSON

JSON objects containing the registration details of a particular user is created as given below,

//Create Config Object for the user const signupConfig = { platform_type: 'web', zaid: 10014774358, template_details: { 'senders_mail':'', 'subject':'Welcome to %APP_NAME% ', 'message':'<p>Hello ,</p> <p>Follow this link to join in %APP_NAME% .</p> <p><a href=\'%LINK%\'>%LINK%</a></p> <p>If you didn’t ask to join the application, you can ignore this email.</p> <p>Thanks,</p> <p>Your %APP_NAME% team</p>' } }; var userConfig = { first_name: 'A', last_name: 'B', email_id: '' };

Reset the Password

These objects are passed as arguments to the registerUser() method which returns a promise.

The promise returned will be resolved to an object which is a JSON.

//Pass the configuration to reset the password which in turn returns a promise let userManagement = app.userManagement(); let resetPromise = userManagement.resetPassword(signupConfig, userConfig); resetPromise.then(response => { console.log(response); });

Last Updated 2023-10-16 12:55:33 +0530 +0530