예제 #1
0
    def process_new_users(self, nameop=None, spam_protection=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if not self.validUser(user, new_user):
                continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])
            profile = user['profile']

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, profile, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})

                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu, profile,
                                                         transfer_address,
                                                         nameop=nameop)
                except Exception as e:
                    log.debug(e)
예제 #2
0
    def process_new_users(self, nameop=None, spam_protection=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if not self.validUser(user, new_user):
                continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])
            profile = user['profile']

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, profile, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})

                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu,
                                                         profile,
                                                         transfer_address,
                                                         nameop=nameop)
                except:
                    log.debug(traceback.print_exc())
예제 #3
0
    def process_new_users(self, nameop=None, spam_protection=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if user is None:
                log.debug("No such user, need to remove: %s" % new_user['_id'])
                self.registrations.remove({'_id': new_user['_id']})
                continue

            # for spam protection
            if check_banned_email(user['email']):

                if spam_protection:
                    log.debug("Deleting spam %s, %s" %
                              (user['email'], user['username']))
                    self.users.remove({"email": user['email']})
                else:
                    log.debug("Need to delete %s, %s" %
                              (user['email'], user['username']))
                continue

            # test for minimum name length
            if len(user['username']) < MINIMUM_LENGTH_NAME:
                log.debug("Expensive name %s. Skipping." % user['username'])
                continue

            # test for ignoring names starting with certain patterns
            if ignoreRegistration(user['username'],
                                  IGNORE_NAMES_STARTING_WITH):
                log.debug("Ignoring: %s" % user['username'])
                continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])
            profile = user['profile']

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, profile, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})

                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu,
                                                         profile,
                                                         transfer_address,
                                                         nameop=nameop)
                except Exception as e:
                    log.debug(e)
예제 #4
0
    def process_new_users(self, nameop=None, spam_protection=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if user is None:
                log.debug("No such user, need to remove: %s" % new_user['_id'])
                self.registrations.remove({'_id': new_user['_id']})
                continue

            # for spam protection
            if check_banned_email(user['email']):

                if spam_protection:
                    log.debug("Deleting spam %s, %s" % (user['email'], user['username']))
                    self.users.remove({"email": user['email']})
                else:
                    log.debug("Need to delete %s, %s" % (user['email'], user['username']))
                continue

            # test for minimum name length
            if len(user['username']) < MINIMUM_LENGTH_NAME:
                log.debug("Expensive name %s. Skipping." % user['username'])
                continue

            # test for ignoring names starting with certain patterns
            if ignoreRegistration(user['username'], IGNORE_NAMES_STARTING_WITH):
                log.debug("Ignoring: %s" % user['username'])
                continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])
            profile = user['profile']

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, profile, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})

                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu, profile,
                                                         transfer_address,
                                                         nameop=nameop)
                except Exception as e:
                    log.debug(e)
예제 #5
0
    def process_new_users(self,
                          nameop=None,
                          spam_protection=False,
                          live_delete=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        self.populate_email_list()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if not self.validUser(user, new_user):

                live_delete = False
                if live_delete:
                    log.debug("Removing %s" % user['username'])
                    self.registrations.remove({"user_id": new_user['user_id']})
                continue

            if whiteListedUser(user['email'], user['profile']):
                log.debug("White-listed: %s" % user['email'])
            else:
                log.debug("Not registering: %s" % user['email'])
                #continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])

            data_value = convert_profile_format(user)

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, data_value, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})
                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu,
                                                         data_value,
                                                         transfer_address,
                                                         nameop=nameop)
                except:
                    log.debug(traceback.print_exc())
    def process_new_users(self, nameop=None, spam_protection=False,
                          live_delete=False):
        """
            Process new registrations coming in on the webapp
        """

        counter = 0
        self.registrar_server.reset_flag()

        self.populate_email_list()

        for new_user in self.registrations.find(no_cursor_timeout=True):

            user = get_db_user_from_id(new_user, self.users)

            if not self.validUser(user, new_user):

                live_delete = False
                if live_delete:
                    log.debug("Removing %s" % user['username'])
                    self.registrations.remove({"user_id": new_user['user_id']})
                continue

            if whiteListedUser(user['email'], user['profile']):
                log.debug("White-listed: %s" % user['email'])
            else:
                log.debug("Not registering: %s" % user['email'])
                #continue

            fqu = user['username'] + "." + DEFAULT_NAMESPACE
            transfer_address = nmc_to_btc_address(user['namecoin_address'])

            data_value = convert_profile_format(user)

            log.debug("Processing: %s" % fqu)

            if registrationComplete(fqu, data_value, transfer_address):
                log.debug("Registration complete %s. Removing." % fqu)
                self.registrations.remove({"user_id": new_user['user_id']})
                refresh_resolver(user['username'])
            else:
                try:
                    self.registrar_server.process_nameop(fqu, data_value,
                                                         transfer_address,
                                                         nameop=nameop)
                except:
                    log.debug(traceback.print_exc())