Skip to content

Commit fc6a3dc

Browse files
committed
Merge remote-tracking branch 'adobe-commerce-tier-4/ACP2E-3125' into Tier4-Kings-PR-07-16-2024
2 parents 1cd6022 + 70a15dd commit fc6a3dc

File tree

3 files changed

+67
-16
lines changed

3 files changed

+67
-16
lines changed

app/code/Magento/User/i18n/en_US.csv

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ Role,Role
5555
System,System
5656
Permissions,Permissions
5757
"You cannot delete your own account.","You cannot delete your own account."
58-
"You have entered an invalid password for current user.","You have entered an invalid password for current user."
58+
"The password entered for the current user is invalid. Verify the password and try again.","The password entered for the current user is invalid. Verify the password and try again."
5959
"You deleted the user.","You deleted the user."
6060
"We can't find a user to delete.","We can't find a user to delete."
6161
"This user no longer exists.","This user no longer exists."
6262
"Edit User","Edit User"
6363
"You have revoked the user's tokens.","You have revoked the user's tokens."
6464
"We can't find a user to revoke.","We can't find a user to revoke."
6565
"You cannot delete self-assigned roles.","You cannot delete self-assigned roles."
66+
"We can't find a role to delete.","We can't find a role to delete."
6667
"You deleted the role.","You deleted the role."
6768
"An error occurred while deleting this role.","An error occurred while deleting this role."
6869
"Edit Role","Edit Role"
@@ -71,19 +72,21 @@ Permissions,Permissions
7172
"You saved the role.","You saved the role."
7273
"An error occurred while saving this role.","An error occurred while saving this role."
7374
"You saved the user.","You saved the user."
75+
Administrator,Administrator
7476
"A user with the same user name or email already exists.","A user with the same user name or email already exists."
7577
Recommended,Recommended
7678
Forced,Forced
7779
"Sorry, but this password has already been used. Please create another.","Sorry, but this password has already been used. Please create another."
7880
email,email
7981
password,password
8082
username,username
81-
"You did not sign in correctly or your account is temporarily disabled.","You did not sign in correctly or your account is temporarily disabled."
82-
"You need more permissions to access this.","You need more permissions to access this."
83-
"Your account is temporarily disabled.","Your account is temporarily disabled."
84-
"User Name is a required field.","User Name is a required field."
85-
"First Name is a required field.","First Name is a required field."
86-
"Last Name is a required field.","Last Name is a required field."
83+
"The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later.","The account sign-in was incorrect or your account is disabled temporarily. Please wait and try again later."
84+
"More permissions are needed to access this.","More permissions are needed to access this."
85+
"The password reset token is incorrect. Verify the token and try again.","The password reset token is incorrect. Verify the token and try again."
86+
"Your account is temporarily disabled. Please try again later.","Your account is temporarily disabled. Please try again later."
87+
"""User Name"" is required. Enter and try again.","""User Name"" is required. Enter and try again."
88+
"""First Name"" is required. Enter and try again.","""First Name"" is required. Enter and try again."
89+
"""Last Name"" is required. Enter and try again.","""Last Name"" is required. Enter and try again."
8790
"Please enter a valid email.","Please enter a valid email."
8891
"Password is required field.","Password is required field."
8992
"Your password must be at least %1 characters.","Your password must be at least %1 characters."
@@ -108,31 +111,34 @@ All,All
108111
Resources,Resources
109112
"Warning!<br>This action will remove this user from already assigned role.<br>Are you sure?","Warning!<br>This action will remove this user from already assigned role.<br>Are you sure?"
110113
"Warning!<br>This action will remove those users from already assigned roles.<br>Are you sure?","Warning!<br>This action will remove those users from already assigned roles.<br>Are you sure?"
114+
"New admin user '%user_name' created","New admin user '%user_name' created"
115+
"Hello,","Hello,"
116+
"A new admin account was created for %first_name, %last_name using %email.","A new admin account was created for %first_name, %last_name using %email."
117+
"If you have not authorized this action, please contact us immediately at %store_email","If you have not authorized this action, please contact us immediately at %store_email"
118+
"or call us at %store_phone","or call us at %store_phone"
119+
"Thanks,","Thanks,"
111120
"Password Reset Confirmation for %name","Password Reset Confirmation for %name"
112121
"%name,","%name,"
113122
"There was recently a request to change the password for your account.","There was recently a request to change the password for your account."
114123
"If you requested this change, reset your password here:","If you requested this change, reset your password here:"
115124
"If you did not make this request, you can ignore this email and your password will remain the same.","If you did not make this request, you can ignore this email and your password will remain the same."
116125
"Thank you,","Thank you,"
117126
"New %changes for %user_name","New %changes for %user_name"
118-
"Hello,","Hello,"
119-
"We have received a request to change the following information associated with your account at %store_name: %changes.","We have received a request to change the following information associated with your account at %store_name: %changes."
120-
"If you have not authorized this action, please contact us immediately at %store_email","If you have not authorized this action, please contact us immediately at %store_email"
121-
"or call us at %store_phone","or call us at %store_phone"
122-
"Thanks,","Thanks,"
127+
"We have received a request to reset the %changes associated with your account at %store_name.","We have received a request to reset the %changes associated with your account at %store_name."
123128
"All Users","All Users"
124129
"User Roles","User Roles"
125130
"User Notification Template","User Notification Template"
126131
"Email template chosen based on theme fallback when ""Default"" option is selected.","Email template chosen based on theme fallback when ""Default"" option is selected."
132+
"New User Notification Template","New User Notification Template"
127133
"Maximum Login Failures to Lockout Account","Maximum Login Failures to Lockout Account"
128134
"We will disable this feature if the value is empty.","We will disable this feature if the value is empty."
129135
"Lockout Time (minutes)","Lockout Time (minutes)"
130136
"Password Lifetime (days)","Password Lifetime (days)"
131-
"We will disable this feature if the value is empty. ","We will disable this feature if the value is empty. "
132137
"Password Change","Password Change"
133138
Unlock,Unlock
134139
ID,ID
135140
Username,Username
136141
"Last login","Last login"
137142
Failures,Failures
138143
Unlocked,Unlocked
144+
"Last Logged in","Last Logged in"

app/code/Magento/User/view/adminhtml/email/user_notification.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@
44
* See COPYING.txt for license details.
55
*/
66
-->
7-
<!--@subject {{trans "New %changes for %user_name" changes=$changes user_name=$user.name}} @-->
7+
<!--@subject {{trans "New %changes for %user_name" changes=$changes user_name=$user.username}} @-->
88
<!--@vars {
99
"var store.frontend_name":"Store Name",
1010
"var store_name":"Store Name",
1111
"var store_email":"Store Email",
1212
"var store_phone":"Store Phone",
1313
"var changes":"Changes",
14-
"var user.name":"User Name"
14+
"var user.username":"User Name"
1515
} @-->
1616

1717
{{trans "Hello,"}}
1818

19-
{{trans "We have received a request to change the following information associated with your account at %store_name: %changes." store_name=$store.frontend_name changes=$changes}}
19+
{{trans "We have received a request to reset the %changes associated with your account at %store_name." store_name=$store.frontend_name changes=$changes}}
2020
{{trans "If you have not authorized this action, please contact us immediately at %store_email" store_email=$store_email |escape}}{{depend store_phone}} {{trans "or call us at %store_phone" store_phone=$store_phone |escape}}{{/depend}}.
2121

2222
{{trans "Thanks,"}}

dev/tests/integration/testsuite/Magento/User/Model/UserTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
use Magento\Framework\Stdlib\DateTime;
2222
use Magento\TestFramework\Bootstrap as TestFrameworkBootstrap;
2323
use Magento\TestFramework\Entity;
24+
use Magento\TestFramework\Fixture\DataFixture;
25+
use Magento\TestFramework\Fixture\DataFixtureStorage;
26+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
2427
use Magento\TestFramework\Helper\Bootstrap;
2528
use Magento\TestFramework\Mail\Template\TransportBuilderMock;
2629
use Magento\User\Model\User as UserModel;
30+
use Magento\User\Test\Fixture\User as UserDataFixture;
2731
use PHPUnit\Framework\TestCase;
2832

2933
/**
@@ -62,6 +66,11 @@ class UserTest extends TestCase
6266
*/
6367
private $objectManager;
6468

69+
/**
70+
* @var DataFixtureStorage
71+
*/
72+
private $fixtures;
73+
6574
/**
6675
* @inheritDoc
6776
*/
@@ -72,6 +81,7 @@ protected function setUp(): void
7281
$this->_dateTime = $this->objectManager->get(DateTime::class);
7382
$this->encryptor = $this->objectManager->get(Encryptor::class);
7483
$this->cache = $this->objectManager->get(CacheInterface::class);
84+
$this->fixtures = DataFixtureStorageManager::getStorage();
7585
}
7686

7787
/**
@@ -618,6 +628,41 @@ public function testSendNotificationEmailsIfRequired()
618628
);
619629
}
620630

631+
/**
632+
* Test admin email notification after password change
633+
*
634+
* @throws LocalizedException
635+
* @return void
636+
*/
637+
#[
638+
DataFixture(UserDataFixture::class, ['role_id' => 1], 'user')
639+
]
640+
public function testAdminUserEmailNotificationAfterPasswordChange(): void
641+
{
642+
// Load admin user
643+
$user = $this->fixtures->get('user');
644+
$username = $user->getDataByKey('username');
645+
$adminEmail = $user->getDataByKey('email');
646+
647+
// Login with old credentials
648+
$this->_model->login($username, TestFrameworkBootstrap::ADMIN_PASSWORD);
649+
650+
// Change password
651+
$this->_model->setPassword('newPassword123');
652+
$this->_model->save();
653+
654+
$this->_model->sendNotificationEmailsIfRequired();
655+
656+
/** @var TransportBuilderMock $transportBuilderMock */
657+
$transportBuilderMock = $this->objectManager->get(TransportBuilderMock::class);
658+
$message = $transportBuilderMock->getSentMessage();
659+
660+
// Verify an email was dispatched to the correct user with correct subject
661+
$this->assertNotNull($transportBuilderMock->getSentMessage());
662+
$this->assertEquals($adminEmail, $message->getTo()[0]->getEmail());
663+
$this->assertEquals($message->getSubject(), 'New password for '.$username);
664+
}
665+
621666
/**
622667
* Return email template id by origin template code
623668
*

0 commit comments

Comments
 (0)