'Checks the username/email & password using auth providers in order.
If a match is found, returns the \'auto-register\' option for that provider.'

def check_auto_registration(self, trans, login, password):

    if ('@' in login):
        email = login
        username = None
    else:
        email = None
        username = login
    for (provider, options) in self.active_authenticators(email, username, password):
        if (provider is None):
            log.debug(('Unable    to    find    module:    %s' % options))
        else:
            (auth_result, auto_email, auto_username) = provider.authenticate(email, username, password, options)
            auto_email = str(auto_email).lower()
            auto_username = str(auto_username).lower()
            if (auth_result is True):
                if (validate_publicname(trans, auto_username) != ''):
                    i = 1
                    while (i <= 10):
                        if (validate_publicname(trans, ('%s-%i' % (auto_username, i))) == ''):
                            auto_username = ('%s-%i' % (auto_username, i))
                            break
                        i += 1
                    else:
                        break
                log.debug(('Email:    %s,    auto-register    with    username:    %s' % (auto_email, auto_username)))
                return (_get_bool(options, 'auto-register', False), auto_email, auto_username)
            elif (auth_result is None):
                log.debug(('Email:    %s,    Username    %s,    stopping    due    to    failed    non-continue' % (auto_email, auto_username)))
                break
    return (False, '', '')
