Skip to content

Instantly share code, notes, and snippets.

@nqthqn
Created February 14, 2020 17:51
Show Gist options
  • Save nqthqn/3fb66c83b2ba75a210c20218225cbd3e to your computer and use it in GitHub Desktop.
Save nqthqn/3fb66c83b2ba75a210c20218225cbd3e to your computer and use it in GitHub Desktop.
0. index of available content
1. user request access to some content
a. form submission with email, hidden content_key
2. check redis - email registered already?
3. generate hash + content_key entry
4. email user link example.com/secret/:hash
5. user clicks link
6. remove hash + content_key entry
7. deliver bytes corresponding to content_key (look in hugo /public)
8. if user refreshes the /secret:hash page and no entry is found, redirect to index
important: hugo static files stay server side, never on CDN.
services needed:
- lambda
- redis
- email sender
@HughP
Copy link

HughP commented Feb 14, 2020

I deployed a wordpress plugin that did something like this once.... it added a nonce to a URL which would expire, and then it emailed the link to a registered user... and then it blocked access to that content except through that nonce. so essentially doing this

@nqthqn
Copy link
Author

nqthqn commented Feb 14, 2020

fascinating! i'd love to hear more... which plugin? nonce is the word i am looking for - a 1 time use

@HughP
Copy link

HughP commented Feb 14, 2020

I'm not sure if this is the exact plugin but it was something like this one... I've stopped following the wordpress world since I started with Hugo... https://wordpress.org/plugins/public-post-preview/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment