Ruby on Rails Friday, September 28, 2012

I would like to send a link to a user (via email) that expires after a period of time.

When a user takes a certain action, they are emailed a link that allows them access to a certain resource.
What I want to do is make it so that the link will work for a period of time (say 48 hours) and then will
no longer work. I would like the link to look like:

http://www.mysite.com/stuff/b39a8b314588d04e23f15ceb026196c5
or
http://www.mysite.com/stuff/resourcea?b39a8b314588d04e23f15ceb026196c5

Rails would need to decrypt the url (it doesn't need to be cryptographically secure, but it
should be non obvious), determine if the timeframe is still valid and serve the resource (or not).

I would rather that the timeframe be included in the link instead of having to do a db lookup.

Are there any gems/plug-ins out there for this? How would I go about creating it from scratch?

Matt


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment