<commit_before><?php
namespace Criterion\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class UserPasswordCommand extends Command
{
    protected function configure()
    {
        $this
            ->setName('user:password')
            ->setDescription('Changed a user password')
            ->addArgument(
                'username',
                InputArgument::REQUIRED,
                'Username'
            )
            ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {

        $username = trim(strtolower($input->getArgument('username')));

        // Prompt for password
        $dialog = $this->getHelperSet()->get('dialog');
        $password = $dialog->askHiddenResponse(
            $output,
            'Enter new password: '
        );
        if (! $password) {
            $output->writeln('<error>Cannot set a blank password</error>');
            exit;
        }

        // Check if user exists
        $user = $this->getApplication()->db->selectCollection('users')->findOne(array(
            '_id' => $username
        ));
        if (! $user){
            $output->writeln('<error>Could not find user</error>');
            return false;
        }

        // Create User
        $this->getApplication()->db->selectCollection('users')->update(array(
            '_id' => $username
        ), array(
            '$set' => array(
                'password' => password_hash($password, PASSWORD_BCRYPT, array('cost' => 12))
            )
        ));
        $output->writeln('<info>Password updated for ' . $username  . '</info>');

    }
}<commit_msg>Fix comments in user:password<commit_after><?php
namespace Criterion\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class UserPasswordCommand extends Command
{
    protected function configure()
    {
        $this
            ->setName('user:password')
            ->setDescription('Changed a user password')
            ->addArgument(
                'username',
                InputArgument::REQUIRED,
                'Username'
            )
            ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {

        $username = trim(strtolower($input->getArgument('username')));

        // Prompt for password
        $dialog = $this->getHelperSet()->get('dialog');
        $password = $dialog->askHiddenResponse(
            $output,
            'Enter new password: '
        );
        if (! $password) {
            $output->writeln('<error>Cannot set a blank password</error>');
            exit;
        }

        // Check if user exists
        $user = $this->getApplication()->db->selectCollection('users')->findOne(array(
            '_id' => $username
        ));
        if (! $user){
            $output->writeln('<error>Could not find user</error>');
            return false;
        }

        // Change the users password
        $this->getApplication()->db->selectCollection('users')->update(array(
            '_id' => $username
        ), array(
            '$set' => array(
                'password' => password_hash($password, PASSWORD_BCRYPT, array('cost' => 12))
            )
        ));
        $output->writeln('<info>Password updated for ' . $username  . '</info>');

    }
}
{'fraction_non_alphanumeric': 0.13736559139784946, 'fraction_numerical': 0.001075268817204301, 'mean_word_length': 2.1112040133779266, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7482879', 'n_tokens_mistral': 968, 'n_tokens_neox': 942, 'n_words': 187}