aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php')
-rw-r--r--src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
index 90e00c62..718441bd 100644
--- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
+++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
@@ -64,7 +64,17 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
64 64
65 $credentials = null; 65 $credentials = null;
66 if ($this->currentUser) { 66 if ($this->currentUser) {
67 $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); 67 $hosts = [$host];
68 // will try to see for a host without the first subdomain (fr.example.org & .example.org)
69 $split = explode('.', $host);
70
71 if (\count($split) > 1) {
72 // remove first subdomain
73 array_shift($split);
74 $hosts[] = '.' . implode('.', $split);
75 }
76
77 $credentials = $this->credentialRepository->findOneByHostsAndUser($hosts, $this->currentUser->getId());
68 } 78 }
69 79
70 if (null === $credentials) { 80 if (null === $credentials) {