Skip to content

Commit e4d4964

Browse files
committed
Merge remote-tracking branch 'origin/MC-29841' into 2.4-develop-pr7
2 parents e7c7b97 + 493a74d commit e4d4964

File tree

2 files changed

+44
-33
lines changed

2 files changed

+44
-33
lines changed

app/code/Magento/Customer/Model/AccountManagement.php

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,92 +68,104 @@ class AccountManagement implements AccountManagementInterface
6868
/**
6969
* Configuration paths for create account email template
7070
*
71-
* @deprecated
71+
* @deprecated Get rid of Helpers in Password Security Management
72+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
7273
*/
7374
const XML_PATH_REGISTER_EMAIL_TEMPLATE = 'customer/create_account/email_template';
7475

7576
/**
7677
* Configuration paths for register no password email template
7778
*
78-
* @deprecated
79+
* @deprecated Get rid of Helpers in Password Security Management
80+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
7981
*/
8082
const XML_PATH_REGISTER_NO_PASSWORD_EMAIL_TEMPLATE = 'customer/create_account/email_no_password_template';
8183

8284
/**
8385
* Configuration paths for remind email identity
8486
*
85-
* @deprecated
87+
* @deprecated Get rid of Helpers in Password Security Management
88+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
8689
*/
8790
const XML_PATH_REGISTER_EMAIL_IDENTITY = 'customer/create_account/email_identity';
8891

8992
/**
9093
* Configuration paths for remind email template
9194
*
92-
* @deprecated
95+
* @deprecated Get rid of Helpers in Password Security Management
96+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
9397
*/
9498
const XML_PATH_REMIND_EMAIL_TEMPLATE = 'customer/password/remind_email_template';
9599

96100
/**
97101
* Configuration paths for forgot email email template
98102
*
99-
* @deprecated
103+
* @deprecated Get rid of Helpers in Password Security Management
104+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
100105
*/
101106
const XML_PATH_FORGOT_EMAIL_TEMPLATE = 'customer/password/forgot_email_template';
102107

103108
/**
104109
* Configuration paths for forgot email identity
105110
*
106-
* @deprecated
111+
* @deprecated Get rid of Helpers in Password Security Management
112+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
107113
*/
108114
const XML_PATH_FORGOT_EMAIL_IDENTITY = 'customer/password/forgot_email_identity';
109115

110116
/**
111117
* Configuration paths for account confirmation required
112118
*
113-
* @deprecated
119+
* @deprecated Get rid of Helpers in Password Security Management
114120
* @see AccountConfirmation::XML_PATH_IS_CONFIRM
115121
*/
116122
const XML_PATH_IS_CONFIRM = 'customer/create_account/confirm';
117123

118124
/**
119125
* Configuration paths for account confirmation email template
120126
*
121-
* @deprecated
127+
* @deprecated Get rid of Helpers in Password Security Management
128+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
122129
*/
123130
const XML_PATH_CONFIRM_EMAIL_TEMPLATE = 'customer/create_account/email_confirmation_template';
124131

125132
/**
126133
* Configuration paths for confirmation confirmed email template
127134
*
128-
* @deprecated
135+
* @deprecated Get rid of Helpers in Password Security Management
136+
* @see EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
129137
*/
130138
const XML_PATH_CONFIRMED_EMAIL_TEMPLATE = 'customer/create_account/email_confirmed_template';
131139

132140
/**
133141
* Constants for the type of new account email to be sent
134142
*
135-
* @deprecated
143+
* @deprecated Get rid of Helpers in Password Security Management
144+
* @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED
136145
*/
137146
const NEW_ACCOUNT_EMAIL_REGISTERED = 'registered';
138147

139148
/**
140149
* Welcome email, when password setting is required
141150
*
142-
* @deprecated
151+
* @deprecated Get rid of Helpers in Password Security Management
152+
* @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED
143153
*/
144154
const NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD = 'registered_no_password';
145155

146156
/**
147157
* Welcome email, when confirmation is enabled
148158
*
149-
* @deprecated
159+
* @deprecated Get rid of Helpers in Password Security Management
160+
* @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED
150161
*/
151162
const NEW_ACCOUNT_EMAIL_CONFIRMATION = 'confirmation';
152163

153164
/**
154165
* Confirmation email, when account is confirmed
155166
*
156-
* @deprecated
167+
* @deprecated Get rid of Helpers in Password Security Management
168+
* @see EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED
157169
*/
158170
const NEW_ACCOUNT_EMAIL_CONFIRMED = 'confirmed';
159171

@@ -179,14 +191,15 @@ class AccountManagement implements AccountManagementInterface
179191
/**
180192
* Configuration path to customer reset password email template
181193
*
182-
* @deprecated
194+
* @deprecated Get rid of Helpers in Password Security Management
195+
* @see Magento/Customer/Model/EmailNotification::XML_PATH_REGISTER_EMAIL_TEMPLATE
183196
*/
184197
const XML_PATH_RESET_PASSWORD_TEMPLATE = 'customer/password/reset_password_template';
185198

186199
/**
187200
* Minimum password length
188201
*
189-
* @deprecated
202+
* @deprecated Get rid of Helpers in Password Security Management
190203
*/
191204
const MIN_PASSWORD_LENGTH = 6;
192205

@@ -526,6 +539,7 @@ public function resendConfirmation($email, $websiteId = null, $redirectUrl = '')
526539
// If we are not able to send a new account email, this should be ignored
527540
$this->logger->critical($e);
528541
}
542+
return true;
529543
}
530544

531545
/**
@@ -671,17 +685,16 @@ public function initiatePasswordReset($email, $template, $websiteId = null)
671685
*/
672686
private function handleUnknownTemplate($template)
673687
{
674-
throw new InputException(
675-
__(
676-
'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.',
677-
[
678-
'value' => $template,
679-
'fieldName' => 'template',
680-
'template1' => AccountManagement::EMAIL_REMINDER,
681-
'template2' => AccountManagement::EMAIL_RESET
682-
]
683-
)
688+
$phrase = __(
689+
'Invalid value of "%value" provided for the %fieldName field. Possible values: %template1 or %template2.',
690+
[
691+
'value' => $template,
692+
'fieldName' => 'template',
693+
'template1' => AccountManagement::EMAIL_REMINDER,
694+
'template2' => AccountManagement::EMAIL_RESET
695+
]
684696
);
697+
throw new InputException($phrase);
685698
}
686699

687700
/**
@@ -713,12 +726,6 @@ public function resetPassword($email, $resetToken, $newPassword)
713726
$customerSecure->setRpTokenCreatedAt(null);
714727
$customerSecure->setPasswordHash($this->createPasswordHash($newPassword));
715728
$this->destroyCustomerSessions($customer->getId());
716-
if ($this->sessionManager->isSessionExists()) {
717-
//delete old session and move data to the new session
718-
//use this instead of $this->sessionManager->regenerateId because last one doesn't delete old session
719-
// phpcs:ignore Magento2.Functions.DiscouragedFunction
720-
session_regenerate_id(true);
721-
}
722729
$this->customerRepository->save($customer);
723730

724731
return true;

app/code/Magento/Customer/Model/Visitor.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
/**
1313
* Class Visitor
1414
*
15-
* @package Magento\Customer\Model
15+
* Used to track sessions of the logged in customers
16+
*
1617
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1718
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1819
*/
@@ -173,7 +174,7 @@ public function initByRequest($observer)
173174
if ($this->requestSafety->isSafeMethod()) {
174175
return $this;
175176
}
176-
177+
177178
if (!$this->getId()) {
178179
$this->setSessionId($this->session->getSessionId());
179180
$this->save();
@@ -199,6 +200,9 @@ public function saveByRequest($observer)
199200
}
200201

201202
try {
203+
if ($this->session->getSessionId() && $this->getSessionId() != $this->session->getSessionId()) {
204+
$this->setSessionId($this->session->getSessionId());
205+
}
202206
$this->save();
203207
$this->_eventManager->dispatch('visitor_activity_save', ['visitor' => $this]);
204208
$this->session->setVisitorData($this->getData());

0 commit comments

Comments
 (0)