Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Login Plugin returns Login Failed

Started by amdival 9 years ago · 6 replies · 2679 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 DrPen, 1 month ago
2 477 1 month ago
Plugins · by renedebaaij, 2 months ago
1 349 1 month ago
Plugins · by Thomas, 1 month ago
1 374 1 month ago
Plugins · by complanar, 2 months ago
6 698 2 months ago
Plugins · by BenLaKnet, 2 months ago
1 641 2 months ago