diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator')
-rw-r--r-- | src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 718441bd..c7502bac 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php | |||
@@ -62,21 +62,24 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder | |||
62 | $host = substr($host, 4); | 62 | $host = substr($host, 4); |
63 | } | 63 | } |
64 | 64 | ||
65 | $credentials = null; | 65 | if (!$this->currentUser) { |
66 | if ($this->currentUser) { | 66 | $this->logger->debug('Auth: no current user defined.'); |
67 | $hosts = [$host]; | 67 | |
68 | // will try to see for a host without the first subdomain (fr.example.org & .example.org) | 68 | return false; |
69 | $split = explode('.', $host); | 69 | } |
70 | 70 | ||
71 | if (\count($split) > 1) { | 71 | $hosts = [$host]; |
72 | // remove first subdomain | 72 | // will try to see for a host without the first subdomain (fr.example.org & .example.org) |
73 | array_shift($split); | 73 | $split = explode('.', $host); |
74 | $hosts[] = '.' . implode('.', $split); | ||
75 | } | ||
76 | 74 | ||
77 | $credentials = $this->credentialRepository->findOneByHostsAndUser($hosts, $this->currentUser->getId()); | 75 | if (\count($split) > 1) { |
76 | // remove first subdomain | ||
77 | array_shift($split); | ||
78 | $hosts[] = '.' . implode('.', $split); | ||
78 | } | 79 | } |
79 | 80 | ||
81 | $credentials = $this->credentialRepository->findOneByHostsAndUser($hosts, $this->currentUser->getId()); | ||
82 | |||
80 | if (null === $credentials) { | 83 | if (null === $credentials) { |
81 | $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); | 84 | $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); |
82 | 85 | ||