Skip to content

Refactor Password Reset: Convert Class-Based Component to Functional Component#7697

Merged
wesleybl merged 8 commits into
plone:mainfrom
Manik-Khajuria-5:fix-password-reset
Feb 26, 2026
Merged

Refactor Password Reset: Convert Class-Based Component to Functional Component#7697
wesleybl merged 8 commits into
plone:mainfrom
Manik-Khajuria-5:fix-password-reset

Conversation

@Manik-Khajuria-5
Copy link
Copy Markdown
Member

@Manik-Khajuria-5 Manik-Khajuria-5 commented Dec 13, 2025

Issue number

Contributes to #4460


Description

This PR refactors the PasswordReset component by converting it from a legacy class-based React component into a modern functional component using React hooks.


Key Changes

  • Converted PasswordReset from a class-based component to a functional component
  • Replaced lifecycle methods with useEffect for handling success state updates
  • Simplified internal state management using useState
  • Removed deprecated patterns such as constructors and manual this bindings
  • Preserved existing password reset logic and integration with setInitialPassword
  • Maintained support for both username- and email-based authentication
  • Improved readability and consistency with modern Volto code style


@Manik-Khajuria-5 Manik-Khajuria-5 marked this pull request as ready for review December 13, 2025 10:36
@Manik-Khajuria-5
Copy link
Copy Markdown
Member Author

@wesleybl Can u please Review this PR?

Comment on lines +163 to +165
<FormattedMessage
id="Your password has been set successfully. You may now {link} with your new password."
defaultMessage="Your password has been set successfully. You may now {link} with your new password."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's better to use successRedirectToLoginBody.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

@Manik-Khajuria-5
Copy link
Copy Markdown
Member Author

@wesleybl I have made suggested changes

Copy link
Copy Markdown
Member

@wesleybl wesleybl left a comment

Choose a reason for hiding this comment

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

The Cancel button does not seem to perform any action. However, I checked the previous class-based implementation and it behaved the same way.

Since this PR focuses on migrating to a functional component and does not introduce this behavior, I suggest we address this in a separate PR to keep the scope clean.

So,

LGTM

@wesleybl wesleybl merged commit e07a6c8 into plone:main Feb 26, 2026
47 checks passed
@wesleybl
Copy link
Copy Markdown
Member

@Manik-Khajuria-5 Thank you!

Could you please do a backport to Volto 18?

If you could see the Cancel button, that would be great!

@Manik-Khajuria-5
Copy link
Copy Markdown
Member Author

Manik-Khajuria-5 commented Feb 26, 2026

@wesleybl I will do backporting right now and I will make PR for the cancel button as soon as possible

@Manik-Khajuria-5
Copy link
Copy Markdown
Member Author

@Manik-Khajuria-5 Thank you!

Could you please do a backport to Volto 18?

If you could see the Cancel button, that would be great!

@wesleybl hey do u want me to remove cancel button or go through the password component so that cancel button works properly . Please lemme know as per ur convienence

@wesleybl
Copy link
Copy Markdown
Member

@Manik-Khajuria-5 I think the cancel button might redirect to the portal's homepage.

@Manik-Khajuria-5
Copy link
Copy Markdown
Member Author

@wesleybl okk got it

sneridagh added a commit that referenced this pull request Mar 19, 2026
* main: (122 commits)
  Release 19.0.0-alpha.27
  Release @plone/slate 19.0.0-alpha.12
  Release @plone/razzle 1.0.0-alpha.1
  We do not release @plone/client from here
  Handle create-user 500 responses where body contains 'message' instead of 'error' (#7946)
  Dropzone filewidget a11y (#7956)
  Update css-minimizer-webpack-plugin to v7 and keep razzleOptions.enableSourceMaps control (#7934)
  Refactor Password Reset: Convert Class-Based Component to Functional Component (#7697)
  fix: Fixed searchable types in Object Browser Widget, adding also sel… (#7942)
  Fix in-page drag-and-drop for the Listing block in Volto 18 and 19 (#7907)
  Improved docs of Plone REST API JavaScript Client (#5576)
  Fix Moderate Comments control panel visibility based on Discussion Support addon installation (#7878)
  fix: Add authorization error handling to control panels (#7807)
  Fix subordering order tab (#7937) (#7939)
  Fix converting value to html in HtmlSlateWidget (#7938)
  razzle.config.js: Fix defaultPlugins missing name property to enable addon SCSS plugin replacement (#7908)
  Update users controlpanel to work with new response format (#7895)
  Avoid storing blocksClipboard in localstorage until it has a value (#7925)
  Remove link to Jobfamilie MEDICE: site is no longer a Volto site (redirects to non-Volto destination) (#7929)
  Exclude `.storybook` from ESLint's default hidden directory ignore list via `.eslintignore` to allow linting of Storybook configuration files (#7898)
  ...
davisagli pushed a commit to Manik-Khajuria-5/volto that referenced this pull request May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants