Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: CSM does not return Registration Errors on EE5.4.0

Status Resolved
Add-on / Version Custom System Messages 3.0.5
Severity
EE Version 5.4.0

Nicolas Burtnyk

Feb 16, 2021

We’re on EE5.4.0. For registration we use EEHarbor’s User addon. The registration page submission is handled via Ajax.

In case of an incorrect registration form submission (e.g. email address already registered), EE5.4.0 and/or User addon reponds with:

(1) 403 Forbidden status
(2) an html page that contains the submission errors

We then parse the html returned in the Ajax call and extract the errors from it and display them on the registration page.

When CSM is uninstalled (so that it does NOT interfere here), this all works just fine.

With CSM installed, which we bought and use for something else, this now breaks.

The reponse for an incorrect registration page submisison (e.g. email address already registered) is now:

(1) 200 response status, hence NOT an error response
(2) the html returned is simply the registration page, it does not contain the submission errors returned by EE5.4.0 and/or the User addon

My questions are:

(1) How can we configure CSM here to NOT interfere on this page ?

(2) if the above is not possible, then how do we need to configure the exp:user:register form and/or CSM to return the submission errors (in case of errors) ?

I’ve attached screenshot of our current CSM config, as you can see we only have one rule in there for a different page (and that one works, but is NOT Ajax driven).

this is the exp:user:register config:

{exp:user:register form:class="form-horizontal validate" form:id="register-form"}

What I tried:

(1) Added a rule in CSM for

(15) Registration Form (On Error)

but the result was still the same, we do not get the submission errors from CSM.

(2) Added return params to the exp:user:register form… we still do not get the registration errors.

Thanks.

 

#1

BoldMinded (Brian)

CSM has never had the ability to ignore certain outputs/errors, and I don’t have plans to add such a feature. Does the form work without Ajax?

#2

Nicolas Burtnyk

Brian,

I think you misunderstood, so here’s another scenario where the CSM addon does not work for us as intended:

CSM settings: Bypass the message template entirely on successful actions? No (also tried Yes) Redirect to the defined error template? Yes Submission Error: messages/error General Error: messages/error Accessibility: Better Accessibility (use HTTP Referrer) Custom Actions: None

As you can see from then above, we simply configuring CSM to use the messages/error template for ALL form or general errors.

We then trigger an incorrect form submission, which is sumitted via Ajax. CSM interferes, rewrites the 403 error response from EE to 200, and then does NOT serve the messages/error template… it simply serves the same page we just submitted, basically it reloaded the page…

So, I also put a CSM error block on that page to possibly get the form/general errors this way:

<div id=”csm_errors” class=”small-10 small-centered”> {if csm:error == true} <div class=”form-error-section”> <div class=”error-message”> <h3>The following errors were encountered:</h3> <ul class=”error-fields”> {csm:content} </ul> </div> </div> {/if} </div>

but, the errors are also never populated there….

THIS is our issue, the errors are simply gone.

What can we do about this ?

#3

BoldMinded (Brian)

CSM used to support Ajax requests, but it required a plugin tag. Due to the widely different implementations of form submission and error handling within EE itself at the time (maybe still today) and with 3rd party add-ons, I had to drop support for it, which is why you don’t see a pi.system_messages.php file anymore. The next message will contain a link to a build that sort of re-enables support for Ajax responses. There is no plugin file, and if you enable Ajax responses in the settings page, it should return a JSON response instead of redirecting or rendering a full template. You can see where this happens around line 331 of the ext file.

Let me know if this build works for you.

#4

BoldMinded (Brian)

Comment has been marked private.

Login to reply