Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Plugins

Created privated area and page but cannot log out a user

Started by Dean Bateman 8 years ago · 0 replies · 647 views
8 years ago

I have created a page and have added this to the front matter

YAML
access:
    site.editor: true
login:
  visibility_requires_access: true

this allows my page to be displayed and accessed if I log in as an editor (group/user)

this works great,

next, I added to display login status, this doesn't display anything unless I removed config.plugins.login.enabled - it seems like this is not an option for login, I have the admin plugin install with the login

TWIG
{% if config.plugins.login.enabled and grav.user.username %}
  <li><i class="fa fa-lock"></i> {% include 'partials/login-status.html.twig' %}</li>
{% endif %}

so with config.plugins.login.enabled removed I can see the lock and user in my nav bar which is created from this code.

TWIG
<span class="login-status">
    {% if grav.user.authenticated %}
        <strong>{{ grav.user.fullname ?: grav.user.username }}</strong>, <a class="logout" href="{{ uri.addNonce((base_url_relative ~ uri.path)|trim('/') ~ '/task' ~ config.system.param_sep ~ 'login.logout', 'logout-form', 'logout-nonce')|e }}">{{ 'PLUGIN_LOGIN.BTN_LOGOUT'|t }}</a>
    {% endif %}
</span>

but this does not create a href value

HTML
<a class="logout" href="">Logout</a>

so my question is how do I call/create a link to logout a login user?

further to this if i do delete the user cookie i can log them out

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 46 1 week ago
Plugins · by Xavier, 4 weeks ago
2 55 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1181 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 49 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 73 2 months ago