We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

security plugin not working

i am confused.

i put this into my services in config file and than my website breaks

    $di->set('dispatcher', function() use ($di) {

        $eventsManager = new EventsManager;

        /**
        * Check if the user is allowed to access certain action using the SecurityPlugin
        */

        $eventsManager->attach('dispatch:beforeDispatch', new SecurityPlugin);

        /**
        * Handle exceptions and not-found exceptions using NotFoundPlugin
        */
        $eventsManager->attach('dispatch:beforeException', new NotFoundPlugin);

        $dispatcher = new Dispatcher;
        $dispatcher->setEventsManager($eventsManager);

        return $dispatcher;
    });

my full code is here https://github.com/simonhochrein/sign-up-sign-in-phalcon

I answered part of your question over in: https://forum.phalcon.io/discussion/4368/how-to-debug-phalcon

One of the issues I am having with your code is that on your navigation bar you have links to /auth/session/index

However you have no custom routing setup for /auth

So phalcon is attempting to forward the request onto the AuthController automatically.

I was able to get your login/sign up forms to show up simply by removing /auth from the route and changing it to /session/index

The signup form wont render because there isnt a register action defined on the session controller

Action 'register' was not found on handler 'session'
edited Jan '15

Thank you!

I updated the code.

acl is working but instead of the 404 screen i get a white same with the other errors

do you notice anything else?

Hey Duncan, Thank for your precious suggestion, I was also facing the same issue a while before. Actually, I had WP “Login Security 2” plugin installed in my blog but unfortunately, it was not functioning as per the expectations. After being fed up completely, I replaced it with UserPro v2.23, which I downloaded from nulledstylez. Thankfully, the problem does not exist now.