authenticate

Warning! If you are using the authenticate tag in combination with caching, make sure to wrap the authenticate tag inside dynamic tags, or else the redirection to the login page will not work and the page contents will be visible in the cached version.

The authenticate tag is a vital part of the authentication functionality in Plate. When used, the page where it is used will only be accessible by visitors who are logged in as one of the specified authentication types. When a visitor who is not logged in tries to visit this page, he will be redirected to the login page for the specified authentication type.

The authenticate tag takes one or more (unnamed) strings as input. The input strings are the plural names of the authentication types that are allowed to visit this page. 

Example:

Given that an authentication types with plural name "dealers" and "board_members" is present; when we do:

{% authenticate "dealers" %}

This will allow only visitors who are logged in as a dealer to visit this page. 

When we do:

{% authenticate "dealers", "board_members" %}

This will allow visitors who are logged in as a dealer or board_member to visit this page.

Note: The authenticate tag only checks if there is at least one authentication type logged in. If you want to authenticate on multiple authentication types, you should use multiple authenticate tags, one for each authentication type:

{% authenticate "dealers" %} {% authenticate "board_members" %}

This will allow only visitors who are logged in as dealer and board_member to visit page.