Masking Password fields in Magento Extensions

June 28, 2009

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.

Ashley

Posts

Hi! I'm Ashley Schroder, a Software Engineer from New Zealand - this is a collection of notes on my experiences with Ecommerce Web Development, particularly Magento Development.

Are Your Customers Getting The Magento Emails You Send?

MageSend Magento Email sending with Amazon SES

I have made a premium Magento Extension called MageSend. MageSend makes it simple and easy to send using Amazon's highly reliable SES email service.

The extension is $99, and comes with a complete money back guarantee, please check it out, I am confident it will resolve any email sending problems with your Magento store.

3 responses to Masking Password fields in Magento Extensions

  1. 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.

  2. The above stripped out the needed tag – it’s backend_model enclosed in angled brackets.

  3. 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