1

My login form is not redirect like I want it to.

<form method="post" accept-charset="UTF-8">
{{ csrfInput() }}
<input type="hidden" name="action" value="users/login">
<input type="hidden" name="redirect" value="profile">

<h3><label for="loginName">Username or email</label></h3>
<input id="loginName" type="text" name="loginName"
    value="{{ craft.app.user.rememberedUsername }}">

<h3><label for="password">Password</label></h3>
<input id="password" type="password" name="password">
<label>
    <input type="checkbox" name="rememberMe" value="1">
    Remember me
</label>

<input type="submit" value="Login">

Anybody know why?

1

All redirect parameters needs to be hashed in Craft 3. If not, they're completely ignored.

Try using:

<input type="hidden" name="redirect" value="{{ '/profile' | hash }}">

Or

{{ redirectInput('profile') }}
| improve this answer | |
  • That would explain why every redirect variation I attempted failed. This works perfectly, thank you. – Alex Carpenter Aug 24 '18 at 18:46

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.