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.

Support

Private Area - Login Register Redirect Page

Started by Eric 9 years ago · 10 replies · 2857 views
9 years ago

Hello,

If a user lands on a private area page ...Is it possible to create a redirect that will take a visitor to a Login or Registration page if they are not Logged-In or Registered with the site?

I read the Create Private Area Documentation But did not see any redirect? Is there a example available?

Thanks in Advance

9 years ago

Well, Login plugin should handle this :) If you enter site where access is set in the frontmatter, it'll redirect you to the login page :)

9 years ago

Yes I have added

access:
site.login: true
admin.login: true

But still no luck it just stays on the page and no redirect.

Do you have a Example?

Thanks

9 years ago

Did you remember about the intendation?

YAML
access:
    site.login: true
9 years ago

Yes I did indent. Yes Sorry about that but Yes I indented.

9 years ago

And when you enter this page, what does show up?

9 years ago

Nothing shows up its just blank. It looks like it's protecting it but not sending me to login page.

9 years ago

Did you enable Login module and configure Login-path?

9 years ago

Yes Login Plugin is Enable I did set path on login but I go to a page that is blank as well. No Login Form?

9 years ago

Well, it seems that the plugin is not generating login form...

9 years ago

There seems to be many variables that could stop your login form from showing up .. I was able to get it showing up by:

{% block main_content %}

TWIG
{% include 'partials/login-form.html.twig' %}

{% endblock %}

Key here is the Block name "main_content" instead of "content".. "CONTENT" is the default name in the plugin folder.... MAIN_CONTENT is the name I gave in my partials/base.html.twig template

👍 1

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 50 6 hours ago
Support · by Anna, 2 days ago
2 58 9 hours ago
Support · by Justin Young, 10 hours ago
1 28 10 hours ago
Support · by Duc , 1 week ago
2 63 5 days ago
Support · by Colin Hume, 1 week ago
2 53 5 days ago