How to Protect specific page with only password?

Hi everyone,

I know that this question was already asked a few years ago but not having found the answers sought I allow myself to ask this question again.
I am trying to protect a single page with a password. I know admin plugin can do that but only with a link account no? :roll_eyes:

I’ve find this plugin private_plugins But I am not strong enough on grav to get the plugins activated only on the page I want. :pensive:

Thanks for reading me

Hi @frenchbeta

You can use the Login plugin. Here is the link to the doc

I haven’t tried myself but it seems pretty straightforward.

Here is the link to the plugin page

Tell me if you managed to create a private page.

Hi, @AlexMart thank you for your answer,

I know it can be with the login plugin but I don’t want to create a user account, just ask for a password to display a speficic page.
And it seems to me that the admin plugin asks for a username to display the desired page and not just a password no?

Hey,

So I’ve check the doc of the private_plugin and it’s not very clear how private page works but I figured out. I’ve check the closed issues and a lot of people had the same issue.

So after installing the private plugin copy/past the private.yaml to your user/config/plugins folder and open it. Then change the line private_site:true to private_site:false.

Then you can go on individual page and add this to the header :

---
title: Home //exemple
taxonomy:
  tag: hidden
---

If it’s not working try to logout first with the url yoursite.com/logout

Tell me if it woks for your.

1 Like

Oh thank you very much, I forgot the “taxonomy”: that’s why the plugins didn’t work before ! :slight_smile:

It’s really nice of you for helping me.

Just one last question, how can I change the password?

According to the doc you can change the password in the line

users:
    no_user : sha1_password

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 with history -d 1234 and sourcing the ~/bashrc.

OK,
Thanks again for your help, have a nice day ! :smiley: