Add Secure Text option for prompts (#1036)

* Add Secure Text option for prompts closes #962

* Change prompt secure text name
This commit is contained in:
Phillip Lanclos 2018-07-05 16:44:45 -05:00 committed by Gregory Schier
parent 26e9b646bd
commit caeb642fd2

View File

@ -38,9 +38,23 @@ module.exports.templateTags = [
'If this is set, the value will be stored in memory under this key until the app is ' + 'If this is set, the value will be stored in memory under this key until the app is ' +
"closed. To force this tag to re-prompt the user, simply change this key's value to " + "closed. To force this tag to re-prompt the user, simply change this key's value to " +
'something else.' 'something else.'
},
{
displayName: 'Mask Text',
type: 'boolean',
help:
'If this is enabled, the value when input will be masked like a password field.',
defaultValue: false
} }
], ],
async run(context, title, label, defaultValue, explicitStorageKey) { async run(
context,
title,
label,
defaultValue,
explicitStorageKey,
maskText
) {
if (!title) { if (!title) {
throw new Error('Title attribute is required for prompt tag'); throw new Error('Title attribute is required for prompt tag');
} }
@ -60,7 +74,8 @@ module.exports.templateTags = [
const value = await context.app.prompt(title || 'Enter Value', { const value = await context.app.prompt(title || 'Enter Value', {
label, label,
defaultValue defaultValue,
inputType: maskText ? 'password' : 'text'
}); });
if (storageKey) { if (storageKey) {