I'm gonna probably find another way around this, but I'm still very new to Craft and want to ask if I'm missing something obvious. This is a commerce site that needs a front-end login.
I have an account
template folder with some templating that looks like this (it's an extended layout, leaving out unnecessary lines):
{# account/index.html #}
{% block main %}
{% if craft.session.isLoggedIn %}
{% include 'account/account.html' %}
{% else %}
{% include 'account/login_signup.html' %}
{% endif %}
{% endblock %}
And an excerpt from my general.php
{# excerpt from my general.php file #}
'loginPath' => 'account',
'postLoginRedirect' => 'account',
When a logged-out user goes to website.com/account
the login_signup.html
page is spit out and a user can sign in (ignore the sign-up part). If they type in their info correctly, it leads to an ERR_TOO_MANY_REDIRECTS
of account
redirecting to account
. This doesn't make sense to me, as both the login url and the post-login url point at the same path and load the same template, but the template should obviously handle the two situations differently. It should spit out the account.html
template if the user is logged in, and if not, the login_signup.html
template. These two template files have nothing in them right now, so it's not some other templating mistake.
If I remove either of the two config variables I presented in my general.php
file, everything works but the routes I want aren't there.
I want a logged out user to visit account
, get a sign in (login_signup.html
) form they then use, and get redirected to account
and the template will spit out the account.html
template.
Edit Basically, if a user is logged in with my general.php
having those two configs set to the same path (account
), this always results in too many redirects:
{% block main %}
{% if craft.session.isLoggedIn %}
I'm logged in!
{% else %}
I should log in!
{% endif %}
{% endblock %}