0

So I'm using this code to have users login from the front-end:

<div class="row">
    <div class="container">
        <div class="col-lg-12 col-md-12">
            {if logged_out}
            {exp:member:login_form class="login" id="login_form" return="/login"}           
            <input type="hidden" name="auto_login" value="1">
                <div class="form-group">
                    <label for="username">User Name</label>
                    <input type="text" name="username" placeholder="Username" class="form-control"/>
                </div>
                <div class="form-group">
                    <label for="password">Password</label><br />
                    <input type="password" name="password" placeholder="Password" class="form-control"/>
                </div>
                <button type="submit" class="btn btn-default">Submit</button>
            {/exp:member:login_form}
            <p>&nbsp;</p>
            <p><a href="{site_url}{admin_path}.php?S=0&D=cp&C=login&M=forgotten_password_form">Forgot Password?</a></p>
            {/if}

            {if logged_in}
            <h2>You Are logged in as {screen_name}</h2>
            <ul>
                <li><a href="{site_url}{admin_path}.php" target="_blank">Control Panel</a></li>
                <li><a href="{site_url}{admin_path}.php?/cp/content_publish/entry_form&channel_id=3&entry_id=7" class="cp" target="_blank">Edit Global Elements</a></li>
                <li><a href="{site_url}">Homepage</a></li>
                <li><a href="{path='logout'}">Logout</a></li>
            {/if}
        </div>
    </div>
</div>

But I'm not actually getting logged in. So it's like the {if logged_in}{/if} isn't actually working.

I'm using that same code in older builds so it must be a bug right? :) My settings for "Control Panel Session Type" and "Website Session Type" are set to COOKIES ONLY.

I'm also using the same .htaccess I've always used as well.

1

I just tested it with ExpressionEngine v2.9.0 - Build Date: 20140715, with "Control Panel Session Type" and "Website Session Type" are set to COOKIES ONLY.

Works as expected for me. So check if you really not login. Can be that you was not login in CP, but on site.

| improve this answer | |
  • Did you try it with the code that I had on a login template? Those conditionals don't appear to be working properly for me. – Mark Busnelli Jr Aug 16 '14 at 14:13
  • yes, I use your code. Plus change parameters as in your description. – Max Lazar Aug 16 '14 at 16:20
  • So you have a login template in use? Can I see your code? Perhaps I missed something. But I'm using {if logged_in}SHOW STUFF{/if} but when I revisit the CP EE wants me to re-login. – Mark Busnelli Jr Aug 18 '14 at 14:34
  • Also not sure what you mean by "Can be that you was not login in CP, but on site." Isn't that the same thing? – Mark Busnelli Jr Aug 18 '14 at 14:35
1

Looks like it was a good ole htaccess issue.

I was mistakenly rewriting the URL (only needs to be done on LIVE, not DEV) when it's launched and since this is on a DEV environment I commented this out:

# <IfModule mod_rewrite.c>
#   RewriteCond %{HTTPS} !=on
#   RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#   RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# </IfModule>

Wa-laaa!

| improve this answer | |

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.