Password protect website?

duvien - April 3, 2008 - 11:43

Does anyone know how i can password protect the all website (like an Intranet)?

I'm creating a wedding website for a friend and they prefer it to be private and only viewable by family and friends.

thank you,

Why not just enable approval

pobster - April 3, 2008 - 11:46

Why not just enable approval for user registrations and only allow authenticated users access to content? Of course you can password protect, but isn't this an easier/ cleaner way to achieve the same end?

Pobster

What they wanted was a login

duvien - April 3, 2008 - 11:59

What they wanted was a login box on the frontpage so only the frontpage is accessible by public and all other pages will be protected. Does that make sense?

thanks,

Yeah that's the effect you'd

pobster - April 3, 2008 - 12:22

Yeah that's the effect you'd have, although you might have to use "Views" or "Splash" to show a generic entry/ frontpage - I'm not entirely sure about that. But yep, they'd see a login box and when they're logged in they'd be able to access all the content. If they're not logged in, Drupal would issue an access denied message for any page anyone tries to look at bar the frontpage.

edit: Thinking about it, I think there's a option in admin/settings/site-information for 'Default Front Page', if you assign this to a specific node of a node type you've used nowhere else (say a story node and everything else is page node or whatever) you could then allow unauthenticated users to view this nodetype but nothing else, that'd limit them to the front page only. ...Maybe Views would be neater ;o) It's just more complicated!

Pobster

This is exactly what pobster

9ls - April 3, 2008 - 12:24

This is exactly what pobster says.

You have to:

  • Disable ability for users to create own accounts (in "User settings")
  • Disable all permissions for anonymous users (in "Permissions").
  • If you want to use pictures you should use the Private download method in "File System" and use a directory not accessible for the web.
    If you want a better looking front page you can use the Front Page module (http://drupal.org/project/front).

    9ls

    Oops, yeah sorry I meant

    pobster - April 3, 2008 - 12:25

    Oops, yeah sorry I meant "front page" module, not "splash" - that was just from memory ;o) Don't even know if it exists!

    Pobster

    The above suggestion will allow you to do exactly that.

    gareth_w - April 3, 2008 - 12:24

    Just configure so that the anonymous user has no permissions to see anything other than the homepage.

    Thanks to all your replies.

    duvien - April 3, 2008 - 14:00

    Thanks to all your replies. Authenticed users for some reason where still not able to view the frontpage after logging in.

    So i went ahead and used node_privacy_byrole module and this seems to have done the trick. It's a lot of hassle because for each page i had to set the permissions, however, it's a very small site consisting of 4 - 5 pages so not a problem.

    I've also setup role for web editor as the lovely soon to be married couples will need to update their own contents.

    I'm not using frontpage module as i thought it would be quicker to override the template, using something like page-front.tpl.php

    My final biggest problem is that all authenticated users should only have access to contents only and nothing else. How can i hide the navigation menu from all authenticated users and only present this to web editors and admin?

    thanks,

    @9ls -

    If you want to use pictures you should use the Private download method in "File System" and use a directory not accessible for the web.

    i know how to set it to private downloads but how do you specify a directory not accessible to the web and still link images to the webpage?

    Sorry, i just had to set the

    duvien - April 3, 2008 - 14:07

    Sorry, i just had to set the navigation menu in block to only show for web editors. But the problem now is that it isn't showing up for admin user.

    thanks,

    Generally you can specify

    pobster - April 3, 2008 - 14:30

    Generally you can specify anything below htdocs (eg. /var/www/localhost/files) it depends on your hosting. You'd link to pictures by linking through Drupals file serving mechanism eg. system/files/images/crystal_castles.jpg (the system/files bit is the 'magic').

    If by 'admin' user you mean your superuser user -1 then well, it should be displaying it? Superuser doesn't require any permissions as it gains *all* permissions by being superuser.

    Pobster

    I'm using Drupal 6 and the

    duvien - April 3, 2008 - 14:42

    I'm using Drupal 6 and the file path has changed. Everything is stored in /sites/default/files/

    What you are saying is that if i create a folder called files in /home/{username}/ which is below my webroot folder and then set it to private in Drupal.

    Drupal should just know where this folder called file is? Do i also have to change the File system path: to /home/{username}/files ???

    As for nav menu not showing up, yes, i would have thought that was the case, admin (superuser -1) i was referring to can't see the navigation menu block?

    thanks,

    EDITED:

    Just realised i had to also add web editor role to admin user before it will work. This shouldn't be right as admin is the first user created and should inherited everything from all the roles that are created. Very odd access premission Drupal has?

    Errr no... The file path

    pobster - April 3, 2008 - 15:52

    Errr no... The file path hasn't changed, you could always do that before but it's still a 'user set' variable (the file path) it can be anywhere. /tmp if you really felt like it and don't auto clear your tmp folder... So yeah, set it wherever - obviously keeping it within eg. /var/www/drupal/files is a good idea to keep all the files together in a nice neat place. That's entirely why the default for file paths has become /sites/*/files just for neatness. Of course Drupal won't be able to auto-detect this value it's not magic! You'd have to set it yourself and obviously as it's outside the directories set for your Drupal installation only the private method will be able to 'serve' files from it. Note as files are being served and not just displayed from where they are that this will have a huge impact on page loading times.

    As for the other thing, that is weird... Maybe it's a bug? I'd even consider making a bug report for it to core? It's definitely not right.

    Pobster

    Okay, i think i'm getting

    duvien - April 3, 2008 - 18:55

    Okay, i think i'm getting what your trying to explain about the file path, however, how would someone add an image to content and link to an image that is not in the webroot path?

    I don't use any editor (like TinyMCE or FCK) and usually just type it out by hand, find it quicker. However, it would mean when typing:

    < img src="{file path???}" alt ="" />

    I'm at a lost there?

    thanks,

    I put that above... You use

    pobster - April 3, 2008 - 19:13

    I put that above... You use system/files (system/{file path} I mean, or ?q=system/files if you're not using clean urls - remember the file is being SERVED you're not linking to it directly, i.e. there's a piece of code which passes the file to you rather than the file being displayed from where it is).

    Pobster

    Front page module

    9ls - April 3, 2008 - 23:00

    It is very easy to use the front page module.

    You can set up different front pages for every role, or redirect to any spesific node.
    You have to fill in the wanted front page for your roles (admin/settings/front) and fill in "front_page" in the "Activate your front_page settings" field. That should be it.

     
     

    Drupal is a registered trademark of Dries Buytaert.