Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify message when changing user passwords #16502

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/lexicon/en/user.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
$_lang['user_blockeduntil_desc'] = 'If set, the user will be blocked until this time.';
$_lang['user_changeddata'] = 'Your data has been changed. Please log in again.';
$_lang['user_class_key_desc'] = 'The MODX Class Key for this user. Do not change this unless you know what you are doing.';
$_lang['user_created_password_message'] = 'The User has been created. The password is: [[+password]]';
$_lang['user_created_password_message'] = 'The User <b>[[+username]]</b> has been created. <br>The password is: <b>[[+password]]</b>';
$_lang['user_confirm_remove'] = 'Are you sure you want to permanently delete this user?';
$_lang['user_country'] = 'Country';
$_lang['user_dob'] = 'Date of birth';
Expand Down Expand Up @@ -165,7 +165,7 @@
$_lang['user_male'] = 'Male';
$_lang['user_management_msg'] = 'Here you can choose which user you wish to edit.';
$_lang['user_mobile'] = 'Mobile phone number';
$_lang['user_password_changed'] = 'Password successfully changed to: [[+password]]';
$_lang['user_password_changed'] = 'Password successfully changed to: <b>[[+password]]</b>';
$_lang['user_phone'] = 'Phone number';
$_lang['user_photo'] = 'User Photo';
$_lang['user_photo_message'] = 'Enter the image URL for this user or use the insert button to select or upload an image file on the server.';
Expand All @@ -186,7 +186,7 @@
$_lang['user_sudo_desc'] = 'If checked, this user will have full access to all the site and will bypass any Access Permissions checks. *DO NOT* check this unless you mean to do so!';
$_lang['user_title'] = 'Create/Edit user';
$_lang['user_other'] = 'Other';
$_lang['user_updated_password_message'] = 'The User has been updated. The password is: [[+password]]';
$_lang['user_updated_password_message'] = 'The User <b>[[+username]]</b> has been updated. <br>The password is: <b>[[+password]]</b>';
$_lang['user_upload_message'] = 'If you wish to stop this user uploading any filetypes in this category, make sure that the \'Use Main Configuration Setting\' checkbox is not ticked and leave the field blank.';
$_lang['user_use_config'] = 'Use System Configuration Setting';
$_lang['user_username_desc'] = 'The unique identifier of this User, and the name by which they will login to the site.';
Expand Down
15 changes: 8 additions & 7 deletions core/src/Revolution/Processors/Security/User/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public static function getInstance(modX $modx,$className,$properties = []) {
public function initialize() {
$this->setDefaultProperties(
[
'class_key' => $this->classKey,
'blocked' => false,
'active' => false,
'class_key' => $this->classKey,
'blocked' => false,
'active' => false,
]
);
$this->classKey = $this->getProperty('class_key', modUser::class);
Expand Down Expand Up @@ -124,10 +124,10 @@ public function setUserGroups()
$membership = $this->modx->newObject(modUserGroupMember::class);
$membership->fromArray(
[
'user_group' => $group['usergroup'],
'role' => $group['role'],
'member' => $this->object->get('id'),
'rank' => isset($group['rank']) ? $group['rank'] : $idx
'user_group' => $group['usergroup'],
'role' => $group['role'],
'member' => $this->object->get('id'),
'rank' => isset($group['rank']) ? $group['rank'] : $idx
]
);
if (empty($group['rank'])) {
Expand Down Expand Up @@ -242,6 +242,7 @@ public function cleanup() {
$passwordNotifyMethod = $this->getProperty('passwordnotifymethod', 's');
if (!empty($passwordNotifyMethod) && $passwordNotifyMethod == 's') {
return $this->success($this->modx->lexicon('user_created_password_message', [
'username' => $this->object->get('username'),
'password' => $this->newPassword,
]), $this->object);
} else {
Expand Down
39 changes: 20 additions & 19 deletions core/src/Revolution/Processors/Security/User/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public function checkActiveChange() {
if ($this->activeStatusChanged) {
$event = $this->newActiveStatus == true ? 'OnBeforeUserActivate' : 'OnBeforeUserDeactivate';
$OnBeforeUserActivate = $this->modx->invokeEvent($event,
[
'id' => $this->object->get('id'),
'user' => &$this->object,
'mode' => modSystemEvent::MODE_UPD,
]
[
'id' => $this->object->get('id'),
'user' => &$this->object,
'mode' => modSystemEvent::MODE_UPD,
]
);
$canChange = $this->processEventResponse($OnBeforeUserActivate);
if (!empty($canChange)) {
Expand Down Expand Up @@ -208,8 +208,8 @@ public function setUserGroups() {
$existingGroup = $currentGroups[$existingMembership->get('user_group')];
$existingMembership->fromArray(
[
'role' => $existingGroup['role'],
'rank' => isset($existingGroup['rank']) ? $existingGroup['rank'] : 0
'role' => $existingGroup['role'],
'rank' => isset($existingGroup['rank']) ? $existingGroup['rank'] : 0
]
);
$remainingGroupIds[] = $existingMembership->get('user_group');
Expand All @@ -233,10 +233,10 @@ public function setUserGroups() {
$membership = $this->modx->newObject(modUserGroupMember::class);
$membership->fromArray(
[
'user_group' => $newGroup['usergroup'],
'role' => $newGroup['role'],
'member' => $this->object->get('id'),
'rank' => isset($newGroup['rank']) ? $newGroup['rank'] : $idx
'user_group' => $newGroup['usergroup'],
'role' => $newGroup['role'],
'member' => $this->object->get('id'),
'rank' => isset($newGroup['rank']) ? $newGroup['rank'] : $idx
]
);
if (empty($newGroup['rank'])) {
Expand Down Expand Up @@ -297,11 +297,11 @@ public function afterSave() {
public function fireAfterActiveStatusChange() {
$event = $this->newActiveStatus == true ? 'OnUserActivate' : 'OnUserDeactivate';
$this->modx->invokeEvent($event,
[
'id' => $this->object->get('id'),
'user' => &$this->object,
'mode' => modSystemEvent::MODE_UPD,
]
[
'id' => $this->object->get('id'),
'user' => &$this->object,
'mode' => modSystemEvent::MODE_UPD,
]
);
}

Expand All @@ -321,9 +321,10 @@ public function cleanup()
$passwordNotifyMethod = $this->getProperty('passwordnotifymethod');
if (!empty($passwordNotifyMethod) && !empty($this->newPassword) && $passwordNotifyMethod == 's') {
return $this->success($this->modx->lexicon('user_updated_password_message',
[
'password' => $this->newPassword,
]
[
'username' => $this->object->get('username'),
'password' => $this->newPassword,
]
), $this->object);
} else {
return $this->success('',$this->object);
Expand Down
Loading