Permalink
Browse files

Add a reset option

  • Loading branch information...
1 parent f8678b9 commit e4c16f37aa96b6ceb10f28050301fb78f203b0bd @rande rande committed Nov 11, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Command/TwoStepVerificationCommand.php
@@ -28,6 +28,7 @@ public function configure()
{
$this->setName('sonata:user:two-step-verification');
$this->addArgument('username', InputArgument::REQUIRED, 'The username to protect with a two step verification process');
+ $this->addOption('reset', null, InputOption::VALUE_NONE, 'Reset the current two step verification token');
$this->setDescription('Generate a two step verification process to secure an access (Ideal for super admin protection)');
}
@@ -49,7 +50,7 @@ public function execute(InputInterface $input, OutputInterface $output)
throw new \RuntimeException(sprintf('Unable to find the username : %s', $input->getArgument('username')));
}
- if (!$user->getTwoStepVerificationCode()) {
+ if (!$user->getTwoStepVerificationCode() || $input->getOption('reset')) {
$user->setTwoStepVerificationCode($helper->generateSecret());
$manager->updateUser($user);
}

0 comments on commit e4c16f3

Please sign in to comment.