Skip to content

User registration form with custom redirects has no error or success values in the response #3669

Closed

Description

@goellner

Bug Description

User registration form with custom redirects has no error or success values in the response. Needed to add a query param and now don't have access to the success or error values.

How to Reproduce

{{ user:register_form redirect="{url}?test=true" error_redirect="{url}?err=true"}}

Environment

Statamic 3.1.12 Pro
Laravel 8.40.0
PHP 7.4.15

Install method (choose one):

  • Fresh install from statamic/statamic

Activity

  1. duncanmcclean commented on May 10, 2021

    @duncanmcclean
    Member

    So what you're saying is that you lose the query parameters whenever you are redirected from the user:register_form, correct?

    If that's the case, I don't seem to be able to reproduce it...

  2. felixstoessel commented on May 20, 2021

    @felixstoessel

    I have the same issue in a different context:

    {{ form:create in="{{ form:handle ?? handle }}" }}
      {{ if success }}
        {{ success }}
      {{ /if }}
    {{ /form:create }}
    

    This worked fine some Statamic versions ago. Right now on 3.1.14, I don't get any success or error messages. When I have a form with some server side validations, those error messages also do not appear anymore. I tested this part of my code very intensively and there was nothing changed except updating Statamic with its dependencies.

  3. felixstoessel commented on May 21, 2021

    @felixstoessel

    Soo, I tested the issue and I have some observations:

    1. When I do a form submit, I get a 302 redirect. I checked my .htaccess, but every redirect there has a 301. If this redirect is not normal, then this should be the issue. Because when redirecting with 301/302, we lose the response data.
    2. The URL is /!/forms/contact, where contact in my form handle.

    But I am too stupid to fix this, because I have no clue where to look...

    redirect-on-submit

  4. felixstoessel commented on May 21, 2021

    @felixstoessel

    Well, the 302 redirect is the normal redirect by back(). I get my error messages inside formFailure() inside FormController.php. So I assume the issue is after this code, maybe there is some new middleware logic that strips data?

  5. felixstoessel commented on May 21, 2021

    @felixstoessel

    So, I tested every PHP part and in Antlers, right before me calling {{ errors }}{{ value }}{{ /errors }}, I created a dump:

    errors-dump

    So the error messages are there, but somehow the augmentation of errors does not work.

  6. felixstoessel commented on May 25, 2021

    @felixstoessel

    Is there anyone watching this issue? I find this bug to be important, because it really makes forms completely useless and very bad for customers (because of no feedback like success or errors)...

  7. felixstoessel commented on May 27, 2021

    @felixstoessel

    @jasonvarga Could you help with that? I did more debugging than I wanted, but I have no idea how things are internally connected to fix this. Thank you!

  8. felixstoessel commented on Jun 9, 2021

    @felixstoessel

    @jackmcdade Sorry to write to you guys directly, but this is a critical issue and I am very frustrated. Nobody seems to work on this despite having done some initial work to help fixing this bug. I wouldn't be so impatient if it wasn't a critical bug.

  9. jasonvarga commented on Jun 11, 2021

    @jasonvarga
    Member

    The original issue is quite different from what Felix is explaining. They're not even the same tags.

    Regarding the registration form, you never showed the template where you're trying to output the success or errors. Both success and errors are available on the tag. So if you're not using the tag, they won't just magically be available.

    They do live in the session though, so you can use the session tag to grab them:

    {{ if {session:user.register.success} }}
      {{ session:user.registesr.success }}
    {{ /if }}
    

    We'll update the docs.

    As for the form thing, it looks like some weirdness when you use ?? instead of or. Changing {{ form:create in="{ handle ?? form:handle }" }} to in="{ handle or form:handle }" fixes it. I'll open a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions