def add_arguments(self, parser):
        parser.add_argument(
            '--add-to-supercreate-group',
            action='store_true',
            dest='add_to_supercreate_group',
            default=False,
            help='Assign the user to the Accounts:SuperCreate group',
        )

        parser.add_argument(
            '--save-api-credentials',
            type=str,
            dest='save_api_credentials',
            default=False,
            help='Saves the generated API credentials into a JSON file',
        )

        parser.add_argument(
            '--hostname',
            type=str,
            dest='hostname',
            default=None,
            help='Sets the hostname of the credentials JSON file',
        )

        parser.add_argument(
            '--fxa_id',
            type=str,
            dest='fxa_id',
            default=None,
            help='Adds an fxa id to the superuser',
        )

        CreateSuperUserCommand.add_arguments(self, parser)
Ejemplo n.º 2
0
    def add_arguments(self, parser):
        parser.add_argument(
            '--add-to-supercreate-group',
            action='store_true',
            dest='add_to_supercreate_group',
            default=False,
            help='Assign the user to the Accounts:SuperCreate group',
        )

        parser.add_argument(
            '--hostname',
            type=str,
            dest='hostname',
            default=None,
            help='Sets the hostname of the credentials JSON file',
        )

        parser.add_argument(
            '--fxa_id',
            type=str,
            dest='fxa_id',
            default=None,
            help='Adds an fxa id to the superuser',
        )

        CreateSuperUserCommand.add_arguments(self, parser)
Ejemplo n.º 3
0
    def add_arguments(self, parser):
        parser.add_argument(
            '--add-to-supercreate-group',
            action='store_true',
            dest='add_to_supercreate_group',
            default=False,
            help='Assign the user to the Accounts:SuperCreate group',
        )

        parser.add_argument(
            '--save-api-credentials',
            type=str,
            dest='save_api_credentials',
            default=False,
            help='Saves the generated API credentials into a JSON file',
        )

        parser.add_argument(
            '--hostname',
            type=str,
            dest='hostname',
            default=False,
            help='Sets the hostname of the credentials JSON file',
        )

        CreateSuperUserCommand.add_arguments(self, parser)
Ejemplo n.º 4
0
    def execute(self, args):
        self._prepare(args)

        from django.contrib.auth.management.commands.changepassword import Command
        Command().handle(args.username)

        self._ok(args)
Ejemplo n.º 5
0
    def execute(self, args):

        # stdlib
        import sys
        from traceback import format_exc

        # Django
        from django.contrib.auth.management.commands.createsuperuser import Command
        self.reset_logger(args, True)

        Command.stdout = CreateUser._FakeStdout(self.logger)
        Command.stdin = CreateUser._FakeStdin()

        options = {
            'verbosity': 0
        } if self.is_interactive else {
            'username': self.args.username,
            'email': self.args.email,
            'verbosity': 0
        }

        try:
            Command().handle(interactive=self.is_interactive, **options)
        except Exception:
            self.logger.error('Could not create the user, details: `%s`',
                              format_exc())
            sys.exit(self.SYS_ERROR.INVALID_INPUT)
        else:
            self._ok(args)
Ejemplo n.º 6
0
    def execute(self, args):
        self._prepare(args)

        from django.contrib.auth.management.commands.createsuperuser import Command
        Command.stdout = CreateUser._FakeStdout(self.logger)
        Command().handle(interactive=True)

        self._ok(args)
Ejemplo n.º 7
0
    def execute(self, args):

        from django.contrib.auth.management.commands.createsuperuser import Command
        Command.stdout = CreateUser._FakeStdout(self.logger)

        options = {} if self.is_interactive else {'username':self.args.username, 'email':self.args.email}

        try:
            Command().handle(interactive=self.is_interactive, **options)
            UpdatePassword(args).execute(args, called_from_wrapper=True)
        except Exception, e:
            self.logger.error('Could not create the user, details: `%s`', e.message)
            sys.exit(self.SYS_ERROR.INVALID_INPUT)