<p>We have a page where a user may use one form to login to their Craft account on the front end - and one form where they can create and account. See the page here: <a href="https://www.cadex.com/shop/account/login/" rel="nofollow noreferrer">https://www.cadex.com/shop/account/login/</a></p>

<p>And the template code here:</p>

<pre><code>        &lt;div class="login"&gt;
            &lt;h1&gt;Login To Your Account&lt;/h1&gt;
            &lt;div class="intro"&gt;
                Please login to your account below.
            &lt;/div&gt;

            {% if craft.request.getSegment(3) == "logged-out" %}
                &lt;div class="confirmMsg remove"&gt;You have been logged out of your account.&lt;/div&gt;
            {% endif %}

            {% if craft.request.getSegment(3) == "password" %}
                &lt;div class="confirmMsg remove"&gt;Your password has been successfully reset.&lt;/div&gt;
            {% endif %}

            &lt;form id="loginForm" method="post" accept-charset="UTF-8"&gt;
                {% if errorMessage is defined %}
                    &lt;div class="errorMsg"&gt;{{ errorMessage }}&lt;/div&gt;
                {% endif %}
                &lt;input type="hidden" name="action" value="users/login"&gt;
                {{ getCsrfInput() }}
                &lt;div class="input"&gt;
                    &lt;label&gt;Email &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input placeholder="Email" name="loginName" value="" data-parsley-type="email" data-parsley-required="true"&gt;
                &lt;/div&gt;
                &lt;div class="input"&gt;
                    &lt;label&gt;Password &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input type="password" placeholder="Password" name="password" value="" data-parsley-required="true"&gt;
                &lt;/div&gt;
                &lt;footer&gt;
                    &lt;button type="submit"&gt;Login&lt;/button&gt;
                    &lt;a href="{{ siteUrl }}account/reset-request"&gt;Forgot Password?&lt;/a&gt;
                &lt;/footer&gt;
            &lt;/form&gt;
        &lt;/div&gt;

        &lt;div class="create"&gt;
            &lt;h2&gt;Don't Have An Account?&lt;/h2&gt;
            &lt;div class="intro"&gt;
                Create an account below and benefit from quicker checkouts, order histories and more!
            &lt;/div&gt;

            &lt;form id="createForm" method="post" accept-charset="UTF-8"&gt;

                {% macro errorList(errors) %}
                    {% if errors %}
                            {% for error in errors %}
                                &lt;div class="errorMsg"&gt;{{ error }}&lt;/div&gt;
                            {% endfor %}
                    {% endif %}
                {% endmacro %}
                {% from _self import errorList %}

                {% if account is defined %}
                    {{ errorList(account.getErrors('email')) }}
                {% endif %}

                {% if account is defined %}
                    {{ errorList(account.getErrors('password')) }}
                {% endif %}

                {{ getCsrfInput() }}
                &lt;input type="hidden" name="action" value="users/saveUser"&gt;
                &lt;input type="hidden" name="redirect" value="{{ siteUrl }}account/signup-sent"&gt;
                &lt;div class="input"&gt;
                    &lt;label&gt;Email &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input id="signupEmail" name="email" placeholder="Email" value="" data-parsley-type="email" data-parsley-required="true"&gt;
                &lt;/div&gt;
                &lt;div class="input"&gt;
                    &lt;label&gt;Confirm Email &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input id="confirmEmail" placeholder="Confirm Email" value="" data-parsley-type="email" data-parsley-required="true" data-parsley-equalto="#signupEmail" data-parsley-equalto-message="Both emails must match"&gt;
                &lt;/div&gt;
                &lt;div class="input"&gt;
                    &lt;label&gt;Password &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input name="password" id="password" type="password" placeholder="Password" value="" data-parsley-required="true" data-parsley-minlength="6" data-parsley-minlength-message="Password must be 6 characters or longer"&gt;
                &lt;/div&gt;
                &lt;div class="input"&gt;
                    &lt;label&gt;Confirm Password &lt;span&gt;*&lt;/span&gt;&lt;/label&gt;
                    &lt;input name="confirmPassword" id="confirmPassword" type="password" placeholder="Confirm Password" value="" data-parsley-required="true" data-parsley-equalto="#password" data-parsley-equalto-message="Both passwords must match"&gt;
                &lt;/div&gt;
                &lt;input type="hidden" name="fields[accountReceiveEmails]" value=""&gt;
                &lt;div class="checkbox"&gt;
                    &lt;input type="checkbox" name="fields[accountReceiveEmails][]" value="yes" id="emailOptin"&gt;
                    &lt;label for="emailOptin"&gt;&lt;span class="checkbox"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Yes, I would also like to receive offers, discounts and news for Cadex products by email.&lt;/label&gt;
                &lt;/div&gt;
                &lt;footer&gt;
                    &lt;button&gt;Create Account&lt;/button&gt;
                &lt;/footer&gt;
            &lt;/form&gt;
        &lt;/div&gt;
</code></pre>

<p>The login form posts to: <code>users/login</code></p>

<p>The create an account form posts to: <code>users/saveUser</code></p>

<p>This page has been working fine for the last year since the site launched and people have been creating accounts. However, sometime in the last 7 days something changed. We were alerted to the fact that users could not create accounts. When attempting to fill out the Create Account form, what happens now is an error gets returned for the Login form (try creating an account with any creds and see on the page url above). In the Craft logs, the following happens as well:</p>

<pre><code>2018-04-24 17:36:31

Level   warning
Category    application
Message tried to log in unsuccessfully.
</code></pre>

<p>So it seems like suddenly the Create form is posting to <code>login</code>? There aren't any other errors we can see to explain this in the server logs or client-side. There have been no updates to any code, plugins or Craft during this time.</p>

<p>Oddly though, it looks like the correct data is getting posted. This is from the Craft logs:</p>

<pre><code>$_POST=array (
'CRAFT_CSRF_TOKEN' =&gt; 'PGqJcG8ibNiBV8tNAeXsUl~2U2W7e9YHVo0YxaN6'
'action' =&gt; 'users/saveUser'
'redirect' =&gt; 'https://www.cadex.com/shop/account/signup-sent'
'email' =&gt; 'test1@coalescentdesign.com'
'password' =&gt; REDACTED
'confirmPassword' =&gt; 'password'
'fields' =&gt;
array (
'accountReceiveEmails' =&gt; ''
)
</code></pre>

<p>Further, we have a staging version of this website where this issue does not happen.</p>

<p>Ideas anyone on what could be causing such unusual behaviour?</p>

<p><strong>UPDATE</strong></p>

<pre><code>Is it possible Craft forces this post? We found this in `craft/app/services/HttpRequestService.php`:

$loginPath = trim(craft()-&gt;config-&gt;getLocalized('loginPath'), '/');
...
if ($this-&gt;_path == $loginPath)
{
$this-&gt;_actionSegments = array('users', 'login');
}
</code></pre>

<p>And our login path is set to: <code>account/login'</code>.</p>

<p>I am still puzzled though... why was this working - and still works in staging?</p>

CC BY-SA 3.0
2018-04-25T06:29:57.367Z
You input type is a button and no submit, do you usually do something with ajax/javascript in your form? Because there is a javascript error so it might not be executed correctly. There are several event listeners on that button -> that might be the issue. When you use external libraries via URL they might change or be offline. However: this causes it `'https://connect.facebook.net/en_US/fbevents.js';);` <-- remove the `;`
Robin Schambach
CC BY-SA 3.0
2018-04-25T16:17:49.643Z
Thanks Robert. That JS error doesn't affect anything (we did try removing it just in case). As to the Submit button, same thing - adding `type=submit` doesn't make a difference either.
Mike
CC BY-SA 3.0
2018-04-25T19:14:03.517Z
Really strange.. Have you tried to turn on dev mode - just for a second - and submit a request in order to receive more errors?
Robin Schambach
CC BY-SA 3.0
2018-04-25T20:01:04.123Z
We have. Nothing more helpful. At this point we're looking into possibilities around the hosting environment or something else. Even 
 more odd, that page in question will work *if* we move it to a different URL. Yeah, bizarre.
Mike
<users><login>
saveUser form action posting elsewhere?
# saveUser form action posting elsewhere?

(Asked by: username_0 on 2018-04-25)

We have a page where a user may use one form to login to their Craft account on the front end - and one form where they can create and account. See the page here: https://www.cadex.com/shop/account/login/
And the template code here:
        
            Login To Your Account
            
                Please login to your account below.
            

            {% if craft.request.getSegment(3) == "logged-out" %}
                You have been logged out of your account.
            {% endif %}

            {% if craft.request.getSegment(3) == "password" %}
                Your password has been successfully reset.
            {% endif %}

            
                {% if errorMessage is defined %}
                    {{ errorMessage }}
                {% endif %}
                
                {{ getCsrfInput() }}
                
                    Email *
                    
                
                
                    Password *
                    
                
                
                    Login
                    Forgot Password?
                
            
        

        
            Don't Have An Account?
            
                Create an account below and benefit from quicker checkouts, order histories and more!
            

            

                {% macro errorList(errors) %}
                    {% if errors %}
                            {% for error in errors %}
                                {{ error }}
                            {% endfor %}
                    {% endif %}
                {% endmacro %}
                {% from _self import errorList %}

                {% if account is defined %}
                    {{ errorList(account.getErrors('email')) }}
                {% endif %}

                {% if account is defined %}
                    {{ errorList(account.getErrors('password')) }}
                {% endif %}

                {{ getCsrfInput() }}
                
                
                
                    Email *
                    
                
                
                    Confirm Email *
                    
                
                
                    Password *
                    
                
                
                    Confirm Password *
                    
                
                
                
                    
                    Yes, I would also like to receive offers, discounts and news for Cadex products by email.
                
                
                    Create Account
                
            
        

The login form posts to: users/login
The create an account form posts to: users/saveUser
This page has been working fine for the last year since the site launched and people have been creating accounts. However, sometime in the last 7 days something changed. We were alerted to the fact that users could not create accounts. When attempting to fill out the Create Account form, what happens now is an error gets returned for the Login form (try creating an account with any creds and see on the page url above). In the Craft logs, the following happens as well:
2018-04-24 17:36:31

Level   warning
Category    application
Message tried to log in unsuccessfully.

So it seems like suddenly the Create form is posting to login? There aren't any other errors we can see to explain this in the server logs or client-side. There have been no updates to any code, plugins or Craft during this time.
Oddly though, it looks like the correct data is getting posted. This is from the Craft logs:
$_POST=array (
'CRAFT_CSRF_TOKEN' => 'PGqJcG8ibNiBV8tNAeXsUl~2U2W7e9YHVo0YxaN6'
'action' => 'users/saveUser'
'redirect' => 'https://www.cadex.com/shop/account/signup-sent'
'email' => 'test1@coalescentdesign.com'
'password' => REDACTED
'confirmPassword' => 'password'
'fields' =>
array (
'accountReceiveEmails' => ''
)

Further, we have a staging version of this website where this issue does not happen.
Ideas anyone on what could be causing such unusual behaviour?
UPDATE
Is it possible Craft forces this post? We found this in `craft/app/services/HttpRequestService.php`:

$loginPath = trim(craft()->config->getLocalized('loginPath'), '/');
...
if ($this->_path == $loginPath)
{
$this->_actionSegments = array('users', 'login');
}

And our login path is set to: account/login'.
I am still puzzled though... why was this working - and still works in staging?

**Tags:** users, login

> **Comments:**
> **username_1**: You input type is a button and no submit, do you usually do something with ajax/javascript in your form? Because there is a javascript error so it might not be executed correctly. There are several event listeners on that button -> that might be the issue. When you use external libraries via URL they might change or be offline. However: this causes it `'https://connect.facebook.net/en_US/fbevents.js';);` <-- remove the `;`  
> **username_0**: Thanks Robert. That JS error doesn't affect anything (we did try removing it just in case). As to the Submit button, same thing - adding `type=submit` doesn't make a difference either.  
> **username_1**: Really strange.. Have you tried to turn on dev mode - just for a second - and submit a request in order to receive more errors?  
> **username_0**: We have. Nothing more helpful. At this point we're looking into possibilities around the hosting environment or something else. Even   more odd, that page in question will work *if* we move it to a different URL. Yeah, bizarre.  

---

## 0 answers

