mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
adding 'sensitive' field to survey taker
for password fields
This commit is contained in:
@@ -517,6 +517,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
|
|||||||
checked, min, max,
|
checked, min, max,
|
||||||
survey_url = GetBasePath('job_templates') + id + '/survey_spec/' ;
|
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){
|
function buildHtml(question, index){
|
||||||
question.index = index;
|
question.index = index;
|
||||||
question.question_name = $filter('sanitize')(question.question_name);
|
question.question_name = $filter('sanitize')(question.question_name);
|
||||||
@@ -573,28 +587,20 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
|
|||||||
if(question.type === 'password' ){
|
if(question.type === 'password' ){
|
||||||
minlength = (!Empty(question.min)) ? Number(question.min) : "";
|
minlength = (!Empty(question.min)) ? Number(question.min) : "";
|
||||||
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
|
maxlength =(!Empty(question.max)) ? Number(question.max) : "" ;
|
||||||
html+='<input type="password" id="'+question.variable+'_password" ng-model="'+question.variable+'" '+
|
html+= '<div class="input-group">'+
|
||||||
'name=" '+question.variable+' " ' +
|
'<span class="input-group-btn">'+
|
||||||
'ng-hide="'+question.variable+'_pwcheckbox" ' +
|
'<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>'+
|
||||||
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
'</span>'+
|
||||||
'class="form-control" ng-required='+question.required+'>'+
|
'<input id="'+question.variable+'" type="password" ng-model="'+question.variable+'" name="'+question.variable+'" '+
|
||||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$dirty && ' +
|
'ng-required="'+question.required+'"'+
|
||||||
'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.</div>'+
|
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
||||||
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$error.minlength || ' +
|
'class="form-control ng-pristine ng-valid-api-error ng-invalid" autocomplete="false">'+
|
||||||
'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.</div>'+
|
'</div>'+
|
||||||
'<div class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></div>';
|
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$dirty && ' +
|
||||||
html+='<input type="text" id="'+question.variable+'_text" ng-model="'+question.variable+'" '+
|
'job_launch_form.'+question.variable+'.$error.required\">Please enter an answer.</div>'+
|
||||||
'name=" '+question.variable+' " ' +
|
'<div class="error survey_error" ng-show="job_launch_form.'+ question.variable + '.$error.minlength || ' +
|
||||||
'ng-show="'+question.variable+'_pwcheckbox"'+
|
'job_launch_form.'+question.variable+'.$error.maxlength\">Please enter an answer between {{'+minlength+'}} to {{'+maxlength+'}} characters long.</div>'+
|
||||||
'ng-minlength="'+minlength+'" ng-maxlength="'+maxlength+'" '+
|
'<div class=\"error api-error\" ng-bind=\"" + fld + "_api_error\"></div>';
|
||||||
'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>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(question.type === 'multiplechoice'){
|
if(question.type === 'multiplechoice'){
|
||||||
choices = question.choices.split(/\n/);
|
choices = question.choices.split(/\n/);
|
||||||
|
|||||||
@@ -332,9 +332,13 @@ angular.module('SurveyHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper',
|
|||||||
defaultValue = $filter('sanitize')(defaultValue);
|
defaultValue = $filter('sanitize')(defaultValue);
|
||||||
defaultValue = scope.serialize(defaultValue);
|
defaultValue = scope.serialize(defaultValue);
|
||||||
html+='<div class="row">'+
|
html+='<div class="row">'+
|
||||||
'<div class="col-xs-8">'+
|
' <div class="col-xs-8 input_area input-group">'+
|
||||||
'<input type="password" value="'+defaultValue+'" class="form-control ng-pristine ng-invalid-required ng-invalid final" required="" readonly>'+
|
'<span class="input-group-btn">'+
|
||||||
'</div></div>';
|
'<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'){
|
if(question.type === 'integer'){
|
||||||
|
|||||||
@@ -39,7 +39,11 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
.survey-maker-password{
|
||||||
|
margin-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
.final{
|
.final{
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
|
|||||||
Reference in New Issue
Block a user