mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 06:58:06 -03:30
adding 'sensitive' field to survey taker
for password fields
This commit is contained in:
parent
96659ac657
commit
ef5d3372db
@ -517,6 +517,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
|
||||
checked, min, max,
|
||||
survey_url = GetBasePath('job_templates') + id + '/survey_spec/' ;
|
||||
|
||||
//for toggling the input on password inputs
|
||||
scope.toggleInput = function(id) {
|
||||
var buttonId = id + "_show_input_button",
|
||||
inputId = id,
|
||||
buttonInnerHTML = $(buttonId).html();
|
||||
if (buttonInnerHTML.indexOf("ABC") > -1) {
|
||||
$(buttonId).html("<i class=\"fa fa-asterisk\"></i><i class=\"fa fa-asterisk\"></i><i class=\"fa fa-asterisk\"></i>");
|
||||
$(inputId).attr("type", "text");
|
||||
} else {
|
||||
$(buttonId).html("ABC");
|
||||
$(inputId).attr("type", "password");
|
||||
}
|
||||
};
|
||||
|
||||
function buildHtml(question, index){
|
||||
question.index = index;
|
||||
question.question_name = $filter('sanitize')(question.question_name);
|
||||
@ -573,28 +587,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
|
||||
if(question.type === 'password' ){
|
||||
minlength = (!Empty(question.min)) ? Number(question.min) : "";
|
||||
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
|
||||
html+='<input type="password" id="'+question.variable+'_password" ng-model="'+question.variable+'" '+
|
||||
'name=" '+question.variable+' " ' +
|
||||
'ng-hide="'+question.variable+'_pwcheckbox" ' +
|
||||
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
||||
'class="form-control" ng-required='+question.required+'>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$dirty && ' +
|
||||
'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.</div>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$error.minlength || ' +
|
||||
'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.</div>'+
|
||||
'<div class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></div>';
|
||||
html+='<input type="text" id="'+question.variable+'_text" ng-model="'+question.variable+'" '+
|
||||
'name=" '+question.variable+' " ' +
|
||||
'ng-show="'+question.variable+'_pwcheckbox"'+
|
||||
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
||||
'class="form-control" ng-required='+question.required+'>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$dirty && ' +
|
||||
'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.</div>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$error.minlength || ' +
|
||||
'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.</div>'+
|
||||
'<div class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></div>';
|
||||
html+= '<label style="font-weight:normal"><input type="checkbox" ng-model="'+question.variable+'_pwcheckbox" name="pwcheckbox" id="'+question.variable+'_pwcheckbox" ng-checked="false"> <span>Show Password</span></label>';
|
||||
|
||||
html+= '<div class="input-group">'+
|
||||
'<span class="input-group-btn">'+
|
||||
'<button class="btn btn-default" id="'+question.variable +'_show_input_button" aw-tool-tip="Toggle the display of plaintext." aw-tip-placement="top" ng-click="toggleInput("#'+question.variable+'")" data-original-title="" title="">ABC</button>'+
|
||||
'</span>'+
|
||||
'<input id="'+question.variable+'" type="password" ng-model="'+question.variable+'" name="'+question.variable+'" '+
|
||||
'ng-required="'+question.required+'"'+
|
||||
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
||||
'class="form-control ng-pristine ng-valid-api-error ng-invalid" autocomplete="false">'+
|
||||
'</div>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$dirty && ' +
|
||||
'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.</div>'+
|
||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$error.minlength || ' +
|
||||
'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.</div>'+
|
||||
'<div class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></div>';
|
||||
}
|
||||
if(question.type === 'multiplechoice'){
|
||||
choices = question.choices.split(/\n/);
|
||||
|
||||
@ -332,9 +332,13 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper',
|
||||
defaultValue = $filter('sanitize')(defaultValue);
|
||||
defaultValue = scope.serialize(defaultValue);
|
||||
html+='<div class="row">'+
|
||||
'<div class="col-xs-8">'+
|
||||
'<input type="password" value="'+defaultValue+'" class="form-control ng-pristine ng-invalid-required ng-invalid final" required="" readonly>'+
|
||||
'</div></div>';
|
||||
' <div class="col-xs-8 input_area input-group">'+
|
||||
'<span class="input-group-btn">'+
|
||||
'<button class="btn btn-default survey-maker-password" id="'+question.variable+'_show_input_button" aw-tool-tip="Toggle the display of plaintext." aw-tip-placement="top" ng-click="toggleInput("#'+question.variable+'")" data-original-title="" title="">ABC</button>'+
|
||||
'</span>'+
|
||||
'<input id="'+ question.variable +'" type="password" ng-model="default_password" name="'+ question.variable +'" class="form-control ng-pristine ng-valid-api-error ng-invalid" autocomplete="false" readonly>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
}
|
||||
|
||||
if(question.type === 'integer'){
|
||||
|
||||
@ -39,7 +39,11 @@
|
||||
border-radius: 4px;
|
||||
padding: 5px;
|
||||
position: relative;
|
||||
|
||||
|
||||
.survey-maker-password{
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.final{
|
||||
margin-left: 15px;
|
||||
margin-top: 5px;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user