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

Merge pull request #6983 from mabashian/6967-prompt-credential-password

Fixed ask password on launch bug
This commit is contained in:
Michael Abashian 2017-07-12 09:57:54 -04:00 committed by GitHub
commit 1a46b5d2b7
2 changed files with 41 additions and 54 deletions

View File

@ -73,49 +73,10 @@ export default
$scope.ssh_password_required = false;
$scope.ssh_key_unlock_required = false;
$scope.become_password_required = false;
$scope.vault_password_required = false;
$scope.ssh_password = "";
$scope.ssh_key_unlock = "";
$scope.become_password = "";
$scope.vault_password = "";
};
var updateRequiredPasswords = function() {
if($scope.selected_credentials.machine) {
if($scope.selected_credentials.machine.id === $scope.defaults.credential.id) {
clearRequiredPasswords();
for(var i=0; i<$scope.passwords_needed_to_start.length; i++) {
var password = $scope.passwords_needed_to_start[i];
switch(password) {
case "ssh_password":
$scope.ssh_password_required = true;
break;
case "ssh_key_unlock":
$scope.ssh_key_unlock_required = true;
break;
case "become_password":
$scope.become_password_required = true;
break;
case "vault_password":
$scope.vault_password_required = true;
break;
}
}
}
else {
if($scope.selected_credentials.machine.kind === "ssh"){
$scope.ssh_password_required = ($scope.selected_credentials.machine.password === "ASK") ? true : false;
$scope.ssh_key_unlock_required = ($scope.selected_credentials.machine.ssh_key_unlock === "ASK") ? true : false;
$scope.become_password_required = ($scope.selected_credentials.machine.become_password === "ASK") ? true : false;
$scope.vault_password_required = ($scope.selected_credentials.machine.vault_password === "ASK") ? true : false;
}
else {
clearRequiredPasswords();
}
}
}
};
var launchJob = function() {
@ -158,7 +119,33 @@ export default
}
$scope.$watch('selected_credentials.machine', function(){
updateRequiredPasswords();
if($scope.selected_credentials.machine) {
if($scope.selected_credentials.machine.id === $scope.defaults.credential.id) {
clearRequiredPasswords();
for(var i=0; i<$scope.passwords_needed_to_start.length; i++) {
var password = $scope.passwords_needed_to_start[i];
switch(password) {
case "ssh_password":
$scope.ssh_password_required = true;
break;
case "ssh_key_unlock":
$scope.ssh_key_unlock_required = true;
break;
case "become_password":
$scope.become_password_required = true;
break;
}
}
}
else {
$scope.ssh_password_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.password === "ASK") ? true : false;
$scope.ssh_key_unlock_required = ($scope.selected_credentials.machine.inputs && $scope.selected_credentials.machine.inputs.ssh_key_unlock === "ASK") ? true : false;
$scope.become_password_required = $scope.selected_credentials.machine.inputs && ($scope.selected_credentials.machine.inputs.become_password === "ASK") ? true : false;
}
}
else {
clearRequiredPasswords();
}
});
// Get the job or job_template record

View File

@ -97,8 +97,8 @@
<div class="JobSubmission-instructions" translate>Launching this job requires the passwords listed below. Enter and confirm each password before continuing.</div>
<form name="forms.credentialpasswords" autocomplete="off" novalidate>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ssh_password_required">
<label for="ssh_password">
<span class="Form-inputLabel prepend-asterisk" translate> Password</span>
<label for="ssh_password" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Password</span>
</label>
<div class="input-group">
<span class="input-group-btn">
@ -110,8 +110,8 @@
<div class="error api-error" ng-bind="ssh_password_api_error"></div>
</div>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ssh_key_unlock_required">
<label for="ssh_key_unlock">
<span class="Form-inputLabel prepend-asterisk" translate> Private Key Passphrase</span>
<label for="ssh_key_unlock" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Private Key Passphrase</span>
</label>
<div class="input-group">
<span class="input-group-btn">
@ -123,8 +123,8 @@
<div class="error api-error" ng-bind="ssh_key_unlock_api_error"></div>
</div>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="become_password_required">
<label for="become_password">
<span class="Form-inputLabel prepend-asterisk" translate> Privilege Escalation Password</span>
<label for="become_password" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Privilege Escalation Password</span>
</label>
<div class="input-group">
<span class="input-group-btn">
@ -136,8 +136,8 @@
<div class="error api-error" ng-bind="become_password_api_error"></div>
</div>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="vault_password_required">
<label for="vault_password">
<span class="Form-inputLabel prepend-asterisk" translate> Vault Password</span>
<label for="vault_password" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Vault Password</span>
</label>
<div class="input-group">
<span class="input-group-btn">
@ -172,8 +172,8 @@
</div>
</div>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ask_verbosity_on_launch">
<label for="verbosity">
<span class="Form-inputLabel prepend-asterisk" translate> Verbosity</span>
<label for="verbosity" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Verbosity</span>
</label>
<div>
<select
@ -190,8 +190,8 @@
</div>
</div>
<div class="form-group Form-formGroup Form-formGroup--singleColumn" ng-if="ask_job_type_on_launch">
<label for="job_type">
<span class="Form-inputLabel prepend-asterisk" translate> Job Type</span>
<label for="job_type" class="prepend-asterisk Form-inputLabelContainer">
<span class="Form-inputLabel" translate> Job Type</span>
</label>
<div>
<select
@ -255,8 +255,8 @@
<div ng-if="survey_enabled" ng-show="step === 'survey'" class="JobSubmission-form">
<form name="forms.survey" autocomplete="off" novalidate>
<div ng-repeat="question in survey_questions" id="taker_'+question.index+'" class="form-group Form-formGroup Form-formGroup--singleColumn">
<label ng-attr-for="{{question.variable}}">
<span class="label-text Form-inputLabel" ng-class="{'prepend-asterisk': question.required===true}"> {{question.question_name}}</span>
<label ng-attr-for="{{question.variable}}" class="Form-inputLabelContainer" ng-class="{'prepend-asterisk': question.required===true}">
<span class="label-text Form-inputLabel"> {{question.question_name}}</span>
</label>
<div class="survey_taker_description" ng-if="question.question_description">