ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Client login redirects to homepage, not return page

December 03, 2013 12:26pm

Subscribe [2]
  • #1 / Dec 03, 2013 12:26pm

    Deelicious's avatar

    Deelicious

    86 posts

    I have a customer login page with the following code:

    {exp:member:login_form return="customer/index"}
            
                    <label><h2>Username</h2><p></label></p>
    
    <p>                <input type="text" name="username" value="" maxlength="32" size="25"><br />
            <br />
            <br />
                    <label></p><h2>Password</h2><p></label></p>
    
    <p>                <input type="password" name="password" value="" maxlength="32" size="25"><br />
            <br />
            {if auto_login}<br />
                    <input type="checkbox" name="auto_login" value="1"> Auto-login on future visits<br />
            {/if}</p>
    
    <p>        <input type="submit" name="submit" value="Submit"></p><br />
            <a href="http://{path=member/forgot_password}">Forgot your password</a><br />
    {/exp:member:login_form}

    I would like this page to direct to the customer page immediately where the customer’s information is presented, but what was working before now doesn’t and it always sends them to the home page.

    I am using the following to hide the index.php from the urls and also have cookies only set in my settings:

    <IfModule mod_rewrite.c>
            RewriteEngine On
    
            # Removes index.php from ExpressionEngine URLs
            RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ /index.php/$1 [L]
    </IfModule>

    Any ideas as to how I can get this to redirect to the specific page I’ve requested would be GREATLY appreciated! Thank you!

  • #2 / Dec 03, 2013 9:05pm

    Deelicious's avatar

    Deelicious

    86 posts

    I resolved this issue. The reason the page was redirecting to the home page was because the customer was already logged in. If the user wasn’t logged in previously and logged in, it would take the user to the return page, but if the user was already logged in and tried to log in again, it would take them to the home page.

    I fixed the issue by creating a link once logged in that allowed them to access the return page no matter where they were on the site once logged in. I hope this helps others who were confused by this same issue.

  • #3 / Dec 04, 2013 12:01pm

    Kurt Deutscher's avatar

    Kurt Deutscher

    827 posts

    When a user sets a bookmark or returns to a browser window or tab after their cookie/session has timed out, we find it can be disruptive to be taken to any one specific page after login, so we use segments to have the form return visitors to whatever page they are one when they log in.

    So we’ll put a modal window login form in the header/masthead of the site that can be accessed on any page, and return the user to that page once logged in (or logged back in).

    return='{global_url}{if segment_1}{segment_1}/{/if}{if segment_2}{segment_2}/{/if}{if segment_3}{segment_3}/{/if}{if segment_4}{segment_4}/{/if}{if segment_5}{segment_5}/{/if}'

    The {global_url} is our tool for ensuring the domain gets set the way we want it in the URL: it’s a user defined global set in the template manager of EE.

    This is an alternative to the solution you have listed.

    Hope that helps someone in the community.

     

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases