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 ' );
@@ -170,6 +170,10 @@ public function execute(): ResultInterface
170
170
$ this ->deleteExpiredAuthenticationData ->execute ($ userId );
171
171
$ secret = $ this ->saveAuthenticationData ->execute ($ authenticationData );
172
172
173
+ if (empty ($ storeId )) {
174
+ $ storeId = (int )$ customer ->getStoreId ();
175
+ }
176
+
173
177
$ redirectUrl = $ this ->getLoginProceedRedirectUrl ($ secret , $ storeId );
174
178
$ resultRedirect ->setUrl ($ redirectUrl );
175
179
return $ resultRedirect ;
@@ -185,7 +189,7 @@ public function execute(): ResultInterface
185
189
*/
186
190
private function getLoginProceedRedirectUrl (string $ secret , ?int $ storeId ): string
187
191
{
188
- if (null === $ storeId ) {
192
+ if (empty ( $ storeId) ) {
189
193
$ store = $ this ->storeManager ->getDefaultStoreView ();
190
194
} else {
191
195
$ store = $ this ->storeManager ->getStore ($ storeId );
0 commit comments