Access Resource with a PIN
Any suggestions on how to proceed when a Resource is accessed, requesting a Modal or Page requesting a PIN (from users) as a way to access the resource?
8 Replies
I would try to use a middleware, probably setup a cookie too on pin successful so it doesn't ask for it every page reload or switch
As Aivirth suggested: You can use a
$routeMiddleware
on the page, redirecting to a PIN page and redirecting back on success. A modal on the page would be too late.
You could modify the EditAction
/ViewAction
to add this modal, if the target page is marked as "protected" but that's a bit more complex@! Skull™👻 I recently shot a video answering a similar question on Discord but with paywall instead of PIN, but the logic could be the same: https://www.youtube.com/watch?v=Yr_m7ku3024
Filament Daily
YouTube
Filament Menu "Paywall": Show Items but Restrict Access
A new project on Filament Examples, showing how to use Middleware to restrict items.
- Source Code: https://filamentexamples.com/project/filament-menu-paywall-show-restrict-access?mtm_campaign=youtube-menu-paywall
- Discord original question: https://discord.com/channels/883083792112300104/1416346123488202762
here's the original question

Thanks for the help, it's working now

With a config routes

If it's just a modal, users could remove it via DevTools.
Yes, I thought about that too. But I inserted hidden fields with a function that checks the cookie. Even recalling the modal via inspect element will have the second layer of verification directly in the resources.
In the short term, this is sufficient, but in the long term, with more and more future features, this could become too cluttered.