Added a try/except for importing pam with logging an error and updated README to note that when using pam you need to install pam module

This commit is contained in:
Craig Davis 2016-06-24 11:46:36 -05:00
parent 0bf002437f
commit a10c60aa91
2 changed files with 8 additions and 3 deletions

View File

@ -111,7 +111,8 @@ Currently only password-protected uploads are supported!
bottle.run(app=app, host=config.host, port=config.port, server=config.server)
.. Note::
If you are getting authentication even with incorrect credentials please check your PAM configuration.
- If you are getting authentication even with incorrect credentials please check your PAM configuration.
- This requires installing pam module `pip install pam`
#. On client-side, edit or create a `~/.pypirc` file with a similar content::

View File

@ -92,8 +92,12 @@ def auth_by_htpasswd_file(htPsswdFile, username, password):
def auth_by_pam(username, password):
try:
import pam
return pam.authenticate(username, password)
except ImportError as error:
log.error('PAM module not found. Please install pam module')
return False
mimetypes.add_type("application/octet-stream", ".egg")