|
23 | 23 | use Symfony\Component\Console\Command\Command;
|
24 | 24 | use Symfony\Component\Console\Input\InputArgument;
|
25 | 25 | use Symfony\Component\Console\Input\InputInterface;
|
26 |
| -use Symfony\Component\Console\Question\Question; |
27 | 26 | use SymfonyCasts\Bundle\ResetPassword\SymfonyCastsResetPasswordBundle;
|
28 | 27 |
|
29 | 28 | class MakeResetPassword extends AbstractMaker
|
@@ -83,21 +82,12 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
|
83 | 82 | $emailText[] = 'You can change these later after the templates have been generated.';
|
84 | 83 | $io->text($emailText);
|
85 | 84 |
|
86 |
| - $emailAddressQuestion = new Question( 'What email address will be used to send reset confirmations? I.e. [email protected]'); |
87 |
| - $emailAddressQuestion->setValidator( |
88 |
| - static function ($answer) { |
89 |
| - // @TODO - In maker-bundle PR, introduce new native Validator::emailAddress()... |
90 |
| - $validatedAnswer = filter_var($answer, FILTER_VALIDATE_EMAIL); |
91 |
| - |
92 |
| - if (!$validatedAnswer) { |
93 |
| - throw new RuntimeCommandException(sprintf('"%s" is not a valid email address.', $answer)); |
94 |
| - } |
95 |
| - |
96 |
| - return $validatedAnswer; |
97 |
| - } |
98 |
| - ); |
| 85 | + $input->setArgument('from-email-address', $io->ask( |
| 86 | + 'What email address will be used to send reset confirmations? I.e. [email protected]', |
| 87 | + null, |
| 88 | + [Validator::class, 'validateEmailAddress'] |
| 89 | + )); |
99 | 90 |
|
100 |
| - $input->setArgument('from-email-address', $io->askQuestion($emailAddressQuestion)); |
101 | 91 | $input->setArgument('from-email-name', $io->ask(
|
102 | 92 | 'What name will be associated with the email address used to send password reset confirmations? I.e. John Doe or Your Company, LLC.',
|
103 | 93 | null,
|
|
0 commit comments