mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
reword error message about encrypted user input
This commit is contained in:
committed by
Matthew Jones
parent
f93506fe2c
commit
1c374fba7d
@@ -2900,16 +2900,19 @@ class JobTemplateSurveySpec(GenericAPIView):
|
|||||||
|
|
||||||
if survey_item["type"] == "password" and "default" in survey_item:
|
if survey_item["type"] == "password" and "default" in survey_item:
|
||||||
if not isinstance(survey_item['default'], six.string_types):
|
if not isinstance(survey_item['default'], six.string_types):
|
||||||
return Response(
|
return Response(dict(error=_(
|
||||||
_("Value %s for '%s' expected to be a string." % (
|
"Value {question_default} for '{variable_name}' expected to be a string."
|
||||||
survey_item["default"], survey_item["variable"]
|
).format(
|
||||||
)),
|
question_default=survey_item["default"], variable_name=survey_item["variable"])
|
||||||
status=status.HTTP_400_BAD_REQUEST
|
), status=status.HTTP_400_BAD_REQUEST)
|
||||||
)
|
|
||||||
elif survey_item["default"].startswith('$encrypted$'):
|
elif survey_item["default"].startswith('$encrypted$'):
|
||||||
if not obj.survey_spec:
|
if not obj.survey_spec:
|
||||||
return Response(dict(error=_("$encrypted$ is reserved keyword and may not be used as a default for password {}.".format(str(idx)))),
|
return Response(dict(error=_(
|
||||||
status=status.HTTP_400_BAD_REQUEST)
|
"$encrypted$ is reserved keyword for password questions and may not "
|
||||||
|
"be used as a default for '{variable_name}' in survey question {question_position}."
|
||||||
|
).format(
|
||||||
|
variable_name=survey_item["variable"], question_position=str(idx))
|
||||||
|
), status=status.HTTP_400_BAD_REQUEST)
|
||||||
else:
|
else:
|
||||||
old_spec = obj.survey_spec
|
old_spec = obj.survey_spec
|
||||||
for old_item in old_spec['spec']:
|
for old_item in old_spec['spec']:
|
||||||
|
|||||||
Reference in New Issue
Block a user