Skip to content

Commit

Permalink
700 - make type password configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Kuhlmay committed Jan 15, 2024
1 parent 7235f2f commit a8902a5
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Build/Sources/components/ActionButtonsComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ export const ActionButtonsComponent = (props) => {
"setValuesColorPicker": property.typeColor?.setValuesColorPicker || false,
"colorPickerValues": property.typeColor?.colorPickerValues || '',
},
"typePassword": {
"renderPasswordGenerator": property.typePassword?.renderPasswordGenerator || false,
},
"size": property.size || "",
"minItems": property.minItems || "",
"maxItems": property.maxItems || "",
Expand Down
9 changes: 9 additions & 0 deletions Build/Sources/components/ReactFlow/CustomModelNode.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,15 @@ export const CustomModelNode = (props) => {
}}
/>
</div>)}
{property.type === 'Password' &&(<CheckboxComponent
identifier="renderPasswordGenerator"
label="Render password generator"
initialValue={property.typePassword?.renderPasswordGenerator}
checked={property.typePassword?.renderPasswordGenerator}
onChange={(value) => {
updateProperty(index, "typePassword.renderPasswordGenerator", value);
}} />)
}
{property.type === 'ColorPicker' &&( <CheckboxComponent
label="Set values for color picker"
identifier="setValuesColorPicker"
Expand Down
15 changes: 15 additions & 0 deletions Classes/Domain/Model/DomainObject/AbstractProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ abstract class AbstractProperty
protected bool $setValuesColorPicker = false;
protected array $colorPickerValues = [];

// Password
protected bool $renderPasswordGenerator = false;

public function __construct(string $propertyName = '')
{
if (!empty($propertyName)) {
Expand Down Expand Up @@ -659,4 +662,16 @@ public function setSteps(float|int $steps): void
{
$this->steps = $steps;
}

public function isRenderPasswordGenerator(): bool
{
return $this->renderPasswordGenerator;
}

public function setRenderPasswordGenerator(bool $renderPasswordGenerator): void
{
$this->renderPasswordGenerator = $renderPasswordGenerator;
}


}
3 changes: 3 additions & 0 deletions Classes/Service/ObjectSchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ public static function buildProperty(array $propertyJsonConfiguration): Abstract
if (isset($propertyJsonConfiguration['typeColor']['colorPickerValues'])) {
$property->setColorPickerValues($propertyJsonConfiguration['typeColor']['colorPickerValues']);
}
if (isset($propertyJsonConfiguration['typePassword']['renderPasswordGenerator'])) {
$property->setRenderPasswordGenerator((bool)$propertyJsonConfiguration['typePassword']['renderPasswordGenerator']);
}

return $property;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
[
'type' => 'input',
'size' => 30,
'eval' => 'nospace,password<f:if condition="{property.required}">,required</f:if><f:if condition="{property.nullable}">,null</f:if>',
'type' => 'password',<f:if condition="{property.required}">
'required' => true,</f:if><f:if condition="{property.nullable}">
'nullable' => true,</f:if>
'hashed' => true,<f:if condition="{property.renderPasswordGenerator}">
'fieldControl' => [
'passwordGenerator' => [
'renderType' => 'passwordGenerator',
],
],</f:if>
'default' => <f:if condition="{property.nullable}"><f:then>null</f:then><f:else>''</f:else></f:if>
]
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/main.js

Large diffs are not rendered by default.

0 comments on commit a8902a5

Please sign in to comment.