Refactor the users class into their own files, add a common base class for federated users and add a verify_credentials method which only does the verification, without the linking. We use this in the superuser verification pass

This commit is contained in:
Joseph Schorr 2015-07-20 11:39:59 -04:00
parent 1245385808
commit 33b54218cc
13 changed files with 541 additions and 495 deletions

18
data/users/database.py Normal file
View file

@ -0,0 +1,18 @@
from data import model
class DatabaseUsers(object):
def verify_credentials(self, username_or_email, password):
""" Simply delegate to the model implementation. """
result = model.user.verify_user(username_or_email, password)
if not result:
return (None, 'Invalid Username or Password')
return (result, None)
def verify_and_link_user(self, username_or_email, password):
""" Simply delegate to the model implementation. """
return self.verify_credentials(username_or_email, password)
def confirm_existing_user(self, username, password):
return self.verify_credentials(username, password)