Make datastore find_user method accept different params so a user can be retrieved by other such things such as a confirmation token

This commit is contained in:
Matt Wright
2012-05-11 13:57:35 -04:00
parent 2b587f7047
commit 1a8e6f5cb6
6 changed files with 56 additions and 31 deletions
+2 -2
View File
@@ -337,7 +337,7 @@ class AuthenticationProvider(object):
return self.do_authenticate(form.email.data, form.password.data)
def do_authenticate(self, user_identifier, password):
def do_authenticate(self, email, password):
"""Returns the authenticated user if authentication is successfull. If
authentication fails an appropriate error is raised
@@ -345,7 +345,7 @@ class AuthenticationProvider(object):
:param password: The user's unencrypted password
"""
try:
user = current_app.security.datastore.find_user(user_identifier)
user = current_app.security.datastore.find_user(email=email)
except AttributeError, e:
self.auth_error("Could not find user datastore: %s" % e)
except exceptions.UserNotFoundError, e: