Exemple #1
0
    def create_account(account_name, password):
        """ Create a valid account and add it to the database, or None if the
        arguments are invalid. """
        if not ACCOUNT_NAME_RE.match(account_name):
            LOG.debug("Invalid account name.")
            return None

        account = Account( name = account_name.upper()
                         , status = AccountStatus.NOT_READY.value )
        Srp.generate_account_srp_data(account, password)
        account.status = AccountStatus.VALID.value
        account.save()

        AccountDataManager.create_account_data(account)

        return account