Skip to content

Commit

Permalink
Merge pull request #196 from websharp/master
Browse files Browse the repository at this point in the history
Magento 2.4 upgrade finishing
  • Loading branch information
websharp authored Oct 19, 2020
2 parents a2464d6 + fea825f commit c183e94
Show file tree
Hide file tree
Showing 15 changed files with 426 additions and 305 deletions.
1 change: 1 addition & 0 deletions Block/Adminhtml/Manage/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function getBackUrl()
}

/**
* @return void
*/
protected function updateButtonControls()
{
Expand Down
23 changes: 23 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

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

## 4.1.0

### Added

- [#191](https://github.com/bitExpert/magento2-force-login/pull/191) Added support for Magento 2.4
- [#187](https://github.com/bitExpert/magento2-force-login/pull/187) Skip dynamic asset request
- [#186](https://github.com/bitExpert/magento2-force-login/pull/186) Fixed registration redirect

### Deprecated

- Nothing.

### Removed

- Nothing.

### Fixed

- [#192](https://github.com/bitExpert/magento2-force-login/issues/192) force login in store redirects to default login
- [#180](https://github.com/bitExpert/magento2-force-login/issues/180) Customers get whoops.... after registering
- [#179](https://github.com/bitExpert/magento2-force-login/issues/179) Improve menu placement: fix compatibility with B2B
- [#161](https://github.com/bitExpert/magento2-force-login/issues/161) After login in shows css page

## 4.0.1

### Added
Expand Down
2 changes: 2 additions & 0 deletions Controller/Adminhtml/Manage/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ class Create extends \Magento\Backend\App\Action
{
/**
* @inheritDoc
* @return \Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$this->_view->loadLayout();
$this->_view->renderLayout();
return $this->_response;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Controller/Adminhtml/Manage/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public function execute()
{
$this->_view->loadLayout();
$this->_view->renderLayout();
return $this->_response;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion Controller/LoginCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ private function getBaseUrl()
{
$secure = $this->getForceSecureRedirectOption();
$secure = ($secure === true) ? true : null;
return $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure);
/** @var Store $store */
$store = $this->storeManager->getStore();
return $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, $secure);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions Controller/LoginRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use BitExpert\ForceCustomerLogin\Api\Controller\LoginCheckInterface;
use Magento\Framework\App\ActionFactory;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\RouterInterface;

/**
Expand Down Expand Up @@ -48,10 +49,12 @@ public function __construct(

/**
* @inheritDoc
* @return ActionInterface|void
*/
public function match(\Magento\Framework\App\RequestInterface $request)
{
if ($this->loginCheck->execute()) {
/** @var \Magento\Framework\App\Request\Http $request */
$request->setDispatched(true);
return $this->actionFactory->create(\Magento\Framework\App\Action\Redirect::class);
}
Expand Down
1 change: 1 addition & 0 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con

/**
* @param SchemaSetupInterface $setup
* @return void
*/
private function runUpgrade210(SchemaSetupInterface $setup)
{
Expand Down
12 changes: 6 additions & 6 deletions Test/Unit/Controller/LoginCheckUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ public function ruleMatchingFailsAndResultsInRedirect()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, null)
->with(UrlInterface::URL_TYPE_LINK, null)
->willReturn($urlString);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down Expand Up @@ -655,7 +655,7 @@ public function ensureSetBeforeAuthUrlBeforeRedirect()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, true)
->with(UrlInterface::URL_TYPE_LINK, true)
->willReturn($urlString);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down Expand Up @@ -798,7 +798,7 @@ public function ruleMatchingFailsAndResultsInSecureRedirect()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, true)
->with(UrlInterface::URL_TYPE_LINK, true)
->willReturn($urlString);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down Expand Up @@ -935,7 +935,7 @@ public function requestIsAjaxAndRuleMatchingFails()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, null)
->with(UrlInterface::URL_TYPE_LINK, null)
->willReturn($urlString);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down Expand Up @@ -1076,7 +1076,7 @@ public function ruleMatchingFailsAjaxCheckUsesHttpObject()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, null)
->with(UrlInterface::URL_TYPE_LINK, null)
->willReturn($urlString);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down Expand Up @@ -1217,7 +1217,7 @@ public function redirectMatchesReferrerUrlWithQueryParameters()
->getMock();
$store->expects($this->once())
->method('getBaseUrl')
->with(UrlInterface::URL_TYPE_WEB, null)
->with(UrlInterface::URL_TYPE_LINK, null)
->willReturn($baseUrl);
$storeManager = $this->getStoreManager();
$storeManager->expects($this->once())
Expand Down
23 changes: 18 additions & 5 deletions bin/setup
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
BASE_URL=${1:-m2.localhost}
MAGE_VERSION=${2:-2.3.3}
MAGE_VERSION=${2:-2.4.0}

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

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

echo "Forcing reinstall of composer deps to ensure perms & reqs..."
bin/clinotty composer install
bin/clinotty composer global require hirak/prestissimo
bin/clinotty composer update

bin/clinotty bin/magento setup:install \
--db-host=$MYSQL_HOST \
--db-name=$MYSQL_DATABASE \
--db-user=$MYSQL_USER \
--db-password=$MYSQL_PASSWORD \
--base-url=https://$BASE_URL/ \
--base-url-secure=https://$BASE_URL/ \
--backend-frontname=admin \
--admin-firstname=Admin \
--admin-lastname=User \
[email protected] \
--admin-user=magento \
--admin-password=magento2\
--language=de_DE \
--language=en_US \
--currency=EUR \
--timezone=Europe/Berlin \
--search-engine=elasticsearch7 \
--elasticsearch-host=elasticsearch \
--use-rewrites=1

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

echo "Re-indexing with Elasticsearch..."
bin/clinotty bin/magento indexer:reindex

echo "Disable Magento 2FAuth module..."
bin/clinotty bin/magento module:disable Magento_TwoFactorAuth

echo "Clearing the cache for good measure..."
bin/clinotty bin/magento cache:flush

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

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

echo "Generating SSL certificate..."
bin/setup-ssl $BASE_URL

echo "Restarting containers with host bind mounts for dev..."
bin/restart

Expand Down
17 changes: 17 additions & 0 deletions bin/setup-ssl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
[ -z "$1" ] && echo "Please specify a domain (ex. mydomain.test)" && exit

# Generate certificate authority if not already setup
if ! docker-compose exec -T -u root app cat /root/.local/share/mkcert/rootCA.pem | grep -q 'BEGIN CERTIFICATE'; then
bin/setup-ssl-ca
fi

# Generate the certificate for the specified domain
docker-compose exec -T -u root app mkcert -key-file nginx.key -cert-file nginx.crt "$@"
echo "Moving key and cert to /etc/nginx/certs/..."
docker-compose exec -T -u root app chown app:app nginx.key nginx.crt
docker-compose exec -T -u root app mv nginx.key nginx.crt /etc/nginx/certs/

# Restart nginx to apply the updates
echo "Restarting containers to apply updates..."
bin/restart
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bitexpert/magento2-force-customer-login",
"description": "The Force Login module for Magento2 redirects a storefront visitor to the Magento2 Frontend login page, if the visitor is not logged in. It is possible to configure the whitelisted urls to add custom definitions.",
"type": "magento2-module",
"version": "4.0.0",
"version": "4.1.0",
"minimum-stability": "stable",
"license": "Apache-2.0",
"authors": [
Expand Down Expand Up @@ -61,6 +61,7 @@
"@cs-check",
"@test"
],
"analyze": "vendor/bin/phing analyze",
"cs-check": "vendor/bin/phing sniff",
"cs-fix": "vendor/bin/phing cs-fix",
"test": "vendor/bin/phing unit"
Expand Down
Loading

0 comments on commit c183e94

Please sign in to comment.