cesargb / laravel-magiclink

Create link for authenticate in Laravel without password or get private content
MIT License
385 stars 44 forks source link

Feature request: Ask for access code before download start #38

Closed rabol closed 3 years ago

rabol commented 3 years ago

Hi

Would be cool to be able to create a download link that require the visitor to enter access code before the download start

cesargb commented 3 years ago

Hi @rabol,

It would be a great idea for this component. If you want to collaborate with the project, feel free to send a pull request.

Thanks

rabol commented 3 years ago

I got it working by: Adding a new field to the MagicLink - access_code Then I disabled the standard route in the config copied the original route definition The I added a middleware

Now... I only have one problem and that is that after download it does not redirect to th path in the config file

if you like this approach I can try to put a PR together

cesargb commented 3 years ago

By thinking about it, I was also planting an approach like yours. Generate a middleware to request the code and then allow the action. In your approach, perhaps, you would add a new path to request the previous code. The action is only allowed if no code has been specified or you have the correct code session. In any case, send the PR and we will see together if it would be enough or we propose a change.

rabol commented 3 years ago

PR created, let me know if it looks okay for you