mirror of
https://github.com/r4sas/recastin-panel
synced 2025-08-26 13:31:47 +00:00
Validate mail address on user creation
This commit is contained in:
parent
0979290057
commit
d91d394af6
@ -10,7 +10,6 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
|
||||
use Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
|
||||
/**
|
||||
@ -53,7 +52,17 @@ class CreateUserCommand extends Command implements ContainerAwareInterface
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
$username = $io->ask('What should be the username?');
|
||||
|
||||
do {
|
||||
$email = $io->ask('What should be the email?');
|
||||
$valid = (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
|
||||
|
||||
if (!$valid) {
|
||||
$io->error('Invalid email address');
|
||||
}
|
||||
|
||||
} while(!$valid);
|
||||
|
||||
$password = $io->askHidden('What should be the password?');
|
||||
|
||||
$user = new User();
|
||||
|
@ -297,6 +297,6 @@ class Streams extends Controller
|
||||
*/
|
||||
private function isValidString(?string $string)
|
||||
{
|
||||
return preg_match('/^[a-z|A-Z|a-z|A-Z|0-9|.|\-|_|]+$/', $string);
|
||||
return preg_match('/^[a-z|A-Z|a-z|A-Z|0-9|.|\-|_|\{|\}|\:|\/]+$/', $string);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user