Newbie question on routing : views are directlty accessible if named differently from events

Happy Friday!

I have a newbie question. I’m rolling up a simple login/registration system, and I have created a controller for the event “auth” with methods “login, logout, register, activate”. So in my handlers folder, I have an auth.cfc component with methods login, logout, register, and activate. In the views folder, there is a subfolder named auth containing the views login.cfm, logout.cfm, register.cfm and activate.cfm.

I also created a slightly different view called activate1.cfm on my own and dropped it into the views folder. I implemented conditional logic in the auth.activate(event, rc, prc) method to either setView to “auth/activate” or “auth/activate1” depending on some condition. It works fine; however, I noticed during testing that if I navigate to “http://localhost:port/auth/activate1”, then it will serve the activate1.cfm view directly, when I wanted it to go through the controller!

Is there any way to stop the server from serving up view files directly? I’d prefer that they are accessible only through the controller.

I apologize in advance if this is in the Coldbox manual somewhere; I read through it a couple of times but didn’t see a solution in there.

Thanks,
Greg Graham
Developer Lead
Feinberg School of Medicine

This behavior is a feature known as implicit view dispatch.

https://www.ortussolutions.com/blog/tip-of-the-week-implicit-view-dispatch

I don’t think there is any way at the moment to disable it. Perhaps you could put in a ticket for that?

Thanks!

~Brad

ColdBox/CommandBox Developer Advocate
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com