3 namespace Wallabag\CoreBundle\Repository
;
5 use Wallabag\CoreBundle\Helper\CryptoProxy
;
8 * SiteCredentialRepository.
10 class SiteCredentialRepository
extends \Doctrine\ORM\EntityRepository
14 public function setCrypto(CryptoProxy
$cryptoProxy)
16 $this->cryptoProxy
= $cryptoProxy;
20 * Retrieve one username/password for the given host and userId.
27 public function findOneByHostAndUser($host, $userId)
29 $res = $this->createQueryBuilder('s')
30 ->select('s.username', 's.password')
31 ->where('s.host = :hostname')->setParameter('hostname', $host)
32 ->andWhere('s.user = :userId')->setParameter('userId', $userId)
35 ->getOneOrNullResult();
41 // decrypt user & password before returning them
42 $res['username'] = $this->cryptoProxy
->decrypt($res['username']);
43 $res['password'] = $this->cryptoProxy
->decrypt($res['password']);