4

I have two forms on a page, the first one is generated by exp:autheticate, and the second is a normal handwritten form. Both are triggered by javascript submits. The authenticate form seems to be sending me to the action of the second form on success, rather than the return param.

    <div class="panel front">
    {exp:authenticate:login_form
        auth_type="email"
        username_field="email"
        secure_return="yes"
        class="cf"
        id="login-form"
        return="/welcome"}
          <input type="text" name="email" value="" placeholder="Email" id="email" class="i2"/>
          <input type="password" name="password" value="" placeholder="Password" id="password" class="i2"/>
          <a href="#" id="login-submit" data-submit="login-form">&gt;</a>
          <div class="divider"></div>
          <a href="#" id="login-join" data-toggle="Join">&gt;</a>
      {/exp:authenticate:login_form}
    </div>

    <div class="panel back">
      <form action="https://whatever.com/apply" accept-charset="utf-8" method="post" class="cf" id="apply-quick-form" name="">
          <input type="text" name="newemail" value="" placeholder="Email" id="newemail" class="i2"/>
          <div class="invite-code" data-script="InviteCode" class="i2">
            <a href="#/invite">Have an invite code?</a>
            <input type="text" name="invcode" value="" placeholder="Invite code (optional)" id="invcode" class="i2"/>
          </div>
          <a href="#" id="login-submit" data-toggle="Login">&gt;</a>
          <div class="divider"></div>
          <a href="#" id="login-join" data-submit="apply-quick-form">&gt;</a>
      </form>
    </div>

EDIT: Seems it was an interaction with twomile_login_redirect that was the issue. That plugin tracks a previous requested URL in a session variable, and forces you to redirect to THAT url once logged in. I haven't solved the problem yet, but have tracked it down to that interaction.

4

Since you fixed the redirect issue, I thought I would tell you how I handle the redirect stuff.

On restricted templates I will add the following tag. The tag will vary based on the size of the page URL. I like this approach because it avoid Cookies and local session vars, which are restricted in some parts of the world.

{if logged_out}{redirect="/login/return/{segment_1}/{segment_2}/{segment_3}"}{/if}

Then you would make your Authenticate tag like so:

{exp:authenticate:login_form return_var="return"}

This will tell Authenticate to return to the URI after the "return" segment. There are a number of other ways to this, but I have been able to use some technique pretty much across the board with much success. Definitely not the only way to solve the problem though, nor the solution for everyone.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.