Hello, I'm writing an application and I want to secure some routes, but not all. I've built an Auth Controller to handle the routes that must be secure. However, when I test a simple implementation, the route is still executed. I have pasted my code below. The $user is NULL and the if(empty($user)) {...} is executed, but the page does not redirect to "/"... I get "list" written on the page no matter what. You can see the result here: https://107.170.228.134/promotions/list
<?php
use Phalcon\Http\Response;
class AuthController extends ControllerBase {
public function beforeExecuteRoute() {
$user = $this->session->get('auth');
if (empty($user)) {
$response = new Response();
return $response->redirect("/",false);
}
}
public function listAction() {
echo "list";
}
}