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

Login Plugin returns Login Failed

Started by amdival 9 years ago · 6 replies · 2243 views
9 years ago

I'm trying to get the Login plugin to work.
I've put it in my plugins folder.
I've make a page and added this to the YAML Frontmatter:

access:
site.login: true

When I surf to the page, I get the login form as expected. When I fill it out, I get a Login Failed message.

If I enter the correct credentials, the accounts/name.yaml file is overwritten; password is removed. state and hashed_password is added.

If I enter incorrect credentials, the accounts/name.yaml file is not changed.

9 years ago

did you indent your YAML correctly? your code block is not indented as it should b e. Should be:

YAML
access:
  site.login: true

the password being hashed on first login (irrespective of access) is correct and expected.

9 years ago

Yes, I have it indented; I couldn't figure out how to indent it for the post.

9 years ago

you use triple backticks like in markdown for code blocks...

regarding your issue, what does the user account look like? delete the pw/email lines if you like, I'm interested specifically in the access section

9 years ago
YAML
password: 'passwordhere'
email: '[email protected]'
fullname: 'First Last'
title: 'Site Administrator'
access:
  admin:
    login: true
    super: true
9 years ago

@adv:
password: 'passwordhere'
email: '[email protected]'
fullname: 'First Last'
title: 'Site Administrator'
access:
admin:
login: true
super: true

There's your problem you need:

YAML
password: 'passwordhere'
email: '[email protected]'
fullname: 'First Last'
title: 'Site Administrator'
access:
  admin:
    login: true
    super: true
  site:
    login: true
9 years ago

Thanks! That is just what I needed!

Now to find some uses for being logged in. 🙂

I found this code on the plugin's repo page:

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 %}

why would I not shorten the if statement to just this:

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

Also, that code seems to work even though I don't have login-status.html.twig in my partials directory, how is it grabbing that code?

Suggested topics

Topic Participants Replies Views Activity
Plugins · by Rene, 1 week ago
2 47 1 week ago
Plugins · by Xavier, 4 weeks ago
2 56 4 weeks ago
Plugins · by Luka Prinčič, 7 years ago
3 1182 1 month ago
Plugins · by Sebastian van de Meer, 1 month ago
1 50 1 month ago
Plugins · by PIERROT Alain, 2 months ago
3 74 2 months ago