Skip to content

Commit

Permalink
Adds password field type support
Browse files Browse the repository at this point in the history
Charms need a way to handle sensitive data without displaying it to the user.
This patch introductes the "password" field type, rendered as an HTML "input"
element with type "password".
  • Loading branch information
alexpilotti committed May 7, 2014
1 parent 82fd869 commit 0ead46b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
35 changes: 25 additions & 10 deletions app/templates/service-configuration.partial
Expand Up @@ -36,16 +36,31 @@
</div>
{{>conflict-ux}}
{{else}}
<label for="input-{{name}}">{{name}} ({{type}})</label>
<div>
<textarea
data-bind="config.{{name}}"
class="config-field"
id="input-{{name}}"
name="{{name}}"
{{#if ../../../ghost}}disabled{{/if}}
>{{value}}</textarea>
</div>
{{#if isPassword}}
<label for="input-{{name}}">{{name}} ({{type}})</label>
<div>
<input
class="config-field"
type="password"
name="{{name}}"
id="input-{{name}}"
value="{{value}}"
data-bind="config.{{name}}"
{{#if ../../../ghost}}disabled{{/if}}
/>
</div>
{{else}}
<label for="input-{{name}}">{{name}} ({{type}})</label>
<div>
<textarea
data-bind="config.{{name}}"
class="config-field"
id="input-{{name}}"
name="{{name}}"
{{#if ../../../ghost}}disabled{{/if}}
>{{value}}</textarea>
</div>
{{/if}}
{{/if}}
{{>conflict-ux}}
{{/if}}
Expand Down
3 changes: 3 additions & 0 deletions app/views/utils.js
Expand Up @@ -825,6 +825,9 @@ YUI.add('juju-view-utils', function(Y) {
if (dataType === 'int' || dataType === 'float') {
entry.isNumeric = true;
}
else if (dataType === 'password') {
entry.isPassword = true;
}

entry.value = config[field_name];
}
Expand Down

0 comments on commit 0ead46b

Please sign in to comment.