- I have "manage" link that redirects to domain.com/login.
- "login" is custom front-end page that after logging in redirects to homepage.
- After logging in when I click "manage" again the domain.com/login redirects me to CP dashboard.
- Signing out from CP redirects me to default Craft login page.
- How to redirect directly to dashboard after logging in?
- How to redirect directly to domain.com/login or homepage after signing out?
I'm also using manager
as cpTrigger, and this is my config:
'postLoginRedirect' => 'manager',
'logoutPath' => 'login',
'cpTrigger' => 'manager',
For some reason according to #1 postLoginRedirect doesn't take effect same for #2 and logoutPath, maybe I'm using them in the wrong way?
login/index.html code:
{% extends "login/_layout" %}
{% set title = "Welcome back, friend :)" %}
{% block content %}
<div class="box">
<form method="post" accept-charset="UTF-8">
{{ getCsrfInput() }}
<input type="hidden" name="action" value="users/login">
{% if errorMessage is defined %}
<article class="message is-danger">
<div class="message-body">
{{ errorMessage }}
</div>
</article>
{% endif %}
<div class="field">
<p class="control has-icon">
<input class="input" id="loginName" type="text" name="loginName" placeholder="Email">
<span class="icon">
<i class="fa fa-envelope"></i>
</span>
</p>
</div>
<div class="field">
<p class="control has-icon">
<input class="input" id="password" type="password" name="password" placeholder="Password">
<span class="icon">
<i class="fa fa-lock"></i>
</span>
</p>
</div>
<div class="field">
<p class="control">
<label class="checkbox">
<input type="checkbox" name="rememberMe" value="1">
Keep me logged in
</label>
</p>
</div>
<hr>
<p class="control">
<button class="button is-primary" type="submit">Login</button>
<a class="button is-default" href="{{ siteUrl }}">Cancel</a>
</p>
</form>
</div>
<p class="has-text-centered">
<a href="{{ url('login/register') }}">Register an Account</a>
|
<a href="{{ url('login/forgotpassword') }}">Forgot password</a>
|
<a href="{{ url('contact') }}">Need help?</a>
</p>
{% endblock %}
domain.com/login
template code? "How to redirect directly to dashboard after logging in?" Are you referring to Craft's dashboard or a front-end dashboard that you've created.