core-bundle/src/Command/UserPasswordCommand.php
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        if (null === $input->getArgument('username') || null === $input->getOption('password')) {
            return 1;
        }

        $hash = $this->validateAndHashPassword($input->getOption('password'));

        $affected = $this->connection->update(
            'tl_user',
            ['password' => $hash],
            ['username' => $input->getArgument('username')]
        );

        if (0 === $affected) {
            throw new InvalidArgumentException(sprintf('Invalid username: %s', $input->getArgument('username')));
        }

        $io = new SymfonyStyle($input, $output);
        $io->success('The password has been changed successfully.');

        return 0;
    }
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        if (null === $input->getArgument('username') || null === $input->getOption('password')) {
            return 1;
        }

        $hash = $this->validateAndHashPassword($input->getOption('password'));

        $affected = $this->connection->update(
            'tl_user',
            ['password' => $hash],
            ['username' => $input->getArgument('username')]
        );

        if (0 === $affected) {
            throw new InvalidArgumentException(sprintf('Invalid username: %s', $input->getArgument('username')));
        }

        $io = new SymfonyStyle($input, $output);
        $io->success('The password has been changed successfully.');

        return 0;
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) : int { if ( null === $ input -> getArgument ( 'username' ) || null === $ input -> getOption ( 'password' ) ) { return 1 ; } $ hash = $ this -> validateAndHashPassword ( $ input -> getOption ( 'password' ) ) ; $ affected = $ this -> connection -> update ( 'tl_user' , [ 'password' => $ hash ] , [ 'username' => $ input -> getArgument ( 'username' ) ] ) ; if ( 0 === $ affected ) { throw new InvalidArgumentException ( sprintf ( 'Invalid username: %s' , $ input -> getArgument ( 'username' ) ) ) ; } $ io = new SymfonyStyle ( $ input , $ output ) ; $ io -> success ( 'The password has been changed successfully.' ) ; return 0 ; }
{@inheritdoc}
{