Skip to content

Commit

Permalink
Fix error in User validation that blocks creation of new Users (#16710)
Browse files Browse the repository at this point in the history
### What does it do?
Restricts check for `password notification method` to only run when
appropriate.

### Why is it needed?
A silent error occurs when `password notification method` is empty (when
options other than "Let MODX generate a password" are chosen),
preventing User creation without any visible validation error.

### How to test
Verify a User is successfully created using each of the three password
creation methods.

### Related issue(s)/PR(s)
Resolves #16709
  • Loading branch information
smg6511 authored Mar 6, 2025
1 parent 4f19355 commit d170c00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/Revolution/Processors/Security/User/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ public function checkPassword()
$passwordGenerationMethod = $this->processor->getProperty('passwordgenmethod', 'g');
if ($passwordGenerationMethod !== 'user_email_specify' && ($newPassword !== null && $newPassword != 'false' || empty($id))) {
$passwordNotifyMethod = $this->processor->getProperty('passwordnotifymethod', null);
if (empty($passwordNotifyMethod)) {
$this->processor->addFieldError('password_notify_method', $this->modx->lexicon('user_err_not_specified_notification_method'));
}
if ($passwordGenerationMethod == 'g') {
if ($passwordGenerationMethod === 'g') {
if (empty($passwordNotifyMethod)) {
$this->processor->addFieldError('password_notify_method', $this->modx->lexicon('user_err_not_specified_notification_method'));
}
$autoPassword = $this->user->generatePassword();
$this->user->set('password', $autoPassword);
$this->processor->newPassword = $autoPassword;
Expand Down

0 comments on commit d170c00

Please sign in to comment.