Hi, In Dancer2::Cookbook I read: before sub { if (! session('user') && request->path_info !~ m{^/login}) { var requested_path => request->path_info; request->path_info('/login'); } }; But it doesn't work and it gives an error. So I tried to change it with: hook before => sub { if ( !session('user') && request->path_info !~ m{^/login} ) { var requested_path => request->path_info; request->path_info('/login'); } }; This doesn't give an error, but I am not sure if it works as it should. I thought that the following line should execute the subroutine for /login: request->path_info('/login'); but this doesn't happen and the subroutine for currently requested path is executed. Is it possible to protect all the paths under a certain path, say /admin, by checking in a single place if the user is logged in, and if it is not, print the login form? --Octavian
participants (1)
-
Octavian Rasnita