-
-
Notifications
You must be signed in to change notification settings - Fork 436
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
Allow setting admin user notification email receiver #3722
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* OpenMage | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available at https://opensource.org/license/osl-3-0-php | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com) | ||
* @copyright Copyright (c) 2022-2023 The OpenMage Contributors (https://www.openmage.org) | ||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
/** | ||
* System config email field backend model that also allows empty address | ||
* | ||
* @category Mage | ||
* @package Mage_Adminhtml | ||
*/ | ||
class Mage_Adminhtml_Model_System_Config_Backend_Email_Addressorempty extends Mage_Core_Model_Config_Data | ||
{ | ||
protected function _beforeSave() | ||
{ | ||
$value = $this->getValue(); | ||
if ($value && !Zend_Validate::is($value, 'EmailAddress')) { | ||
Mage::throwException(Mage::helper('adminhtml')->__('Invalid email address "%s".', $value)); | ||
} | ||
return $this; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1256,16 +1256,28 @@ | |||||||||||||||||||||||||
<show_in_website>0</show_in_website> | ||||||||||||||||||||||||||
<show_in_store>0</show_in_store> | ||||||||||||||||||||||||||
</extensions_compatibility_mode> | ||||||||||||||||||||||||||
<crate_admin_user_notification translate="label comment"> | ||||||||||||||||||||||||||
<create_admin_user_notification translate="label comment"> | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would leave the typo as-is. Yes, you move the value to the new setting, but legacy code may still use the old xpath. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For legacy code, this can be used, if I remember correctly: <crate_admin_user_notification deprecated="true">
<config_path>admin/security/create_admin_user_notification</config_path>
</crate_admin_user_notification> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is that @luigifab ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here: magento-lts/app/code/core/Mage/Paypal/etc/system.xml Lines 29 to 40 in 6ea8cf0
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #3721 was decided not to create a breaking change to fix a typo, let's please address the comments made by other users if possible |
||||||||||||||||||||||||||
<label>New Admin User Create Notification</label> | ||||||||||||||||||||||||||
<comment>This setting enable notification when new admin user created.</comment> | ||||||||||||||||||||||||||
<comment>This setting enables notification when new admin user is created.</comment> | ||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is ok to change. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before changing the comment, please check if there is a translation for that phrase. If exists you should change only the CSV file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep, needs to be changed in Mage_Core.csv instead of here, so that we don't break language packs |
||||||||||||||||||||||||||
<frontend_type>select</frontend_type> | ||||||||||||||||||||||||||
<sort_order>10</sort_order> | ||||||||||||||||||||||||||
<source_model>adminhtml/system_config_source_enabledisable</source_model> | ||||||||||||||||||||||||||
<show_in_default>1</show_in_default> | ||||||||||||||||||||||||||
<show_in_website>0</show_in_website> | ||||||||||||||||||||||||||
<show_in_store>0</show_in_store> | ||||||||||||||||||||||||||
</crate_admin_user_notification> | ||||||||||||||||||||||||||
</create_admin_user_notification> | ||||||||||||||||||||||||||
<create_admin_user_notification_email translate="label comment"> | ||||||||||||||||||||||||||
<label>Notification Email Receiver</label> | ||||||||||||||||||||||||||
<comment>Email address to receive notifications when a new admin user is created. Defaults to the General Store email address if empty.</comment> | ||||||||||||||||||||||||||
<depends><create_admin_user_notification>1</create_admin_user_notification></depends> | ||||||||||||||||||||||||||
<frontend_type>text</frontend_type> | ||||||||||||||||||||||||||
<validate>validate-email</validate> | ||||||||||||||||||||||||||
<backend_model>adminhtml/system_config_backend_email_addressorempty</backend_model> | ||||||||||||||||||||||||||
<sort_order>11</sort_order> | ||||||||||||||||||||||||||
<show_in_default>1</show_in_default> | ||||||||||||||||||||||||||
<show_in_website>0</show_in_website> | ||||||||||||||||||||||||||
<show_in_store>0</show_in_store> | ||||||||||||||||||||||||||
</create_admin_user_notification_email> | ||||||||||||||||||||||||||
<reprocess_image_quality translate="label comment"> | ||||||||||||||||||||||||||
<label>Image Reprocess Quality</label> | ||||||||||||||||||||||||||
<comment>The recommended value is 85, a higher value will increase the file size. You can set the value to 0 to disable image processing, but it may cause security risks.</comment> | ||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
/** | ||
* OpenMage | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available at https://opensource.org/license/osl-3-0-php | ||
* | ||
* @category Mage | ||
* @package Mage_Core | ||
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com) | ||
* @copyright Copyright (c) 2022 The OpenMage Contributors (https://www.openmage.org) | ||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
/** @var Mage_Core_Model_Resource_Setup $installer */ | ||
$installer = $this; | ||
$installer->startSetup(); | ||
|
||
$table = $installer->getTable('core/config_data'); | ||
|
||
if ($installer->getConnection()->isTableExists($table)) { | ||
$oldPath = 'admin/security/crate_admin_user_notification'; | ||
$newPath = 'admin/security/create_admin_user_notification'; | ||
|
||
$select = $installer->getConnection()->select() | ||
->from($table, ['config_id', 'path']) | ||
->where('path = ?', $oldPath); | ||
|
||
$rows = $installer->getConnection()->fetchAll($select); | ||
|
||
foreach ($rows as $row) { | ||
$installer->getConnection()->update( | ||
$table, | ||
['path' => $newPath], | ||
['config_id = ?' => $row['config_id']] | ||
); | ||
} | ||
} | ||
|
||
$installer->endSetup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zend_Validate::is($receiverEmail, 'EmailAddress')
perhaps?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because
FILTER_VALIDATE_EMAIL
is not used.