Password protect login?

I am running version 1.12.6 and am trying to password protect the login form. The form is accessed from www.example.com/login but of course there is no directory called "login".

I thought the file may have been at public_html/actions/login.php and created a .htpassword file in my root folder, one level above public_html. I then added this to the site .htaccess file:

# Password protect Login Page
AuthUserFile /home/mysite/.htpassword
AuthName "Secure Login"
AuthType Basic
<files /actions/login.php>
require valid-user
</files>

However, it had no effect. I also tried making a separate .htaccess file and putting it in the "actions" directory, but that didn't work either.

Does anyone know the file that is called, and where it is located?

If it can't be done this way, does anyone know a way it can?

  • Thanks for replying Matt. I don't understand how your plugin would work with what I am trying to do. It is about RSS?

    What I want is a password protection that kicks in when someone enters example.com/login and the username and password would be the same for every user. They would then be passed to the normal login form.

    Basically the same as you would normally use in cPanel for protecting a directory, except it would be protecting just the file that calls the login form. Hence the "actions/login.php" entry I tried to use.

    Hope this makes sense.

  • Yes, that's what my plugin does, but it does it for rss feeds.  The lines I linked to you show how to do it in php.  So you could make a plugin that protects the login form by using the 'route', 'login' plugin hook and sending auth headers if necessary.  You can hard code the username/password for those headers, or have them in a config file somewhere or whatever you want.

  • Oh okay. I'm afraid it's all double-dutch to me. I'll try to see if I can understand what you mean, but I doubt I will.

    I couldn't even figure out how to install elgg, and had to let Installatron do it. Normally I have no problems with CMS software, but elgg is a mystery to me. I have it working fine, with many plugins installed already, but trying to modify anything manually is extremely frustrating and hard to achieve.

    The platform does what I wanted to do for my website, so I am happy with using elgg. I guess I will just have to work with what I have, and accept that mods are best left to people who know what they're doing.