def check_auto_registration(self, trans, login, password, no_password_check=False): """ Checks the username/email & password using auth providers in order. If a match is found, returns the 'auto-register' option for that provider. """ if '@' in login: email = login username = None else: email = None username = login auth_return = { "auto_reg": False, "email": "", "username": "" } for provider, options in self.active_authenticators(email, username, password): if provider is None: log.debug("Unable to find module: %s" % options) else: options['no_password_check'] = no_password_check auth_results = provider.authenticate(email, username, password, options) if auth_results[0] is True: try: auth_return = parse_auth_results(trans, auth_results, options) except Conflict as conflict: log.exception(conflict) raise return auth_return elif auth_results[0] is None: auto_email = str(auth_results[1]).lower() auto_username = str(auth_results[2]).lower() log.debug("Email: %s, Username %s, stopping due to failed non-continue" % (auto_email, auto_username)) break # end authentication (skip rest) return auth_return
def check_auto_registration(self, trans, login, password, no_password_check=False): """ Checks the username/email & password using auth providers in order. If a match is found, returns the 'auto-register' option for that provider. """ if '@' in login: email = login username = None else: email = None username = login auth_return = { "auto_reg": False, "email": "", "username": "" } for provider, options in self.active_authenticators(email, username, password): if provider is None: log.debug("Unable to find module: %s" % options) else: options['no_password_check'] = no_password_check auth_results = provider.authenticate(email, username, password, options) if auth_results[0] is True: try: auth_return = parse_auth_results(trans, auth_results, options) except Conflict: break return auth_return elif auth_results[0] is None: auto_email = str(auth_results[1]).lower() auto_username = str(auth_results[2]).lower() log.debug("Email: %s, Username %s, stopping due to failed non-continue" % (auto_email, auto_username)) break # end authentication (skip rest) return auth_return