adv
1
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.
rhuk
2
did you indent your YAML correctly? your code block is not indented as it should b e. Should be:
access:
site.login: true
the password being hashed on first login (irrespective of access) is correct and expected.
adv
3
Yes, I have it indented; I couldn’t figure out how to indent it for the post.
rhuk
4
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
adv
5
password: 'passwordhere'
email: 'youremail@mail.com'
fullname: 'First Last'
title: 'Site Administrator'
access:
admin:
login: true
super: true
rhuk
6
There’s your problem you need:
password: 'passwordhere'
email: 'youremail@mail.com'
fullname: 'First Last'
title: 'Site Administrator'
access:
admin:
login: true
super: true
site:
login: true
adv
7
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:
{% 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:
{% 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?