I want to apply a policy that lets user to login to application. I written the code for policy. I want to apply this one to homepage also.
I tried below in policies.js but its not working on homepage.
'*' : 'isLoggedIn'
I want to apply a policy that lets user to login to application. I written the code for policy. I want to apply this one to homepage also.
I tried below in policies.js but its not working on homepage.
'*' : 'isLoggedIn'
I think you are not serving your homepage through a controller/action. Policies can only be applied to content which get served via controller/action.
From the documentation of Sails Policies :
Policies in Sails are versatile tools for authorization and access control-- they let you allow or deny access to your controllers down to a fine level of granularity.
It should start working once you serve the homepage via a controller.
if you want apply the policy to homepage
you must do it into the file route.js