Wow, long time, no post – no excuses really*, just been really busy. This post will give you a quick tip for masking password fields in your Magento extensions. I wanted to mask the password in my Google Apps and Gmail Magento Extension and despite a few Google searches, I couldn’t find a simple answer. There’s also not really any good documentation on the various configuration xml files in Magento, it seems.
Thankfully i960 over at the Magento forums gave me this simple tip, which I think should be shared. Here’s how to mask or hide your admin passwords in the backend of Magento. This is particularly useful when creating your own Magento extensions.
In etc/system.xml
add xml like this:
<password translate="label"> <label>Password</label> <frontend_type>password</frontend_type> <sort_order>10</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </password> |
The key being the frontend_type of password in case you hadn’t noticed that.
Anyway expect me to be a bit more active with some Magento tips over the next few weeks.
*In a lot of ways you can blame Amazon for creating some of the worst financial reports I have ever had to work with! Parsing those to pull meaningful information has been like pulling teeth. Anyway I’ll add some feedback on those in an upcomming post.
Hey Ashley,
You can also use this as part of the above declaration in system.xml:
adminhtml/system_config_backend_encrypted
to use Magento’s mechanism to encrypt what is written to the DB.
The above stripped out the needed tag – it’s backend_model enclosed in angled brackets.
Hey Kristof!
Thanks for the tip, and thanks for stopping by. I’m working on a super sweet extension, will talk to you about it when I see you next, hopefully it’ll be ready by then.
ash