Example #1
0
 def get_account(account_name):
     """ Return the account from the database if it exists, or None. """
     try:
         return Account.get(Account.name == account_name)
     except Account.DoesNotExist:
         LOG.warning("No account with that name: " + account_name)
         return None
Example #2
0
 def get_account(account_name):
     """ Return the account from the database if it exists, or None. """
     try:
         return Account.get(Account.name == account_name)
     except Account.DoesNotExist:
         LOG.warning("No account with that name: " + account_name)
         return None
Example #3
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
Example #4
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