34
34
*
35
35
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
36
36
*/
37
- class Login extends Action implements HttpGetActionInterface, HttpPostActionInterface
37
+ class Login extends Action implements HttpGetActionInterface
38
38
{
39
39
/**
40
40
* Authorization level of a basic admin session
@@ -140,7 +140,7 @@ public function execute(): ResultInterface
140
140
}
141
141
142
142
try {
143
- $ this ->customerRepository ->getById ($ customerId );
143
+ $ customer = $ this ->customerRepository ->getById ($ customerId );
144
144
} catch (NoSuchEntityException $ e ) {
145
145
$ this ->messageManager ->addErrorMessage (__ ('Customer with this ID are no longer exist. ' ));
146
146
return $ resultRedirect ->setPath ('customer/index/index ' );
@@ -167,6 +167,10 @@ public function execute(): ResultInterface
167
167
$ this ->deleteExpiredAuthenticationData ->execute ($ userId );
168
168
$ secret = $ this ->saveAuthenticationData ->execute ($ authenticationData );
169
169
170
+ if (empty ($ storeId )) {
171
+ $ storeId = (int )$ customer ->getStoreId ();
172
+ }
173
+
170
174
$ redirectUrl = $ this ->getLoginProceedRedirectUrl ($ secret , $ storeId );
171
175
$ resultRedirect ->setUrl ($ redirectUrl );
172
176
return $ resultRedirect ;
@@ -182,7 +186,7 @@ public function execute(): ResultInterface
182
186
*/
183
187
private function getLoginProceedRedirectUrl (string $ secret , ?int $ storeId ): string
184
188
{
185
- if (null === $ storeId ) {
189
+ if (empty ( $ storeId) ) {
186
190
$ store = $ this ->storeManager ->getDefaultStoreView ();
187
191
} else {
188
192
$ store = $ this ->storeManager ->getStore ($ storeId );
0 commit comments