You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -32,10 +33,10 @@ protected function configure()
32
33
{
33
34
$this
34
35
->setName('security:encode-password')
35
-
->setDescription('Encode a password.')
36
+
->setDescription('Encodes a password.')
36
37
->addArgument('password', InputArgument::OPTIONAL, 'Enter a password')
37
-
->addArgument('user-class', InputArgument::OPTIONAL, 'Enter the user class configured to find the encoder you need.')
38
-
->addArgument('salt', InputArgument::OPTIONAL, 'Enter the salt you want to use to encode your password.')
38
+
->addOption('user-class', null, InputOption::VALUE_REQUIRED, 'Enter the user class configured to find the encoder you need.', 'Symfony\Component\Security\Core\User\User')
39
+
->addOption('salt', null, InputOption::VALUE_OPTIONAL, 'Enter the salt you want to use to encode your password.')
39
40
->setHelp(<<<EOF
40
41
41
42
The <info>%command.name%</info> command allows to encode a password using encoders
@@ -59,8 +60,10 @@ protected function configure()
59
60
The command allows you to provide your own <comment>salt</comment>. If you don't provide any,
60
61
the command will take care about that for you.
61
62
62
-
You can also use the non interactive way by typing the following command:
- the very simple way is to simply type: <info>php %command.full_name% [password] -n</info>. The salt will be generated
65
+
for you, and the configuration of the <comment>Symfony\Component\Security\Core\User\User</comment> class will be taken to grab the right encoder.
66
+
- You can also provide the salt and the user class by typing: <info>php %command.full_name% [password] --salt=[salt] --user-class=[namespace-class]</info>
64
67
65
68
EOF
66
69
)
@@ -75,8 +78,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
75
78
$this->writeIntroduction($output);
76
79
77
80
$password = $input->getArgument('password');
78
-
$salt = $input->getArgument('salt');
79
-
$userClass = $input->getArgument('user-class');
81
+
$salt = $input->getOption('salt');
82
+
$userClass = $input->getOption('user-class');
80
83
81
84
$helper = $this->getHelper('question');
82
85
@@ -86,13 +89,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
0 commit comments