Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

Factory does not create Password Element if only Password Attribute is present #7166

@claytondaley

Description

@claytondaley

Issue #2602 added desirable security functionality to the Password Element including:

  • If an Edit form is built from a database object, the password will automatically be excluded from the data sent to the browser

It was later noted that the password attribute (frequently used to identify a password field) is not considered by the Factory:

array(
    'name' => 'something',
    'attributes' => array(
        'type' => 'password',
    ),
    // ...
)

This results in a \Zend\Form\Element instead of a \Zend\Form\Element\Password. To get a password element, the user must explicitly identify the password type in the parent array:

array(
    'name' => 'something',
    'type' => 'Password',
    // ...
)

To be fair, the distinction is real and could theoretically be a desired behavior.

  • At minimum, I would recommend adding a special warning in the documentation, possibly under Factory-Backed Form Extension.
  • However, I also believe this is an obvious spot to "nudge" users by making the most secure assumption (password attribute intends to create a password element). Obviously, a user could override this setting by explicitly asking for a type => text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions