Redirect on login and logout to custom place


/ Published in: eZ Publish
Save to your folder(s)

For redirect back to same place on logout, add this your site.ini.append.php:

[UserSettings]
RedirectOnLogoutWithLastAccessURI=enabled


Copy this code and paste it in your HTML
  1. <form method="post" action={"/user/login/"|ezurl} class="styled">
  2. {def $current_user = fetch( 'user', 'current_user' )}
  3. {if $current_user.is_logged_in}
  4. <p>Logged in as {$current_user.contentobject.name|wash}<br />
  5. <a href={"/user/logout"|ezurl}>Logout</a></p>
  6. {else}
  7. <p>Login</p>
  8. <div class="block">
  9. <label for="username">Brukernavn</label>
  10. <input type="text" id="username" name="Login" />
  11. </div>
  12. <div class="block">
  13. <label for="password">Passord</label>
  14. <input type="password" id="password" name="Password" />
  15. </div>
  16. <div class="block">
  17. <button type="submit" name="LoginButton">
  18. <span>Logg inn</span>
  19. </button>
  20. </div>
  21. <input type="hidden" name="RedirectURI" value="{$node.url_alias}" />
  22. <a href={'layout/set/ajax/user/forgotpassword/'|ezurl} class="passforgot nyroModal">Glemt passord</a>
  23. {/if}
  24. </form>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.