piwigo and apache auth #1231

Open
opened 2026-10-05 00:36:58 +02:00 by adam · 1 comment
Owner

Hi, I don't want to use apache auth to login piwigo, but the contrary.
I want to use piwigo identifiers (in piwigo_users) to identify my users in another app, by apache mysql auth.
My apache config is good, tested with another table (MD5, BCRYT or SHA), but I always get an error with piwigo idents :
AH01617: user Chris: authentication failure for "/video": Password Mismatch
I spent a moment on it, and found that modifying "$portable_hashes" to false did the trick.

--- functions_user.inc.php.orig 2021-05-03 17:59:18.044738074 +0200
+++ functions_user.inc.php      2021-05-13 22:08:51.727449387 +0200
@@ -1000,7 +1000,7 @@
     // We use the portable hash feature from phpass because we can't be sure
     // Piwigo runs on PHP 5.3+ (and won't run on an older version in the
     // future)
-    $pwg_hasher = new PasswordHash(13, true);
+    $pwg_hasher = new PasswordHash(13, false);
   }
 
   return $pwg_hasher->HashPassword($password);

But, it would be better to use a configuration option than modify the code, of course.

Is there a way to do it ? Or is it possible to include an option in the future ?

Hi, I don't want to use apache auth to login piwigo, but the contrary. I want to use piwigo identifiers (in piwigo_users) to identify my users in another app, by apache mysql auth. My apache config is good, tested with another table (MD5, BCRYT or SHA), but I always get an error with piwigo idents : `AH01617: user Chris: authentication failure for "/video": Password Mismatch` I spent a moment on it, and found that modifying "$portable_hashes" to false did the trick. ``` --- functions_user.inc.php.orig 2021-05-03 17:59:18.044738074 +0200 +++ functions_user.inc.php 2021-05-13 22:08:51.727449387 +0200 @@ -1000,7 +1000,7 @@ // We use the portable hash feature from phpass because we can't be sure // Piwigo runs on PHP 5.3+ (and won't run on an older version in the // future) - $pwg_hasher = new PasswordHash(13, true); + $pwg_hasher = new PasswordHash(13, false); } return $pwg_hasher->HashPassword($password); ``` But, it would be better to use a configuration option than modify the code, of course. Is there a way to do it ? Or is it possible to include an option in the future ? <!-- github-sync-id:891348074 -->
Author
Owner

Modifying the code like :

--- functions_user.inc.php.orig 2021-05-03 17:59:18.044738074 +0200
+++ functions_user.inc.php      2021-05-14 16:04:02.315436550 +0200
@@ -1000,7 +1000,7 @@
     // We use the portable hash feature from phpass because we can't be sure
     // Piwigo runs on PHP 5.3+ (and won't run on an older version in the
     // future)
-    $pwg_hasher = new PasswordHash(13, true);
+    $pwg_hasher = new PasswordHash(13, $conf['portable_hashes']);
   }
 
   return $pwg_hasher->HashPassword($password);
@@ -1058,7 +1058,7 @@
     require_once(PHPWG_ROOT_PATH.'include/passwordhash.class.php');
 
     // We use the portable hash feature
-    $pwg_hasher = new PasswordHash(13, true);
+    $pwg_hasher = new PasswordHash(13, $conf['portable_hashes']);
   }
 
   return $pwg_hasher->CheckPassword($password, $hash);

with a configuration option:
$conf['portable_hashes'] = true; (by default, false for my case)
would be perfect.

Modifying the code like : ``` --- functions_user.inc.php.orig 2021-05-03 17:59:18.044738074 +0200 +++ functions_user.inc.php 2021-05-14 16:04:02.315436550 +0200 @@ -1000,7 +1000,7 @@ // We use the portable hash feature from phpass because we can't be sure // Piwigo runs on PHP 5.3+ (and won't run on an older version in the // future) - $pwg_hasher = new PasswordHash(13, true); + $pwg_hasher = new PasswordHash(13, $conf['portable_hashes']); } return $pwg_hasher->HashPassword($password); @@ -1058,7 +1058,7 @@ require_once(PHPWG_ROOT_PATH.'include/passwordhash.class.php'); // We use the portable hash feature - $pwg_hasher = new PasswordHash(13, true); + $pwg_hasher = new PasswordHash(13, $conf['portable_hashes']); } return $pwg_hasher->CheckPassword($password, $hash); ``` with a configuration option: `$conf['portable_hashes'] = true;` (by default, false for my case) would be perfect. <!-- github-comment-id:841269773 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1231