In config setting make a field "password type"

for my module settings page (in config) I want to make one of the text fields a password field. Is that possible?

Use EncodedStringField instead of StringField.

Then in a static block or wherever you can configure a different editor:

Password.getFormMeta().setEditorSource(PasswordEditorSource.getSharedInstance());
1 Like

There’s also SinglePasswordEditorSource.getSharedInstance(), which nothing appears to use but I assume it does work…

The difference is that the PasswordEditorSource uses 2 fields that must have the same value entered by the user. This is for when you are setting up the expected value of password for something.

The single field version is more appropriate when you’re entering the password for a remote system and a typo will not result in setting up a password you don’t know the value for any more.

Unfortunately it doesn’t appear anything in Ignition uses the single field version even if it would be more appropriate…

Thanks so much this worked

Follow up: In my config-> module settings, the password field is always empty, so if I make a change to any other setting on that page and click save it throws an error that password field isn’t there. However, I don’t want my users to have to enter the password everytime they are making a change to any other setting.

How can i change this?

Cheers!

Did you use the SinglePasswordEditorSource or the normal one?

I used SinglePasswordEditorSource.

public static final EncodedStringField LocalAdminPassword = new EncodedStringField(META, "local_admin_password", SFieldFlags.SMANDATORY).setDefault("secure_password");
    static {
        LocalAdminPassword.getFormMeta().setEditorSource(SinglePasswordEditorSource.getSharedInstance());
    }

Can you try it with the normal one? I think perhaps the reason the SinglePasswordEditorSource is not used anywhere is because it is broken in the way that you are seeing…

I tried it. It showed up as two fields with the field label as Password, as opposed to a different label i am using

I’m faced with this same issue - I don’t want my users to have to retype multiple long server keys (with the PasswordEditorSource), but I can’t get them to save, and reappear using SinglePasswordEditorSource. Any updates or advice on this one?