colibri-software / identity_plugin

Identity plugin for Locomotive CMS.
MIT License
2 stars 3 forks source link

h1. Identity Plugin

This is a plugin for LocomotiveCMS. It was created to allow LocomotiveCMS designers to create Sign In/Sign Up accounts on their website.

It provides several features that allow it to be used on its own to restrict access to website locations. It can also be used with other plugins to provide one login for the website.

h2. Installation

To use this plugin you must be using a version of LocomotiveCMS that has the plugins feature designed by "Colibri Software":https://www.colibri-software.com. You can do this by making the following changes to the Gemfile in your app:

Then add the following lines in your Gemfile to include the plugin:

group :locomotive_plugins do
  gem 'identity_plugin', git: 'https://github.com/colibri-software/identity_plugin.git'
end

h2. Usage

h3. Configuring Plugin

This plugin provides many configuration options which are as follows:

The plugin config also has a link at the bottom that will allow CMS users to manage the website users.

h3. Liquid Drops

This plugin provides a liquid drop to access various attributes of the user and their state.

The main plugin drop is access like this: @{{ plugins.identity_plugin }}@

It has the following attributes:

The drop also has some dynamic attributes. For each role you define you can access the following attribute: @{{plugins.identity_plugin.hasrole}}@

For example if you created the role admin you could write the following: @{{plugins.identity_plugin.has_role_admin}}@

For this reason it is best to use roles that do not have spaces. You will not be able to use this method if your role has spaces.

h3. Liquid Tags

This plugin provides several tags that will generate the login/logout forms for you. They were designed to be used with foundation 24 column and have some options for configuration. If you require more configuration options or do not use foundation you can generate the form manually.

The following is a list of tags and their options(and defaults):

Here is an example of the login tag: @{% identity_plugin_login email_width: '10', password_width: '10', submit_width: '3' %}@

Here is an example of the profile form tag:

{% identity_plugin_profile_form for current_user name_width: '10', email_width: '10', password_width: '10', password_confirm_width: '10', submit_width: '3' %}
  
{% endidentity_plugin_profile_form %}

h3. Liquid Filters

The plugin also provides one liquid filter to help with determing roles you can use it as follows

@{{ "admin" | identity_plugin_has_role }}@

This will print true or false depending on whether the current user has the admin role. This will also allow you to use roles with spaces if you wish:

@{{ "admin user" | identity_plugin_has_role }}@

h3. JS3

The plugin provides the following variables to the JS3 context:

The plugin provides no methods for JS3.