How to create a password or an encrypted field in Magento 2 System Configuration
When you want to create a new field for input any password in system configuration Magento 2 but you don't want it to show the password as a text.
Here we will guide you on how to create a password type field in the admin configuration in Magento 2.
We use the “obscure” field type and
Magento\Config\Model\Config\Backend\Encrypted as the backend_model
In the file <Module_Name>/etc/system.xml add a new field as below:
<field id='magenest_password' translate='label' type='obscure' sortOrder='3' showInDefault='1' showInWebsite='1' showInStore='1'> <label>Password</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field>
After create in System configuration will show this field for input password as image:
You can see that in configuration at the admin panel with the name Password. When you put or type some value then it will convert the value into a password with dot sign.
In short, when creating a field in the back-end, developers need to create an encrypted field for it for security purpose.
READ MORE. How to encrypt and decrypt data in Magento 2 - Magenest Blog
What is SMS Marketing & What does it work in Magento 2?January 21 2021
How to validate custom input fields in Magento 2January 20 2021
How to validate forms in Magento 2January 20 2021
A complete guide to your web push notifications marketingJanuary 18 2021
How to create a date field in Magento 2January 14 2021