1

My experience is that using .htAccess to password protect a directory, it brings up a modal dialog box. And for some browsers (FF and Chrome) don't show the checkbox for "remember" this password.

Is there a way to that a password protect a directory and have the user fill in the username and password within the web page?

Or, is there a way to force the browser to remember that password?

3 Answers 3

4

Short answer: No

Long answer: The dialog in your browser is opened when the server sends the 401 Not Authorized response code followed by the WWW-Authenticate: Basic realm="insert realm" header. The specs do not include headers to control the dialog behavior.

To display a webpage you need to get a little bit fancier and consult the programming language of your choice.

There is no simple way to achieve what you want with password based authentication

0

Use a web-application-framework.. like Drupal. Then put this at the top:

// initialize Drupal
// TODO: adjust path according to placement of script (might need to change to Drupal directory first)
require './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// check user access rights
// TODO: Adjust to the permission you want to restrict to, e.g. 'access content' or whatever
if (!user_access('administer nodes')) {
  // Insufficient rights, say so
  drupal_access_denied();
  exit(0);
}
// ... call legacy script

FYI: IT changes with each version. Then only allow profiles, or users based on their profile name or userid in that system, or as above, the individual permission. https://stackoverflow.com/questions/2496348/checking-drupal-authentication-from-external-php/2499464#2499464

Then use the authentication modules, interactions, protections etc, already built into that. Takes care of all the heavy lifting and updates to the API.

There are loads: Symfony, Magento, Zend... GIYF..

0

Take a look at the "Auto Auth" Firefox plugin: https://addons.mozilla.org/en-US/firefox/addon/autoauth/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .