php-apache2-basic-auth-manager icon indicating copy to clipboard operation
php-apache2-basic-auth-manager copied to clipboard

Adding User/Group breaks .htpasswd

Open rsuarez82 opened this issue 7 years ago • 2 comments

Whenever you add a user or a group, the .htpasswd file gets reset. So far so good.

But (!) whenever the Service class writes it puts a whitespace in front of the password which renders the file unusable.

Works: test:$apr1$wG4BORKw$6ylmzwwbtgDvH7l13Y5QH1

Fails: test: $apr1$wG4BORKw$6ylmzwwbtgDvH7l13Y5QH1

This is easily fixed by changing the method "formatHT" in the user & group class, so that the return string does not contain a whitespace after double-point:

    /**
     * Format to HT write
     * @return string
     */
    public function formatHT()
    {
        return "{$this->getUsername()}:{$this->getHash()}";
    }

Would've filed a Pull request, but haven't done so in quite a while. ;)

rsuarez82 avatar Apr 03 '17 10:04 rsuarez82

This is not an issue with rafaelgou/php-apache2-basic-auth-manager but an issue with the rafaelgou/php-apache2-basic-auth project and should be moved to the issue queue of that project.

The code referred to is in the rafaelgou/php-apache2-basic-auth project.

frederickjh avatar Dec 18 '17 19:12 frederickjh