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.

Frontend Login Returns Homepage

February 13, 2012 8:05pm

Subscribe [5]
  • #1 / Feb 13, 2012 8:05pm

    imageworks

    14 posts

    I’ve got a frontend login to hide a specific page on the website. When I test it to login, it returns me to the homepage rather than actually logging me in. Been banging my head against it all day.

    Using EE 2.4 all add-ons are updated. Not using any third-party user controls.

    I appreciate any help I can get and I’m sure I missed something small and need new eyes/perspective to tell me what I did wrong.

  • #2 / Feb 14, 2012 12:07pm

    imageworks

    14 posts

    This is the code I have for the front-end login:

    {if logged_in_group_id == "6" OR logged_in_group_id == "5" OR logged_in_group_id == "1"}
    {exp:channel:entries channel="new_layout"}
       {subpage_content}
    {/exp:channel:entries}
    {/if}
    
    {if logged_out}
    {exp:member:login_form return="/commissioners-only/"}
            
                    <label>Username</label>
    
                    <input type="text" name="username" value="" maxlength="32" size="25">
            
            
                    <label>Password</label>
    
                    <input type="password" name="password" value="" maxlength="32" size="25">
            
    
            <input type="submit" name="submit" value="Submit"></p>
    {/exp:member:login_form}
    {/if}

    I’m using Structure as well. Most recent version.

  • #3 / Feb 14, 2012 6:29pm

    Sean C. Smith

    3818 posts

    imageworks,

    Sorry that you are having this problem. I would like to clarify what is happening here. When you visit the page, and not logged in, you are presented with the login form. After submitting the form you are sent to the homepage rather than the return parameter you’ve included in the tag. Is this correct?

    I have tested your exact code above and the login form worked correctly redirecting me to the return parameter. Could you turn on template debugging?  To do so go to admin > system administration > output and debugging.

    If you visit the page after logging in via the backend of the site are able to correctly view the page content?

  • #4 / Feb 14, 2012 7:51pm

    imageworks

    14 posts

    You are correct. After attempting to login with the UN and PW it redirects to the home page rather than the return param. (it doesn’t matter if I do this as a Super Admin or just a Member user that has access to this page, always happens)

    I’ve turned on Debugging.

    If I login to the CP as either type of user, Member or SuperAdmin, I can then see the content on the page.

  • #5 / Feb 15, 2012 3:06pm

    imageworks

    14 posts

    I can PM you my contact and site info if you’d like.

  • #6 / Feb 15, 2012 3:19pm

    Ian Young

    200 posts

    Try cleaning up your return value a little so it follows the {template_group}/{template} pattern. For example:

    return="commissioners-only/index"

    Alternatively if you’re using Structure then maybe try removing the trailing slash:

    return="/commissioners-only"

    And double check that this is the correct URL in your Structure page.

    Are you removing index.php from your URLs in your htaccess at all?

  • #7 / Feb 15, 2012 4:57pm

    imageworks

    14 posts

    I tried both options you said Slippy.

    I also tried having it return to a completely different and separate page, same thing happens.

    I am removing index.php from my URL. All other pages are loading fine though.

  • #8 / Feb 15, 2012 5:07pm

    Ian Young

    200 posts

    It sounds like it’s defaulting and returning home because it can’t find the page it’s being directed to. What is your 404 page set to? (Template Manager > Global Template Preferences). I’m guessing it’s the home page? If you use any debugging tools then you can check to see if it’s returning a 404 status but don’t worry if you don’t. It could be a good test to change this to another testing page to see if it returns you to that instead of the home page. Then we’ll know that it’s just not finding the page it needs to be redirected to.

  • #9 / Feb 16, 2012 5:38pm

    Shane Eckert

    7174 posts

    Hell imageworks,

    Slippy has a great suggestion. Let us know the results.

    Also, can you create a brand-new template and put just this code into the template.

    {exp:member:login_form return="/commissioners-only/"}
            
                    <label>Username</label>
    
                    <input type="text" name="username" value="" maxlength="32" size="25">
            
            
                    <label>Password</label>
    
                    <input type="password" name="password" value="" maxlength="32" size="25">
            
    
            <input type="submit" name="submit" value="Submit"></p>
    {/exp:member:login_form}

    And then test that to see if it works.

    If that does not work, then try this. I use this code as is on my 2.4 site and it works.

    {exp:member:login_form return="site/whatup"}
            
                    <label>Username</label>
    
                    <input type="text" name="username" value="" maxlength="32" size="25">
            
            
                    <label>Password</label>
    
                    <input type="password" name="password" value="" maxlength="32" size="25">
            
            {if auto_login}
                    <input type="checkbox" name="auto_login" value="1"> Auto-login on future visits
            {/if}
    
            <input type="checkbox" name="anon" value="1" checked="checked"> Show my name in the online users list
            <input type="submit" name="submit" value="Submit"></p>
            <a href="http://{path=member/forgot_password}">Forgot your password?</a>
    {/exp:member:login_form}

    Let me know the results!

    Cheers,

     

  • #10 / Feb 17, 2012 5:46pm

    imageworks

    14 posts

    Ok I do have a 404 page set and its not returning that. I tried pointing it to another page and to a different template. Still goes to the homepage.

    And Shane, I tried the code you posted, both of them, with pages that exist on the site to return to, it always returns the homepage.

    My mind is boggled. I’ve never run into this before. We upgraded our client from MojoMotor to EE for this ability (among others).

  • #11 / Feb 17, 2012 5:49pm

    imageworks

    14 posts

    I should clarify something as well

    return="/commissioners-only"

    That is not a template. It’s a specific page, defined via Structure. If this lack of info changes things drastically, I apologize.

  • #12 / Feb 17, 2012 6:00pm

    Shane Eckert

    7174 posts

    Hello imageworks,

    That is actually some good info to have.

    Structure changes the way that ExpressionEngine behaves. Your quickest resolution will probably come from asking Jack and Travis about the issue. If you decide upon that route point them here and they should be able to help.

    Does that sound like a plan you can live with?

    Let me know your thoughts. I want to get this sorted out for you.

    Cheers,
    Shane

  • #13 / Feb 17, 2012 6:07pm

    imageworks

    14 posts

    Yeah, I know Structure changes things. What makes it so odd for me, is that, I’ve done almost this exact same thing on another site, and it functions, no problem.

    Do you think there could be an issue because of upgrading from MojoMotor?

  • #14 / Feb 20, 2012 3:30pm

    Ian Young

    200 posts

    Hi imageworks,

    How are you getting on with this, made any progress?

    Although you’re using Structure it shouldn’t affect the return URL at all if a Structure page is setup to handle this. Have you tried the full URL at all? Something like:

    return="http://mydomain.com/return"

    or you could make it a little more dynamic with:

    return="{site_url}return"

    Also with the above try with both the www. and without the www. This could be the factor that is different to the last time you did it. Check to see if you’re forcibly removing the subdomain (www) in your htaccess file.

    If that doesn’t work do you have any debugging tools which will allow you to see what’s happening underneath? Something like the Live HTTP Headers addon for Firefox would do the job. Make sure redirects are displayed and then we can see if it’s hitting that page at all. If it’s redirecting home then some kind of redirect is working.

     

  • #15 / Feb 20, 2012 5:29pm

    Shane Eckert

    7174 posts

    Hello imageworks,

    I do not think it’s related to the update.

    I still feel that contacting Jack and Travis is your best option. Structure really does change how ExpressionEngine works and I do not see how Structure would not effect the return URL. Just to be sure I ran this thread by a fellow Customer Advocate. We both think the logical next step is to contact Jack or Travis.

    Let me know what you hear back from the Structure guys.

    Thank you,

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

ExpressionEngine News!

#eecms, #events, #releases