Reset Password

You can reset the password of a registered user’s account using the following code snippet. While calling the reset_password() method, a reset password link will be generated and sent to the user’s email address. The authentication_service reference used in the below code snippet is the component instance created earlier.

  • The email_id, platform_type, and zaid are 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 Dictionary

You will need to create a dictionary that contains the registration details of a particular user as given below. You can then pass the configured dictionary to the method that handles the password reset process.

#Create a dictionary signup_config = { 'platform_type' : 'web', 'zaid' : '1008807534', '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>' } } userConfig = { 'first_name': 'Amelia', 'last_name': 'Burrows', 'email_id': '' }

Reset the Password

The objects that contains the user information and user signup configuration are passed as arguments to the reset_password() method which returns a response.

The authentication_service reference used below is already defined in the component instance page.

#Reset user password response_data = authentication_service.reset_password(signup_config, user_details)

A sample response is shown below :

"Reset link sent to Please check your email".

Last Updated 2023-12-18 16:20:08 +0530 +0530