<p>I think it is possible, just follow this guide: <a href="https://noahread.net/blog/create-password-protected-pages-in-craft" rel="nofollow noreferrer">https://noahread.net/blog/create-password-protected-pages-in-craft</a></p>

<p>After submission you get back an <code>entry</code> variable containing every information about the recently posted entry (the variable name can be changed in Guest Entries settings), so you can display the user her/his password after submission. </p>

<p>I use a little different approach: </p>

<p>I generate the password JS into a hidden field on the entry submission form, like this: </p>

<pre><code>&lt;input type="hidden" name="fields[quote_password]" id="quote_nonce" value=""&gt;
&lt;script type="text/javascript"&gt;
    var qp = Math.random().toString(36).substring(10),
        nonce_holder = document.querySelector('#quote_nonce');
    nonce_holder.setAttribute("value", qp);
&lt;/script&gt;
</code></pre>

<p>Then on entry page I check if the user has set a correct password OR the user has a cookie with the password (if the user posts a correct password it is stored on the device for 2 days in a cookie) OR the user is an admin: </p>

<pre><code>{% if currentUser %}
    {% set isAdmin = currentUser.IsInGroup('admin') %}
{% else %}
    {% set isAdmin = false %}
{% endif %}

{% if craft.app.request.getParam('password') == entry.quote_password or getSecureCookie( 'quote_password' ) == entry.quote_password or isAdmin %}

    {% if craft.app.request.getParam('password') == entry.quote_password %}
        {% if entry.expiryDate.timestamp is defined %}
            {% set expiryDate = entry.expiryDate.timestamp %}
        {% else %}
            {% set expiryDate = now | date_modify("+2 days").timestamp %}
        {% endif %}

        {% do craft.cookies.setSecure('quote_password', craft.app.request.getParam('password'), expiryDate ) %}
    {% endif %}

    ... Entry content ...
{% endif %}
</code></pre>

CC BY-SA 4.0
2018-10-12T08:03:02.343Z
2018-10-12T08:03:02.343Z
Ottó Radics
<p>I know this is not exactly what's being asked for by @Billy, but for those who came here googling something like "password protection Craft CMS 3" and who do want to use Craft's user authentication system, I recommend using the <a href="https://docs.craftcms.com/v3/dev/tags/requirelogin.html" rel="nofollow noreferrer"><code>{% requireLogin %}</code> tag</a> in your Twig templates.</p>

CC BY-SA 4.0
2019-10-16T13:56:10.380Z
2019-10-16T13:56:10.380Z
Arvid
<p>I don't think this is possible with Craft out the box, and would require a module / plugin to add this functionality.</p>

<p>Firstly to write the password to the database and encrypt it, so it's not stored in plain text.</p>

<p>Then it would just be a case of having a controller (<a href="https://docs.craftcms.com/v3/extend/coding-guidelines.html#controllers" rel="nofollow noreferrer">https://docs.craftcms.com/v3/extend/coding-guidelines.html#controllers</a>) that checks this password from a form submission and unlocks the ability to edit the entry again.</p>

CC BY-SA 4.0
2018-10-12T07:46:48.200Z
2018-10-12T07:46:48.200Z
Jason Mayo
<p>I have used the Guest Entries to create a plugin where anonymous users can create a entry. I have a password field on each entry. Now I want the guests who have created the entry to be able to login with this password and edit the entry they created. I don't need user validation etc for this, just a single password. Is this possible in Craft 3?</p>

<craft3><plugins><users>
Craft 3 protecting a page with a password?
# Craft 3 protecting a page with a password?

(Asked by: username_0 on 2018-10-12)

I have used the Guest Entries to create a plugin where anonymous users can create a entry. I have a password field on each entry. Now I want the guests who have created the entry to be able to login with this password and edit the entry they created. I don't need user validation etc for this, just a single password. Is this possible in Craft 3?

**Tags:** craft3, plugins, users

---

## 3 answers

### Answer by username_1 on 2018-10-12. Score: 1 | Accepted answer

I think it is possible, just follow this guide: https://noahread.net/blog/create-password-protected-pages-in-craft
After submission you get back an entry variable containing every information about the recently posted entry (the variable name can be changed in Guest Entries settings), so you can display the user her/his password after submission. 
I use a little different approach: 
I generate the password JS into a hidden field on the entry submission form, like this: 



Then on entry page I check if the user has set a correct password OR the user has a cookie with the password (if the user posts a correct password it is stored on the device for 2 days in a cookie) OR the user is an admin: 
{% if currentUser %}
    {% set isAdmin = currentUser.IsInGroup('admin') %}
{% else %}
    {% set isAdmin = false %}
{% endif %}

{% if craft.app.request.getParam('password') == entry.quote_password or getSecureCookie( 'quote_password' ) == entry.quote_password or isAdmin %}

    {% if craft.app.request.getParam('password') == entry.quote_password %}
        {% if entry.expiryDate.timestamp is defined %}
            {% set expiryDate = entry.expiryDate.timestamp %}
        {% else %}
            {% set expiryDate = now | date_modify("+2 days").timestamp %}
        {% endif %}

        {% do craft.cookies.setSecure('quote_password', craft.app.request.getParam('password'), expiryDate ) %}
    {% endif %}

    ... Entry content ...
{% endif %}


---

### Answer by username_2 on 2019-10-16. Score: 1

I know this is not exactly what's being asked for by @Billy, but for those who came here googling something like "password protection Craft CMS 3" and who do want to use Craft's user authentication system, I recommend using the [`{% requireLogin %}` tag](https://docs.craftcms.com/v3/dev/tags/requirelogin.html) in your Twig templates.


---

### Answer by username_3 on 2018-10-12. Score: 1

I don't think this is possible with Craft out the box, and would require a module / plugin to add this functionality.

Firstly to write the password to the database and encrypt it, so it's not stored in plain text.

Then it would just be a case of having a controller (<https://docs.craftcms.com/v3/extend/coding-guidelines.html#controllers>) that checks this password from a form submission and unlocks the ability to edit the entry again.


---

