Recover password

Table of contents

The authentication_recover_password_form tag renders a form that allows the visitor to set a new password, after a password recover is requested using the authentication_request_password_recovery_form. This form should only be used in the

The authentication_recover_password_form tag takes the plural name of an Authentication Type as input.

It is also possible to give extra arguments as a key, value pair. These arguments are transformed into html attributes on the generated form html tag.

The authentication_recover_password_form tag requires that the authentication_field tag is called inside of it for each of the inputs:

  • 'password'

  • 'confirm_password'

Accepts a parameter error_msg to use a custom message when recovering password does not work, for example when the passwords do not match. Message is returned in request.flash object.

Example:
{% authentication_recover_password_form "dealers", error_msg: "custom error message" %}
    {% authentication_field "password", class: "form-field" %}
    {% authentication_field "confirm_password", class: "form-field" %}
    <input type="submit" value="Update password!">
{% endauthentication_recover_password_form %}
Note: Do not forget to display the output of [request.flash], since that contains potential error messages.


JSON endpoint

Also accepts parameter output_as, which currently only accepts "json" as value. If this parameter is set, no html is returned, but everything needed for the payload in authentication endpoints is returned in JSON format. With this you can call the following endpoint in order to recover a password through a JSON request:

PUT /:authentication_type_name/recover_password
Accept: application/json

{
  "authentication_object": {
    "password": "newPa55word",
    "confirm_password": "newPa55word",
    ... # JSON output from tag
  }
} 

Need help?

Do you have any question which is not answered in this knowledge base? Contact us. We are here to help you.