Update authenthication code to support multitenants. Replace all remaining instances of hardcoded User model.

This commit is contained in:
Roberto Rosario
2016-03-07 03:08:11 -04:00
parent 6492908c59
commit 8a5a26c0b4
13 changed files with 124 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ class EmailAuthBackend(ModelBackend):
def authenticate(self, email=None, password=None):
UserModel = get_user_model()
try:
user = UserModel.objects.get(email=email)
user = UserModel.on_organization.get(email=email)
if user.check_password(password):
return user
except UserModel.DoesNotExist: