New version is Private Site
Private
is a Grav Plugin.
Private provides an authentication form to keep your entire Grav site or part of it private from the general public.
Installing the Private plugin can be done in one of two ways. The GPM (Grav Package Manager) installation method enables you to quickly and easily install the plugin with a simple terminal command, while the manual method allows you to do so by downloading a zip file to place in the Grav plugins directory.
The simplest way to install this plugin is via the Grav Package Manager (GPM) through your system's Terminal (also called the command line). From the root of your Grav install type:
bin/gpm install private
This will install the Private plugin into your /user/plugins
directory within Grav. Its files can be found under /your/site/grav/user/plugins/private
.
To install this plugin, just download the zip version of this repository and unzip it under /your/site/grav/user/plugins
. Then, rename the folder to private
. You can find these files either on GitHub or via GetGrav.org.
You should now have all the plugin files under
/your/site/grav/user/plugins/private
By default, the password is password
, username is not needed and Grav is fully private.
To customize this parameters (and more), you first need to create an override config. To do so, create the folder user/config/plugins
(if it doesn't exist already) and copy the private.yaml config file in there and then make your edits.
- Change the default password in your
user/config/plugins/private.yaml
- Change the default security salt in your
user/config/plugins/private.yaml
- Customize your privacy rules
Enable or Disable the entire plugin (default: true
).
enabled: (true|false)
Routes of login and logout. You can customize it by replacing value (e.g: login: "/admin" for "mywebsite.com/admin" )
routes:
login: "/login"
logout: "/logout"
Security Salt for session. IT MUST BE AN ALPHANUMERIC CHAR You can go to this generator for your own. (or similar SHA-1 Generator )
session_ss: random_value
If true
, the entire site is private. If false, then Private can be enabled on a page by page basis by using the private_tag
( See after ) (default: true
)
private_site: (true|false)
If the private_site value is false
, you will need to add the private_tag
on your private page. (default: hidden
)
See Grav Taxonomy for more information.
private_tag: hidden
Enable (true
) or Disable (false
) the username field on the private page's login form. (default: false
)
Note : If you disable the username, you need to keep
no_user
username in theusers
parameters. enable_username: (true|false)
List of users. For adding user, just create a new line keeping the identation. (default password: password
)
Note : If enable_username is
false
, you must not delete theno_user
user in the list.
Note : The password MUST BE a SHA1 value. For quick checking see SHA1 Online to generate your SHA1 password. But it is adwised to generate it locally as http and any transmission is not as secure as no transmission at all. Use command:
echo -n "yourpassword" | sha1sum
. You can remove it thereafter from bash history withhistory -d 1234
and sourcing the ~/bashrc.
users:
no_user : sha1_password
This section allows you to change the text which will appear on the login form on Private enabled pages.
fields:
username:
label: "Username"
placeholder: "Enter your username"
As development for the Private plugin continues, new versions may become available that add additional features and functionality, improve compatibility with newer Grav releases, and generally provide a better user experience. Updating Private is easy, and can be done through Grav's GPM system, as well as manually.
The simplest way to update this plugin is via the Grav Package Manager (GPM). You can do this by navigating to the root directory of your Grav install using your system's Terminal (also called command line) and typing the following:
bin/gpm update private
This command will check your Grav install to see if your Private plugin is due for an update. If a newer release is found, you will be asked whether or not you wish to update. To continue, type y
and hit enter. The plugin will automatically update and clear Grav's cache.
Manually updating Private is pretty simple. Here is what you will need to do to get this done:
- Delete the
your/site/user/plugins/private
directory. - Download the new version of the Private plugin from either GitHub or GetGrav.org.
- Unzip the zip file in
your/site/user/plugins
and rename the resulting folder toprivate
. - Clear the Grav cache. The simplest way to do this is by going to the root Grav directory in terminal and typing
bin/grav clear-cache
.
Note: Any changes you have made to any of the files listed under this directory will also be removed and replaced by the new set. Any files located elsewhere (for example a YAML settings file placed in
user/config/plugins
) will remain intact.