aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-04-27 10:58:26 +0200
committerGitHub <noreply@github.com>2019-04-27 10:58:26 +0200
commitea54c2adb126a77c244c30059c40149754d4dbb7 (patch)
tree7f9fee18f321bef35ed845ce0f921dab2bddc72b /src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
parentbfd69c74e5b4f2ebfcb304b1983bf771c2bb11f7 (diff)
parent35359bd3c67e5b6c6371e2e547a3411ca0a8027b (diff)
downloadwallabag-ea54c2adb126a77c244c30059c40149754d4dbb7.tar.gz
wallabag-ea54c2adb126a77c244c30059c40149754d4dbb7.tar.zst
wallabag-ea54c2adb126a77c244c30059c40149754d4dbb7.zip
Merge pull request #3937 from wallabag/fix/credential-subdomain
Add ability to match many domains for credentials
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
index b2e212a4..aeadd770 100644
--- a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
@@ -19,16 +19,16 @@ class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
19 /** 19 /**
20 * Retrieve one username/password for the given host and userId. 20 * Retrieve one username/password for the given host and userId.
21 * 21 *
22 * @param string $host 22 * @param array $hosts An array of host to look for
23 * @param int $userId 23 * @param int $userId
24 * 24 *
25 * @return array|null 25 * @return array|null
26 */ 26 */
27 public function findOneByHostAndUser($host, $userId) 27 public function findOneByHostsAndUser($hosts, $userId)
28 { 28 {
29 $res = $this->createQueryBuilder('s') 29 $res = $this->createQueryBuilder('s')
30 ->select('s.username', 's.password') 30 ->select('s.username', 's.password')
31 ->where('s.host = :hostname')->setParameter('hostname', $host) 31 ->where('s.host IN (:hosts)')->setParameter('hosts', $hosts)
32 ->andWhere('s.user = :userId')->setParameter('userId', $userId) 32 ->andWhere('s.user = :userId')->setParameter('userId', $userId)
33 ->setMaxResults(1) 33 ->setMaxResults(1)
34 ->getQuery() 34 ->getQuery()