Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling user registration does not work #3

Closed
vStone opened this issue Sep 26, 2014 · 2 comments
Closed

Disabling user registration does not work #3

vStone opened this issue Sep 26, 2014 · 2 comments

Comments

@vStone
Copy link
Contributor

vStone commented Sep 26, 2014

config:

auth:
  htpasswd:
    file: /data/sinopia/htpasswd
    # Maximum amount of users allowed to register, defaults to "+inf".
    # You can set this to 0 to disable registration.
    max_users: 0

adduser:

[vagrant@nodejs ~]$ npm adduser
Username: xxx
Password: 
Email: (this IS public) xxx@xxx.be

Result:

tail -n1 /data/sinopia/htpasswd
xxx:$6$enUFPJHfZdQUxA==$nRt6buDmJKbGeLIIrX50xVrZHNfv2y3SxVBscLsvdHs.XMHdPjr3sDN/2hFTYUf5j3.Q0R4daxt79tyw9Phul0:autocreated 2014-09-26T11:11:01.807Z
@vStone
Copy link
Contributor Author

vStone commented Sep 30, 2014

I've narrowed this down to https://github.com/rlidwka/sinopia-htpasswd/blob/master/index.js#L21

self._maxusers = self._config.max_users || self._sinopia_config.max_users

if self._config.max_users is set to 0, this will almost always end up being undefined

@rlidwka
Copy link
Owner

rlidwka commented Oct 2, 2014

Thanks for finding it.

But it is not a documentation bug. If you set "max_users" to 0, logically it should not allow more than a 0 users. Thus, it should disable registration. I think documentation is right here, and the issue needs to be fixed in the code itself.

Fixed in 77a8fe3 , added a test in c22a8cd , please check that.

rlidwka added a commit that referenced this issue Oct 17, 2014
Fixes #3: 0 is false in logical expressions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants