public function findByUsernameAndPassword($email, $password)
 {
     /** @var $user \Application\Entity\WcUser */
     $user = $this->findOneByEmail($email);
     if (!$user) {
         $user = $this->findOneByUsername($email);
     }
     if ($user) {
         if ((new Bcrypt())->verify($password, $user->getPassword())) {
             if ($user->getStatus() == 0) {
                 return FALSE;
             }
             return $user;
         } else {
             if ($this->cryptSenha(['email' => $email, 'password' => $password]) == $user->getPassword()) {
                 $entity = $this->_em->getReference('Application\\Entity\\WcUser', $user->getId());
                 $data['userUpdated'] = $this->_em->getRepository('Application\\Entity\\WcUser')->find($user->getId());
                 $WcUser = new WcUser();
                 $WcUser->setUsername($email);
                 $hydrator = new ClassMethods();
                 $data = ['username' => $email, 'salt' => $WcUser->getSalt(), 'activationKey' => $WcUser->getActivationKey()];
                 $hydrator->hydrate($data, $entity);
                 $this->_em->persist($entity);
                 $this->_em->flush();
                 if ($user->getStatus() == 0) {
                     return FALSE;
                 }
                 return $entity;
             } else {
                 return FALSE;
             }
         }
     } else {
         return FALSE;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getSalt()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getSalt', array());
     return parent::getSalt();
 }