marcospereirampj / python-keycloak

MIT License
722 stars 301 forks source link

Send password reset mail #252

Open althaf004 opened 2 years ago

althaf004 commented 2 years ago

For resetting password there is provision for

response = keycloak_admin.send_update_account(user_id="user-id-keycloak", 
                                              payload=json.dumps(['UPDATE_PASSWORD']))

which is similar to execute action.

but instead of this, is there an api to send password reset email

samug0 commented 4 months ago

Hi..your solution is correct, but is syntactically wrong..... you can avoid to dump the payload:

SOLUTION HERE:

        if keycloak_user and req.password == req.confirmPassword:

            userId : UUID = keycloak_user[0]["id"]

            await self.keycloak_admin.a_send_update_account(user_id=userId, payload=['UPDATE_PASSWORD'])

            return self.success_response(True)