Skip to content

Commit

Permalink
💥 [#3283] Remove password Formio component
Browse files Browse the repository at this point in the history
This component never made sense, it was only added reluctantly because
the original programme of requirements specified it.

Passwords being stored in plain text are a terrible, terrible idea.
Nobody should have every actually used this in a real form.
  • Loading branch information
sergei-maertens committed Nov 21, 2024
1 parent e4fb7bb commit 1e1cb1a
Show file tree
Hide file tree
Showing 19 changed files with 2 additions and 713 deletions.
15 changes: 0 additions & 15 deletions src/openforms/formio/components/vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
EmailFormatter,
FileFormatter,
NumberFormatter,
PasswordFormatter,
PhoneNumberFormatter,
RadioFormatter,
SelectBoxesFormatter,
Expand Down Expand Up @@ -503,20 +502,6 @@ def build_serializer_field(
return serializers.ListField(child=base) if multiple else base


@register("password")
class Password(BasePlugin):
formatter = PasswordFormatter

def build_serializer_field(
self, component: Component
) -> serializers.CharField | serializers.ListField:
multiple = component.get("multiple", False)
validate = component.get("validate", {})
required = validate.get("required", False)
base = serializers.CharField(required=required, allow_blank=not required)
return serializers.ListField(child=base) if multiple else base


def validate_required_checkbox(value: bool) -> None:
"""
A required checkbox in Formio terms means it *must* be checked.
Expand Down
7 changes: 0 additions & 7 deletions src/openforms/formio/formatters/formio.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@ def format(self, component: Component, value: int | float) -> str:
return number_format(value, decimal_pos=component.get("decimalLimit"))


class PasswordFormatter(FormatterBase):
def format(self, component: Component, value: str) -> str:
# TODO legacy just printed as-is, but we might want to use unicode-dots or stars
# return "\u25CF" * len(value)
return str(value)


class CheckboxFormatter(FormatterBase):
def format(self, component: Component, value: bool) -> str:
return str(yesno(value))
Expand Down
80 changes: 0 additions & 80 deletions src/openforms/formio/formatters/tests/files/all_components.json
Original file line number Diff line number Diff line change
Expand Up @@ -1626,86 +1626,6 @@
"confirmationRecipient": false,
"allowCalculateOverride": false
},
{
"id": "eek7yb",
"key": "password",
"mask": false,
"type": "password",
"input": true,
"label": "Password",
"hidden": false,
"prefix": "",
"suffix": "",
"unique": false,
"widget": {
"type": "input"
},
"dbIndex": false,
"overlay": {
"top": "",
"left": "",
"style": "",
"width": "",
"height": ""
},
"tooltip": "",
"disabled": false,
"multiple": false,
"redrawOn": "",
"tabindex": "",
"validate": {
"custom": "",
"unique": false,
"pattern": "",
"plugins": [],
"multiple": false,
"required": false,
"maxLength": "",
"minLength": "",
"customPrivate": false,
"strictDateValidation": false
},
"autofocus": false,
"encrypted": false,
"hideLabel": false,
"inputMask": "",
"inputType": "text",
"modalEdit": false,
"protected": true,
"refreshOn": "",
"tableView": false,
"attributes": {},
"errorLabel": "",
"persistent": true,
"properties": {},
"spellcheck": true,
"validateOn": "change",
"clearOnHide": true,
"conditional": {
"eq": "",
"show": null,
"when": null
},
"customClass": "",
"description": "",
"inputFormat": "plain",
"placeholder": "",
"showInEmail": false,
"defaultValue": null,
"registration": {
"attribute": ""
},
"dataGridLabel": false,
"labelPosition": "top",
"showCharCount": false,
"showWordCount": false,
"calculateValue": "",
"calculateServer": false,
"isSensitiveData": true,
"allowMultipleMasks": false,
"customDefaultValue": "",
"allowCalculateOverride": false
},
{
"id": "ede8s0n",
"key": "licenseplate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"radio": "option2",
"number": 42.123,
"select": "option1",
"password": "secret",
"postcode": "1234 AA",
"textArea": "Textarea test",
"signature": "data:image/png;base64,iVBO[truncated]",
Expand Down
Loading

0 comments on commit 1e1cb1a

Please sign in to comment.