authentication

The authentication object allows access to the authentication types and to the current authenticated (logged in) account for each authentication type. 

Authentication Objects

Get all authentication objects for a authentication type.

{{ authentication.dealers }}

Returns all authentication objects for the authentication type 'dealers'.

Authentication types

Every authentication type can be accessed as follows (given that there is an authentication type with the plural name "dealers":

{{ authentication.authentication_types.dealers }}

Then for every authentication type, the following attributes can be retrieved:

  • "login_path"

  • "logout_path"

  • "edit_path"

  • "new_path"

  • "request_password_recovery_path"

  • "password_recovery_path”

Each of this attributes return a path to a specific authentication template(except for logout_path, which is can be used to logout the user using a DELETE request to it. This is simplified using the )

Example:

input:

<a href="{{authentication.authentication_types.dealers.login_path}}">Login</a>

output:

Current authenticated resources

For each authentication type it is also possible to get the current authenticated resource (account). This can be done by calling 'current_[authentication_type_name]' on the authentication object. The returned authentication object has the following attributes:

  • "email"

  • "Authentication_Type"

Next to these attributes, all content fields of the authentication are callable. E.g. when the authentication type of an authentication resource has a content field with the name "first_name", you can call the attribute "first_name" on the current authenticated resource. 

When the visitor is not authenticated as the specified authentication type, the 'current_[authentication_type_name]' attribute will return null.

Example:

Given that there is an authentication type with the name "dealer", having a content field "first_name", and the visitor is logged in as an authentication resource with email="john@getplate.com" and first_name="John":

input:

output: