Which controller builds the home page? - orchardcms

I need to block anonymous from entering the site, but I can't find the controller that builds the Home page nor the routing that redirects there.
Going to the widget admin and unpublishing/deleting everything in the anonymous layer, only hides the items but I need to redirect to the login page, just as the Admin area functionality.
And I cant' just remove the anonymous role, because they can access some pages and content, just not the Home.

Orchard, by default (though you can override this, see the blog module), uses the same controller to render all content items, including the home page.
What you need is the content permissions module, that has a part you can attach to content types (e.g. Page) that will let you specify, per item, what roles can view it. Attaching this and setting only authenticated to view your home page should redirect to the login page as desired.

Related

Hiding entire website to visitors on Kentico?

Is it possible to hide an entire website behind a log-in screen? Making the visitor login to see the content. I know there are plugins like this on Wordpress but I am unable to find something for Kentico.
Thanks,
Brian
Yes. At the root of the website (master page) select it. Then go to Properties>Security and in the Access section of that page, select yes for the "Requires authentication" attribute and save the page. This will force the user to the login page you have defined in your web.config OR in your Settings to authenticate first. This will be inherited by default through the rest of the child pages.

Can I have 2 two home pages (authenticated and anonymous) in Orchard CMS?

The "content" section in my "home page" should be a Sign In widget I built, but once signed in I want people to be sent to see a "content" zone that is something they're now permissioned to see. For both pages I want people to be able to just visit my URL without anything after the URL name. (i.e. www.xyz.com) and see different "content" zone whether signed in, or not.
The problem I am facing is that Orchard sets "Authenticated" and "Anonymous" as layers, but what you set on those layers has to be set for every single page on the site. But my "home page" has different stuff happening than other pages on my site.
Is there a way, I can set separate content sections of the home page (i.e. when people just type in the base URL of my site) for both Authenticated and Anonymous?
Thanks.
A URL should correspond to a resource. Having two different resources behind a single URL, with the GET verb, affects SEO negatively, among other nasty effects. One thing you can do however, is redirect your authenticated users, from your home page, to a separate URL.
If you still want to go ahead with this, you can define your own layers that combine the conditions for home and for authenticated: url('~/') and Authenticated and url('~/') and not Authenticated should do the trick.

Redirect URL in Orchard after user login?

How to redirect the page when user logged in Orchard?
I want to redirect to my own module's page with user's credential.
I tried to add a HTML action link in Orchard.Core.Shapes/Views/User.cshtml to redirect to my own moudle, but it doesn't work.
it seems the page doesn't refresh in this approach.
What 's the better way of doing this ?
An action link is not going to redirect, it's just going to create a link in the page. It's not quite clear what you are trying to do. If you just want to change the layout, override the template. If you want to take over controller logic, I'd recommend creating the same route, with higher priority, pointing to your own replacement controller.

Programmatically get the url of a page in liferay

I want to create a link in a portlet so that I can navigate to a different page in the liferay portal. I order to do that I am looking for an API (can be liferay specific) that given a page name, would return it's url (it can be the friendlyURL as well).
Portal pages in Liferay are indeed called Layouts in APIs and DB tables. They're identified by plid field, can be obtained using LayoutLocalServiceUtil and related APIs, and also from some other calls like themeDisplay.getLayout().
However in order to build String containing URL to a page you'll have to concatenate friendly URL of portal, group and layout itself (i.e. /web/guest/home - web is portal URL for public pages, guest is friendly URL of guest group by default and home is friendly URL of home page/layout by default). This can be tricky, as you have to check whether this is a public or private page, etc.
And once you start using virtual hosts with friendly URLs for groups, things change. So this is not a good way.
To avoid manually creating URLs and have URLs that are guaranteed to be correct you should use com.liferay.portal.util.PortalUtil.getLayoutFriendlyURL(Layout layout, ThemeDisplay themeDisplay) a static method of PortalUtil - it'll do all the necessary work for you. Though you also need to provide ThemeDisplay and not only Layout.
The API to access pages in Liferay is the LayoutService. However, page names are not unique in Liferay and furthermore they are internationalized. So you need some unique property for a page to retrieve its url, besides its name.
If you really only have the page name, you can use LayoutLocalServiceUtil.getLayouts(...) to loop over all Layouts and check for some property (in this case its name).
At least in Liferay 6.1.20 one can use 'Link Portlet URLs to Page' to make links proceed to antoher page in your portal. It is under ´look and feel´ menu item of your portlet. For me this works fine.
cheers
try this one for current url
${themeDisplay.getURLCurrent()}
try this one for portal url
${themeDisplay.getPortalURL()}

Static Main Page (login page) on Drupal Install

I am starting to create a site that uses Drupal. One of my requirements is that nobody will see any "real" content until they log in. The home page will basically be a static page with a logo, some basic "this is what the site does" copy, and then a login form. If you don't login, you can then only see some other static pages (faq, legal, privacy, etc...) but you can't use the actual site. Think Facebook's login page, basically just fluff with a login form.
From searching around, I have found 3 different methods for this:
Create a page that is basically separate from the Drupal installation, but then when the form submits, check it against the Drupal DB and then proceed if logged in successfully. This would be done with Apache, maybe an .htaccess file directive to change the first served page.
Use the Front Page extension. I haven't looked at this too extensively, has anyone used it? Pros/Cons?
Somehow finagle the default Druapl "Home Page" functionality to allow this to happen. I would rather not have to do this, unless someone knows that there is an easy way to do this.
One of my requirements is that nobody will see any "real" content until they log in.
There is a permission that users need have in order to access content on Drupal (access content); if anonymous users don't have that permission, then they would not be able to see any content.
Using the module you reported, you can create a different home page for anonymous users.
Solution #1 is not the ideal one as it requires more work for something that can be obtained from inside Drupal. Take in mind that the correct way to access Drupal DB is to use the DB API Drupal comes with.

Resources