/**
  * Check if code is a valid backup code
  *
  * @param  \Scheb\TwoFactorBundle\Model\BackupCodeInterface $user
  * @param  string                                           $code
  * @return bool
  */
 public function checkCode(BackupCodeInterface $user, $code)
 {
     if ($user->isBackupCode($code)) {
         $user->invalidateBackupCode($code);
         $this->persister->persist($user);
         return true;
     }
     return false;
 }
 protected function disable2FA(BackupCodeInterface $person, $form)
 {
     $em = $this->getDoctrine()->getManager();
     $backupCodes = $person->getBackupCodes();
     foreach ($backupCodes as $backupCode) {
         $em->remove($backupCode);
     }
     $person->setGoogleAuthenticatorSecret(null);
     $em->persist($person);
     $em->flush();
 }