diff --git a/awx/ui/client/src/credentials/credentials.form.js b/awx/ui/client/src/credentials/credentials.form.js index f8c0440725..b6b3e7f905 100644 --- a/awx/ui/client/src/credentials/credentials.form.js +++ b/awx/ui/client/src/credentials/credentials.form.js @@ -292,7 +292,7 @@ export default ['i18n', function(i18n) { ngChange: 'becomeMethodChange()', }, "become_username": { - labelBind: 'becomeUsernameLabel', + label: i18n._('Privilege Escalation Username'), type: 'text', ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ", @@ -302,7 +302,7 @@ export default ['i18n', function(i18n) { ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)' }, "become_password": { - labelBind: 'becomePasswordLabel', + label: i18n._('Privilege Escalation Password'), type: 'sensitive', ngShow: "(kind.value == 'ssh' && (become_method && become_method.value)) ", ngDisabled: "become_password_ask || !(credential_obj.summary_fields.user_capabilities.edit || canAdd)", diff --git a/awx/ui/client/src/credentials/factories/become-method-change.factory.js b/awx/ui/client/src/credentials/factories/become-method-change.factory.js index 0727553528..2d85acaf35 100644 --- a/awx/ui/client/src/credentials/factories/become-method-change.factory.js +++ b/awx/ui/client/src/credentials/factories/become-method-change.factory.js @@ -15,8 +15,6 @@ export default break; case 'ssh': scope.usernameLabel = i18n._('Username'); //formally 'SSH Username' - scope.becomeUsernameLabel = i18n._('Privilege Escalation Username'); - scope.becomePasswordLabel = i18n._('Privilege Escalation Password'); break; case 'scm': scope.sshKeyDataLabel = i18n._('SCM Private Key'); diff --git a/awx/ui/client/src/credentials/factories/kind-change.factory.js b/awx/ui/client/src/credentials/factories/kind-change.factory.js index e35bedc526..7232d8a188 100644 --- a/awx/ui/client/src/credentials/factories/kind-change.factory.js +++ b/awx/ui/client/src/credentials/factories/kind-change.factory.js @@ -72,8 +72,6 @@ export default break; case 'ssh': scope.usernameLabel = i18n._('Username'); //formally 'SSH Username' - scope.becomeUsernameLabel = i18n._('Privilege Escalation Username'); - scope.becomePasswordLabel = i18n._('Privilege Escalation Password'); break; case 'scm': scope.sshKeyDataLabel = i18n._('SCM Private Key'); diff --git a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js b/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js index 4f6089f7e2..06d6566168 100644 --- a/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js +++ b/awx/ui/client/src/job-submission/job-submission-factories/check-passwords.factory.js @@ -1,5 +1,5 @@ export default - function CheckPasswords(Rest, GetBasePath, ProcessErrors, Empty) { + function CheckPasswords(Rest, GetBasePath, ProcessErrors, Empty, credentialTypesLookup) { return function(params) { var scope = params.scope, callback = params.callback, @@ -10,21 +10,25 @@ export default Rest.setUrl(GetBasePath('credentials')+credential); Rest.get() .success(function (data) { - if(data.kind === "ssh"){ - if(data.password === "ASK" ){ - passwords.push("ssh_password"); - } - if(data.ssh_key_unlock === "ASK"){ - passwords.push("ssh_key_unlock"); - } - if(data.become_password === "ASK"){ - passwords.push("become_password"); - } - if(data.vault_password === "ASK"){ - passwords.push("vault_password"); - } - } - scope.$emit(callback, passwords); + credentialTypesLookup() + .then(kinds => { + if(data.credential_type === kinds.Machine && data.inputs){console.log(data.inputs); + if(data.inputs.password === "ASK" ){ + passwords.push("ssh_password"); + } + if(data.inputs.ssh_key_unlock === "ASK"){ + passwords.push("ssh_key_unlock"); + } + if(data.inputs.become_password === "ASK"){ + passwords.push("become_password"); + } + if(data.inputs.vault_password === "ASK"){ + passwords.push("vault_password"); + } + } + scope.$emit(callback, passwords); + }); + }) .error(function (data, status) { ProcessErrors(scope, data, status, null, { hdr: 'Error!', @@ -39,5 +43,6 @@ CheckPasswords.$inject = [ 'Rest', 'GetBasePath', 'ProcessErrors', - 'Empty' + 'Empty', + 'credentialTypesLookup' ];