From fffc9a4eb7c5899891d315eb9ddf4bd42c7fd117 Mon Sep 17 00:00:00 2001 From: Riccardo Tempesta Date: Wed, 23 Aug 2017 18:35:01 +0200 Subject: [PATCH] FIX for wrong domain name while using base install subpaths --- Model/Provider/Engine/U2fKey.php | 9 ++++++++- etc/module.xml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Model/Provider/Engine/U2fKey.php b/Model/Provider/Engine/U2fKey.php index fe6e58f..e91a17d 100644 --- a/Model/Provider/Engine/U2fKey.php +++ b/Model/Provider/Engine/U2fKey.php @@ -198,7 +198,14 @@ protected function getU2f() /** @var Store $store */ $store = $this->storeManager->getStore(Store::ADMIN_CODE); + $baseUrl = $store->getBaseUrl(); + if (preg_match('/^(https?:\/\/.+?)\//', $baseUrl, $matches)) { + $domain = $matches[1]; + } else { + throw new LocalizedException(__('Unexpected error while parsing domain name')); + } + /** @var U2F $u2f */ - return new U2F(trim($store->getBaseUrl(), '/')); + return new U2F($domain); } } diff --git a/etc/module.xml b/etc/module.xml index c6d60f6..060aa90 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -21,7 +21,7 @@ --> - +