Example #1
0
def get_system_user():
    account = AccountPrototype.get_by_nick(accounts_settings.SYSTEM_USER_NICK)
    if account: return account

    register_result, account_id, bundle_id = register_user(accounts_settings.SYSTEM_USER_NICK, # pylint: disable=W0612
                                                           email=project_settings.EMAIL_NOREPLY,
                                                           password=generate_password(len_=accounts_settings.RESET_PASSWORD_LENGTH))

    account = AccountPrototype.get_by_id(account_id)
    account._model.active_end_at = datetime.datetime.fromtimestamp(0)
    account.save()

    return account
Example #2
0
    def process(self, logger):

        new_password = generate_password(len_=accounts_settings.RESET_PASSWORD_LENGTH)

        task = ChangeCredentialsTaskPrototype.create(account=self.account,
                                                     new_password=new_password)

        # here postponed task is created, but we will not wait for it processed, just  display new password
        task.process(logger)

        self._model.is_processed = True
        self.save()

        return new_password
Example #3
0
    def process(self, logger):

        new_password = generate_password(len_=accounts_settings.RESET_PASSWORD_LENGTH)

        task = ChangeCredentialsTaskPrototype.create(account=self.account,
                                                     new_password=new_password)

        # here postponed task is created, but we will not wait for it processed, just  display new password
        task.process(logger)

        self._model.is_processed = True
        self.save()

        return new_password