1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 09:51:09 +03:00

Fixed bug where typing in a password would update all password inputs

This commit is contained in:
mabashian 2018-04-10 10:26:56 -04:00
parent a6dd7dbf07
commit c8b12ed23e

View File

@ -51,11 +51,14 @@ export default
} else if(cred.inputs && !_.isEmpty(cred.inputs)) { } else if(cred.inputs && !_.isEmpty(cred.inputs)) {
if(cred.inputs.password && cred.inputs.password === "ASK") { if(cred.inputs.password && cred.inputs.password === "ASK") {
delete scope.promptData.prompts.credentials.passwords.ssh; delete scope.promptData.prompts.credentials.passwords.ssh;
} else if(cred.inputs.become_password && cred.inputs.become_password === "ASK") { }
if(cred.inputs.become_password && cred.inputs.become_password === "ASK") {
delete scope.promptData.prompts.credentials.passwords.become; delete scope.promptData.prompts.credentials.passwords.become;
} else if(cred.inputs.ssh_key_unlock && cred.inputs.ssh_key_unlock === "ASK") { }
if(cred.inputs.ssh_key_unlock && cred.inputs.ssh_key_unlock === "ASK") {
delete scope.promptData.prompts.credentials.passwords.ssh_key_unlock; delete scope.promptData.prompts.credentials.passwords.ssh_key_unlock;
} else if(cred.inputs.vault_password && cred.inputs.vault_password === "ASK") { }
if(cred.inputs.vault_password && cred.inputs.vault_password === "ASK") {
for (let i = scope.promptData.prompts.credentials.passwords.vault.length - 1; i >= 0; i--) { for (let i = scope.promptData.prompts.credentials.passwords.vault.length - 1; i >= 0; i--) {
if(cred.id === scope.promptData.prompts.credentials.passwords.vault[i].id) { if(cred.id === scope.promptData.prompts.credentials.passwords.vault[i].id) {
scope.promptData.prompts.credentials.passwords.vault.splice(i, 1); scope.promptData.prompts.credentials.passwords.vault.splice(i, 1);
@ -68,25 +71,33 @@ export default
let updateNeededPasswords = (cred) => { let updateNeededPasswords = (cred) => {
if(cred.inputs) { if(cred.inputs) {
let credPassObj = { if(cred.inputs.password && cred.inputs.password === "ASK") {
scope.promptData.prompts.credentials.passwords.ssh = {
id: cred.id, id: cred.id,
name: cred.name name: cred.name
}; };
if(cred.inputs.password && cred.inputs.password === "ASK") {
scope.promptData.prompts.credentials.passwords.ssh = credPassObj;
} }
if(cred.inputs.become_password && cred.inputs.become_password === "ASK") { if(cred.inputs.become_password && cred.inputs.become_password === "ASK") {
scope.promptData.prompts.credentials.passwords.become = credPassObj; scope.promptData.prompts.credentials.passwords.become = {
id: cred.id,
name: cred.name
};
} }
if(cred.inputs.ssh_key_unlock && cred.inputs.ssh_key_unlock === "ASK") { if(cred.inputs.ssh_key_unlock && cred.inputs.ssh_key_unlock === "ASK") {
scope.promptData.prompts.credentials.passwords.ssh_key_unlock = credPassObj; scope.promptData.prompts.credentials.passwords.ssh_key_unlock = {
id: cred.id,
name: cred.name
};
} }
if(cred.inputs.vault_password && cred.inputs.vault_password === "ASK") { if(cred.inputs.vault_password && cred.inputs.vault_password === "ASK") {
credPassObj.vault_id = cred.inputs.vault_id;
if(!scope.promptData.prompts.credentials.passwords.vault) { if(!scope.promptData.prompts.credentials.passwords.vault) {
scope.promptData.prompts.credentials.passwords.vault = []; scope.promptData.prompts.credentials.passwords.vault = [];
} }
scope.promptData.prompts.credentials.passwords.vault.push(credPassObj); scope.promptData.prompts.credentials.passwords.vault.push({
id: cred.id,
name: cred.name,
vault_id: cred.inputs.vault_id
});
} }
} }
}; };