Wheels.InvalidAuthenticityToken

126 views
Skip to first unread message

Matthew

unread,
Jan 19, 2021, 1:09:07 PM1/19/21
to CFWheels
Is there a way to catch this error and handle it with a redirect vs. the default wheels error screen?

Thank so much

Matt Bassham

unread,
Jan 21, 2021, 6:37:57 AM1/21/21
to cfwh...@googlegroups.com
Did this get answered? I would like to know as well. Also, is there a way to also lengthen the expiration of the token?



On Tue, Jan 19, 2021, 12:09 PM Matthew <sup...@cfgeek.com> wrote:
Is there a way to catch this error and handle it with a redirect vs. the default wheels error screen?

Thank so much

--
You received this message because you are subscribed to the Google Groups "CFWheels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cfwheels+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cfwheels/b87d0f86-2e6f-4a95-8a7d-440c843430den%40googlegroups.com.

Tom King

unread,
Jan 21, 2021, 6:59:16 AM1/21/21
to CFWheels
I haven't used it in a while, but it might be that Chris Peter's plugin could catch and handle it separately?

Re timeout - is it not tied to session or default cookie expiration?
T

Matthew

unread,
Jan 21, 2021, 9:41:16 AM1/21/21
to CFWheels
Not yet but there may be something in this plugin:  https://github.com/liquifusion/cfwheels-exception-render I will post the solution if I get it figured out. 

Matthew

unread,
Jan 21, 2021, 9:41:42 AM1/21/21
to CFWheels
Thanks Tom, I will dig into the plugin

Andrew Spear

unread,
Sep 30, 2021, 8:11:39 PM9/30/21
to CFWheels
In case anyone is still trying to catch this error, here's what I changed...

In wheels/events/onerror.cfm, I replaced:

local.rv &= $includeAndReturnOutput(
$template = "wheels/events/onerror/wheelserror.cfm",

wheelsError = local.wheelsError
);

with the following to change the path to my onerror.cfm for only this particular error:

local.authtokenerrorpath = "wheels/events/onerror/wheelserror.cfm";
if ( arguments.exception.rootCause.type == "Wheels.InvalidAuthenticityToken" ) local.authtokenerrorpath = "/events/onerror.cfm";

local.rv &= $includeAndReturnOutput(
$template = local.authtokenerrorpath,
wheelsError = local.wheelsError
);

I hate editing core files directly, but this was a pretty visible error for my users.  Seems like this error should be visible in the local onerror.cfm event.

Reply all
Reply to author
Forward
0 new messages