XF 2.0 Routing to URL when non-authenticated

I have created a custom route as follows:-

Screen Shot 2017-09-29 at 16.34.27.webp

I have created the add-on package and appropriate class which currently looks like a bit like this:-

Code:
namespace IPSE\Authenticate\Pub\Controller;

class Authenticate extends \XF\Pub\Controller\AbstractController {
  public function actionAuthenticate() {
    // Do stuff
  }
}

The route seems to resolve OK when logged in but when accessing the site as a non-authenticated (guest) user I end up with a login prompt...

What do I need to change here?
 
Last edited:
From that code, guests would only get that error if they have no viewing permissions anywhere. Is that the case? If so, you will need to bypass that check in your controller. Have a look at the XF\Pub\Controller\Login class for some similar examples -- you'll see a bunch of methods it overrides (to disable) at the end.
 
That's correct, Unregistered / Unconfirmed don't have permissions to view anything.

This seems to be the key override here:

Code:
public function assertViewingPermissions($action) {}

Thanks!
 
Back
Top Bottom