If anyone else tries to view this post, a redirect to a password check gets triggered
If password is correct, a cookie with age of 60sec is added (so basically if you have the correct password to a post you can view it one time / when opening again password protection gets triggered again. very easy to change the cookie age)
Authors never have to enter a password for their own posts
I implemented not only a password field but also a true/false field to activate/deactivate the password. going this way a user can temporarily disable the password without setting a new one when activating again
You can create different preview cards or change the styling accordingly to make sure you can see which posts are pw protected (in my example i added a simple lock-icon to the preview card and single page)
This is a very basic solution but using this as a starting point it’s very easy to create a more complex and robust pw protected solution. i used a regular text field for the pw which is not good practice, would be better to use real pw fields with encryption/decryption etc
The whole brudervertraumir-page is only a small project i created to help my cousin with a school project, so i didn’t put too much time and work into it.
They basically wanted a simple link-building site. for example they do lots of presentations and need to add source references for anything and instead of adding 20 links into the powerpoint they now only need to add one brudervertraumir-link which contains all links each with date and time they analyzed the source.
Of course this can be used for any kind of link building, would be also easy to adapt to bigger use cases like “my top secret travel destinations with private whatsapp contacts – buy now for $10” or something like that.