Skip to content

Commit c183e94

Browse files
author
websharp
authored
Merge pull request #196 from websharp/master
Magento 2.4 upgrade finishing
2 parents a2464d6 + fea825f commit c183e94

File tree

15 files changed

+426
-305
lines changed

15 files changed

+426
-305
lines changed

Block/Adminhtml/Manage/Create.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function getBackUrl()
6363
}
6464

6565
/**
66+
* @return void
6667
*/
6768
protected function updateButtonControls()
6869
{

Changelog.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5+
## 4.1.0
6+
7+
### Added
8+
9+
- [#191](https://github.com/bitExpert/magento2-force-login/pull/191) Added support for Magento 2.4
10+
- [#187](https://github.com/bitExpert/magento2-force-login/pull/187) Skip dynamic asset request
11+
- [#186](https://github.com/bitExpert/magento2-force-login/pull/186) Fixed registration redirect
12+
13+
### Deprecated
14+
15+
- Nothing.
16+
17+
### Removed
18+
19+
- Nothing.
20+
21+
### Fixed
22+
23+
- [#192](https://github.com/bitExpert/magento2-force-login/issues/192) force login in store redirects to default login
24+
- [#180](https://github.com/bitExpert/magento2-force-login/issues/180) Customers get whoops.... after registering
25+
- [#179](https://github.com/bitExpert/magento2-force-login/issues/179) Improve menu placement: fix compatibility with B2B
26+
- [#161](https://github.com/bitExpert/magento2-force-login/issues/161) After login in shows css page
27+
528
## 4.0.1
629

730
### Added

Controller/Adminhtml/Manage/Create.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ class Create extends \Magento\Backend\App\Action
2121
{
2222
/**
2323
* @inheritDoc
24+
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
2425
*/
2526
public function execute()
2627
{
2728
$this->_view->loadLayout();
2829
$this->_view->renderLayout();
30+
return $this->_response;
2931
}
3032

3133
/**

Controller/Adminhtml/Manage/Index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public function execute()
3131
{
3232
$this->_view->loadLayout();
3333
$this->_view->renderLayout();
34+
return $this->_response;
3435
}
3536

3637
/**

Controller/LoginCheck.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ private function getBaseUrl()
227227
{
228228
$secure = $this->getForceSecureRedirectOption();
229229
$secure = ($secure === true) ? true : null;
230-
return $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure);
230+
/** @var Store $store */
231+
$store = $this->storeManager->getStore();
232+
return $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure);
231233
}
232234

233235
/**

Controller/LoginRouter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use BitExpert\ForceCustomerLogin\Api\Controller\LoginCheckInterface;
1515
use Magento\Framework\App\ActionFactory;
16+
use Magento\Framework\App\ActionInterface;
1617
use Magento\Framework\App\RouterInterface;
1718

1819
/**
@@ -48,10 +49,12 @@ public function __construct(
4849

4950
/**
5051
* @inheritDoc
52+
* @return ActionInterface|void
5153
*/
5254
public function match(\Magento\Framework\App\RequestInterface $request)
5355
{
5456
if ($this->loginCheck->execute()) {
57+
/** @var \Magento\Framework\App\Request\Http $request */
5558
$request->setDispatched(true);
5659
return $this->actionFactory->create(\Magento\Framework\App\Action\Redirect::class);
5760
}

Setup/UpgradeSchema.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
3939

4040
/**
4141
* @param SchemaSetupInterface $setup
42+
* @return void
4243
*/
4344
private function runUpgrade210(SchemaSetupInterface $setup)
4445
{

Test/Unit/Controller/LoginCheckUnitTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ public function ruleMatchingFailsAndResultsInRedirect()
518518
->getMock();
519519
$store->expects($this->once())
520520
->method('getBaseUrl')
521-
->with(UrlInterface::URL_TYPE_WEB, null)
521+
->with(UrlInterface::URL_TYPE_LINK, null)
522522
->willReturn($urlString);
523523
$storeManager = $this->getStoreManager();
524524
$storeManager->expects($this->once())
@@ -655,7 +655,7 @@ public function ensureSetBeforeAuthUrlBeforeRedirect()
655655
->getMock();
656656
$store->expects($this->once())
657657
->method('getBaseUrl')
658-
->with(UrlInterface::URL_TYPE_WEB, true)
658+
->with(UrlInterface::URL_TYPE_LINK, true)
659659
->willReturn($urlString);
660660
$storeManager = $this->getStoreManager();
661661
$storeManager->expects($this->once())
@@ -798,7 +798,7 @@ public function ruleMatchingFailsAndResultsInSecureRedirect()
798798
->getMock();
799799
$store->expects($this->once())
800800
->method('getBaseUrl')
801-
->with(UrlInterface::URL_TYPE_WEB, true)
801+
->with(UrlInterface::URL_TYPE_LINK, true)
802802
->willReturn($urlString);
803803
$storeManager = $this->getStoreManager();
804804
$storeManager->expects($this->once())
@@ -935,7 +935,7 @@ public function requestIsAjaxAndRuleMatchingFails()
935935
->getMock();
936936
$store->expects($this->once())
937937
->method('getBaseUrl')
938-
->with(UrlInterface::URL_TYPE_WEB, null)
938+
->with(UrlInterface::URL_TYPE_LINK, null)
939939
->willReturn($urlString);
940940
$storeManager = $this->getStoreManager();
941941
$storeManager->expects($this->once())
@@ -1076,7 +1076,7 @@ public function ruleMatchingFailsAjaxCheckUsesHttpObject()
10761076
->getMock();
10771077
$store->expects($this->once())
10781078
->method('getBaseUrl')
1079-
->with(UrlInterface::URL_TYPE_WEB, null)
1079+
->with(UrlInterface::URL_TYPE_LINK, null)
10801080
->willReturn($urlString);
10811081
$storeManager = $this->getStoreManager();
10821082
$storeManager->expects($this->once())
@@ -1217,7 +1217,7 @@ public function redirectMatchesReferrerUrlWithQueryParameters()
12171217
->getMock();
12181218
$store->expects($this->once())
12191219
->method('getBaseUrl')
1220-
->with(UrlInterface::URL_TYPE_WEB, null)
1220+
->with(UrlInterface::URL_TYPE_LINK, null)
12211221
->willReturn($baseUrl);
12221222
$storeManager = $this->getStoreManager();
12231223
$storeManager->expects($this->once())

bin/setup

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
BASE_URL=${1:-m2.localhost}
3-
MAGE_VERSION=${2:-2.3.3}
3+
MAGE_VERSION=${2:-2.4.0}
44

55
# load the DB env information
66
DIR="${BASH_SOURCE%/*}"
@@ -11,7 +11,7 @@ bin/restart
1111
sleep 1 #Ensure containers are started...
1212

1313
echo "Downloading Magento ${MAGE_VERSION} with Sample data..."
14-
bin/root curl -o /var/www/html/magento.tar.gz http://pubfiles.nexcess.net/magento/ce-packages/magento2-with-samples-${MAGE_VERSION}.tar.gz
14+
bin/root curl -o /var/www/html/magento.tar.gz https://pubfiles.nexcess.net/magento/ce-packages/magento2-with-samples-${MAGE_VERSION}.tar.gz
1515
bin/rootnotty tar xvfz /var/www/html/magento.tar.gz
1616
bin/rootnotty rm /var/www/html/magento.tar.gz
1717
bin/rootnotty cp /var/www/html/nginx.conf.sample /var/www/html/nginx.conf
@@ -23,22 +23,27 @@ bin/root curl -o /usr/local/bin/magerun https://files.magerun.net/n98-magerun2-l
2323
bin/rootnotty chmod +x /usr/local/bin/magerun
2424

2525
echo "Forcing reinstall of composer deps to ensure perms & reqs..."
26-
bin/clinotty composer install
26+
bin/clinotty composer global require hirak/prestissimo
27+
bin/clinotty composer update
2728

2829
bin/clinotty bin/magento setup:install \
2930
--db-host=$MYSQL_HOST \
3031
--db-name=$MYSQL_DATABASE \
3132
--db-user=$MYSQL_USER \
3233
--db-password=$MYSQL_PASSWORD \
3334
--base-url=https://$BASE_URL/ \
35+
--base-url-secure=https://$BASE_URL/ \
36+
--backend-frontname=admin \
3437
--admin-firstname=Admin \
3538
--admin-lastname=User \
3639
--admin-email=admin@test.loc \
3740
--admin-user=magento \
3841
--admin-password=magento2\
39-
--language=de_DE \
42+
--language=en_US \
4043
--currency=EUR \
4144
--timezone=Europe/Berlin \
45+
--search-engine=elasticsearch7 \
46+
--elasticsearch-host=elasticsearch \
4247
--use-rewrites=1
4348

4449
echo "Turning on developer mode.."
@@ -48,6 +53,12 @@ bin/clinotty bin/magento indexer:reindex
4853
echo "Forcing deploy of static content to speed up initial requests..."
4954
bin/clinotty bin/magento setup:static-content:deploy -f
5055

56+
echo "Re-indexing with Elasticsearch..."
57+
bin/clinotty bin/magento indexer:reindex
58+
59+
echo "Disable Magento 2FAuth module..."
60+
bin/clinotty bin/magento module:disable Magento_TwoFactorAuth
61+
5162
echo "Clearing the cache for good measure..."
5263
bin/clinotty bin/magento cache:flush
5364

@@ -61,11 +72,13 @@ bin/clinotty composer require bitexpert/magento2-force-customer-login:*
6172
echo "Enabling Force Login module..."
6273
bin/clinotty bin/magento module:enable BitExpert_ForceCustomerLogin
6374
bin/clinotty bin/magento setup:upgrade
64-
bin/clinotty bin/magento setup:di:compile
6575

6676
echo "Installing Sample data..."
6777
bin/clinotty bin/magento sampledata:deploy
6878

79+
echo "Generating SSL certificate..."
80+
bin/setup-ssl $BASE_URL
81+
6982
echo "Restarting containers with host bind mounts for dev..."
7083
bin/restart
7184

bin/setup-ssl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
[ -z "$1" ] && echo "Please specify a domain (ex. mydomain.test)" && exit
3+
4+
# Generate certificate authority if not already setup
5+
if ! docker-compose exec -T -u root app cat /root/.local/share/mkcert/rootCA.pem | grep -q 'BEGIN CERTIFICATE'; then
6+
bin/setup-ssl-ca
7+
fi
8+
9+
# Generate the certificate for the specified domain
10+
docker-compose exec -T -u root app mkcert -key-file nginx.key -cert-file nginx.crt "$@"
11+
echo "Moving key and cert to /etc/nginx/certs/..."
12+
docker-compose exec -T -u root app chown app:app nginx.key nginx.crt
13+
docker-compose exec -T -u root app mv nginx.key nginx.crt /etc/nginx/certs/
14+
15+
# Restart nginx to apply the updates
16+
echo "Restarting containers to apply updates..."
17+
bin/restart

0 commit comments

Comments
 (0)