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

MongoDBBackend - Addition of username/password auth #68

Merged
merged 1 commit into from Jun 21, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion cork/mongodb_backend.py
Expand Up @@ -136,10 +136,12 @@ def __getitem__(self, key_val):


class MongoDBBackend(Backend):
def __init__(self, db_name='cork', hostname='localhost', port=27017, initialize=False):
def __init__(self, db_name='cork', hostname='localhost', port=27017, initialize=False, username=None, password=None):
"""Initialize MongoDB Backend"""
connection = MongoClient(host=hostname, port=port)
db = connection[db_name]
if username and password:
db.authenticate(username, password)
self.users = MongoMultiValueTable('users', 'login', db.users)
self.pending_registrations = MongoMultiValueTable(
'pending_registrations',
Expand Down