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

BUGFIX: Capture exceptions when creating new user or updating password #3918

Merged
merged 1 commit into from Dec 12, 2022

Conversation

Benjamin-K
Copy link
Contributor

@Benjamin-K Benjamin-K commented Oct 11, 2022

This PR replaces #3901.

Upgrade instructions

Creating a user or changing the password will no longer throw an exception with a 500 error page but instead show the error in a flash message. This is done by wrapping UserService::addUser() and UserService::setUserPassword() with a try-catch block.

Review instructions

This PR changes the exception handling when creating new users or updating passwords by wrapping the used methods (UserService::addUser() and UserService::setUserPassword()) inside a try catch block and showing an error message (FlashMessage) if there was an exception.
That way it will be easier to extend Neos and add some password checks without showing a 500 error page in the Neos backend, which is currently the case with JvMTECH.NeosHardening (see jvm-tech/JvMTECH.NeosHardening#2) and maybe others.

With the adjusted code you can add checks to the password through an Aspect and simply throw an exception, if the requirements do not pass.

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

Besides the two tiny issues, looks fine by reading, thx!

Copy link
Member

@Sebobo Sebobo left a comment

Choose a reason for hiding this comment

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

Looks fine by reading

@paavo
Copy link
Contributor

paavo commented Nov 16, 2022

Any plans when this will be merged @Sebobo?

@Sebobo Sebobo changed the title FEATURE: Capture exceptions when creating new user or updating password BUGFIX: Capture exceptions when creating new user or updating password Nov 16, 2022
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

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

Looks good by reading!

@Sebobo Sebobo merged commit 8c845da into neos:7.3 Dec 12, 2022
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.

None yet

5 participants