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

WIP: Revisit - Update password reset page to use only react-form capabilities #23147

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

hide212131
Copy link
Contributor

A PR to continue the discussion from #19560

Updates standard forms to use wrapped leaf element instead of a form wrapper.

  • let the user mix his own components with JH wrapped elements
  • compatible with latest react version (which forbids the use of useState and useEffect within a lib from what I've tested)
  • use something that he better knows to use
  • No need to maintain the react-jhipster forms code which is a bit... difficult to understand

I've made changes to the codes by @Tcharl to incorporate the following features:

  • Rebased on the latest main branch.
  • Updated to the newest reactstrap (v9.2).
  • Fixed several issues.
  • Modified checkbox and select functionalities to pass the e2e tests.

Currently, all tests pass when running npm run e2e.

Refer to the following information:

@hide212131
Copy link
Contributor Author

While I certainly support the direction of these code changes, I have a few suggestions. I will write after this.


export const PasswordPage = () => {
const [password, setPassword] = useState('');
const [newPassword, setNewPassword] = useState('');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using React Hooks Form's getValues or useWatch seems more natural.

Comment on lines +85 to +86
labelPlaceholderKey="global.form.currentpassword.label"
inputPlaceholderKey="global.form.currentpassword.placeholder"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe the original code label={translate('global.form.newpassword.label')} still works well. The code volume remains roughly the same, and it allows for direct text without using i18n for the label.

touchedFields={ touchedFields }
errors={ errors }
setValue={ setValue }
nameIdCy="currentPassword"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Instead of nameIdCy, the attribute name feels more natural.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants