authentication_logout_form

The authentication_logout_form tag renders a form that allows the visitor to logout as a certain Authentication Type.

The authentication_logout_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_logout_form tag requires that no authentication_field tag is called inside of it.

Accepts parameter redirect_to, with a path that the user is redirected to after successful logout.

Example:

{% authentication_logout_form "dealers", redirect_to: "/my-page" %}     <input type="submit" value="Logout!"> {% endauthentication_logout_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 logout through a JSON request:

DELETE /:authentication_type_name/logout Accept: application/json { "authentication_object": { ... # JSON output from tag } }