Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] Explain how <PasswordInput> can be used to update a password #9354

Merged
merged 4 commits into from
Oct 13, 2023

Conversation

fzaninotto
Copy link
Member

Problem

The doc doesn't explain how to use <PasswordInput> in Edit view. This may lead developers to expose passwords in clear.

Solution

Be very clear about never exposing password, even in the Edition view.

@@ -47,3 +57,22 @@ Set the [`autocomplete` attribute](https://developer.mozilla.org/en-US/docs/Web/
<PasswordInput source="password" inputProps={{ autocomplete: 'current-password' }} />
```
{% endraw %}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to explain how to have 2 password inputs, and how to validate that they are equal.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explained.


## Validating Identical Passwords

If you want to validate that the user has entered the same password in two different password inputs, you must use [global validation](./Validation.md#global-validation) at the form level:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, validators have access to the other form values, so you could write an equalToFieldValidator:

const equalToFieldValidator = (source: string) => (value: any, allValues: FormValues) => ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

docs/PasswordInput.md Outdated Show resolved Hide resolved
docs/PasswordInput.md Outdated Show resolved Hide resolved
docs/PasswordInput.md Outdated Show resolved Hide resolved
docs/PasswordInput.md Outdated Show resolved Hide resolved
Co-authored-by: adrien guernier <adrien@marmelab.com>
@djhi djhi added this to the 4.15.1 milestone Oct 13, 2023
@djhi djhi merged commit a21dd75 into master Oct 13, 2023
5 checks passed
@djhi djhi deleted the doc-update-password branch October 13, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants