I’m trying to make a webapp that offers a subscription - based login system. Basically i want users to log in and then show a dashbord but with different functionalities based on their subscription level (i have a subscription field on each user that can be “free” or “pro”).
So i want pro users to have access to every section in the page and disable some of them to free users.
I found 2 workarounds, but i’m pretty sure that they aren’t good practices:
Hide section based on a conditional ('if current user isnt pro => hide/disable) but the thing with this solution is that the elements stay in the DOM and can be shown again changing it’s display attribute.
Creating a page for each section (dashboard-free || dashboard-pro) and redirecting users after login & add a “redirect to page: X” to each in case of an user enter to the incorrect page (ie: A free user enters on mywebsite.com/dashboard-pro => ‘on page load check user subscription’ => Redirect to /db-free). The thing with this is that the user is redirected on page load, and i think that the log of the page visited is stored, so maybe someone with some network knowledge can stop the redirect after the page is loaded (and access every section).
Are these redirects being made locally? is there any correct way to redirect the different users server-side and making sure that a free user can’t acces to premium features?
I want to do something similar of what’s being done on the last video. I want to hide/disable UI elements to certain users depending on their subscription level. But using conditionals to hide UI elements doesn’t work completely, i still can see them on the network log (so it’s not 100% secure).
Here are some screenshots:
I add a conditional to an element: If user is not pro => hide element