aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-05-15 14:38:07 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-15 14:38:07 +0200
commit9f0957b831622ee577fa7d8f92ec0df6f3a8e274 (patch)
tree362e95af5fc0786e7934e0ab25764d90123bf997 /src/Wallabag/CoreBundle/GuzzleSiteAuthenticator
parent9e2194e9cb55acf0a715e36c33f9f9d8689e0761 (diff)
parent227a1a27f19604d64ffdfee56b4c8fc6b325bee6 (diff)
downloadwallabag-9f0957b831622ee577fa7d8f92ec0df6f3a8e274.tar.gz
wallabag-9f0957b831622ee577fa7d8f92ec0df6f3a8e274.tar.zst
wallabag-9f0957b831622ee577fa7d8f92ec0df6f3a8e274.zip
Merge remote-tracking branch 'origin/master' into 2.4
Diffstat (limited to 'src/Wallabag/CoreBundle/GuzzleSiteAuthenticator')
-rw-r--r--src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
index 90e00c62..c7502bac 100644
--- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
+++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
@@ -62,11 +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 $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); 67
68 return false;
69 }
70
71 $hosts = [$host];
72 // will try to see for a host without the first subdomain (fr.example.org & .example.org)
73 $split = explode('.', $host);
74
75 if (\count($split) > 1) {
76 // remove first subdomain
77 array_shift($split);
78 $hosts[] = '.' . implode('.', $split);
68 } 79 }
69 80
81 $credentials = $this->credentialRepository->findOneByHostsAndUser($hosts, $this->currentUser->getId());
82
70 if (null === $credentials) { 83 if (null === $credentials) {
71 $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); 84 $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]);
72 85