rushy Posted March 10, 2022 Share Posted March 10, 2022 Hello. I've made an online photo gallery with albums and like to share some of the albums from time to time by providing a link that I email to selected people. I've made a page that acts as what I call an external viewer for this purpose. It takes a url with parameters to build a gallery from it. Now I'd like to be able to make this link time limited and what has come to mind is to generate a token and date/time that is stored as a field and may be compared to the link when someone attempts to view the shared link. If the token is valid then the date/time is checked to see if it's still current and access is allowed or not. Do you think this is a good way to handle this feature and is there anything in ProcessWire that can help me implement this that would help me? Many thanks for all your knowledge here! Paul Link to comment Share on other sites More sharing options...
AndZyk Posted March 10, 2022 Share Posted March 10, 2022 Hello @rushy, I have made something similar for a project: Users can select some media files from a media-center and share their collection via a link. For this I have a page where I first store their collection in the LocalStorage or in a cookie and the users then can share their link with a form that creates a new hidden page storing this selection in a Page Reference field. This page will be automatically deleted after a month. You can have a look here at this function here (you can add files with the cart symbol). If you want to I can share some of my code. If you want to share only one page then maybe you should store the shared links in a repeater and automatically delete the repeater items after some time. Regards, Andreas Link to comment Share on other sites More sharing options...
bernhard Posted March 10, 2022 Share Posted March 10, 2022 1 hour ago, rushy said: Do you think this is a good way to handle this feature and is there anything in ProcessWire that can help me implement this that would help me? Yep, RockToken can help here ? https://github.com/baumrock/RockToken 3 Link to comment Share on other sites More sharing options...
rushy Posted March 10, 2022 Author Share Posted March 10, 2022 3 hours ago, AndZyk said: Hello @rushy, I have made something similar for a project: Users can select some media files from a media-center and share their collection via a link. For this I have a page where I first store their collection in the LocalStorage or in a cookie and the users then can share their link with a form that creates a new hidden page storing this selection in a Page Reference field. This page will be automatically deleted after a month. You can have a look here at this function here (you can add files with the cart symbol). If you want to I can share some of my code. If you want to share only one page then maybe you should store the shared links in a repeater and automatically delete the repeater items after some time. Regards, Andreas Thank you Andreas. That is very slick and impressive! I hadn't thought of creating a hidden page for selections and time limiting the page. I think it could work for my images too. I'll have to explore Page References too as I never used them before. Paul 2 hours ago, bernhard said: Yep, RockToken can help here ? https://github.com/baumrock/RockToken Thanks for the heads up. I will take a look at this. Paul 1 Link to comment Share on other sites More sharing options...
Craig Posted March 10, 2022 Share Posted March 10, 2022 I use https://github.com/spatie/url-signer for something similar. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now