Security

Delete or change generated "Confirm Password" field in setup.xml

msivill_splunk
Splunk Employee
Splunk Employee

I'm building a modular input that needs to keep an "API key" secret. This can be done by making the "API key" field a password field in setup.xml.

Snippet from file below

<element name="api_key" type="password" label="API key">
          <view name="edit"/>
          <view name="create"/>
          <key name="exampleText">Private API Key</key>
</element>

However this generates a second confirmation field with the text "Confirm Password" in the form. Given my field is "API Key" can I change this second generated fields text to "Confirm API key" or some how remove the second field?

0 Karma

Flynt
Splunk Employee
Splunk Employee

OK so I messed with this for a minute and came up with this (add it within your block statement in setup.xml)

<text>
    <![CDATA[ <script type="text/javascript">
       $(function() {
           console.log($('label[for*="user_token_id_confirm"]'))
           $('label[for*="user_token_id_confirm"]').html("Confirm User Token")
           $('label[for*="data_token_id_confirm"]').html("Confirm Data Token")
        });
     </script> ]]>
 </text>

Obviously the console.log can be removed, I used that in Chrome's Inspect so I can see I'm getting the right values

I have two input fields in my setup xml, user_token and data_token. Using the jquery selector on the confirm fields to get their labels, I then change the label text to be whatever I want.

Hope this helps.

msivill_splunk
Splunk Employee
Splunk Employee

Do you happen to have the full example to hand? I'm have trouble getting the javascript to be rendered. When I view the html source the javascript is not appearing.

0 Karma

hortonew
Builder
<setup>
  <block title="Title of page">
    <text>All fields are required.</text>
  </block>

  <block title="Add new credentials" endpoint="storage/passwords" entity="_new">
    <input field="name">
      <label>Account ID</label>
      <type>text</type>
    </input>

    <input field="password">
      <label>API Key</label>
      <type>password</type>
    </input>
    <text>
        <![CDATA[ <script type="text/javascript">
            $(function() {
                $('label[for*="password_id_confirm"]').html("Confirm API Key")
             });
        </script> ]]>
    </text>
  </block>
</setup>

msivill_splunk
Splunk Employee
Splunk Employee

Thank you for your response I've moved on from this project and am unlikely to be testing the above solution any time soon. Hopefully, somebody else will find the solution useful and upvote it. Thanks again.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...