Skip to content

Commit

Permalink
Tweaks from feedback and phpstorm hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-H committed Feb 10, 2024
1 parent 227851a commit 0e76364
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions core/src/Revolution/Processors/Security/User/Create.php
Expand Up @@ -20,6 +20,8 @@
use MODX\Revolution\modUserGroupMember;
use MODX\Revolution\modUserProfile;
use MODX\Revolution\modX;
use MODX\Revolution\Registry\modRegister;
use MODX\Revolution\Registry\modRegistry;
use MODX\Revolution\Smarty\modSmarty;

/**
Expand Down Expand Up @@ -234,8 +236,10 @@ public function sendNotificationEmail() {
]);
}

if ($this->getProperty('passwordgenmethod') === 'user_email_specify' && $this->modx->getService('hashing', modHashing::class)) {
$activationHash = $this->modx->hashing->getHash('md5', 'hashing.modMD5', [])->hash($this->object->get('email') . '/' . $this->object->get('id'));
if (
$this->getProperty('passwordgenmethod') === 'user_email_specify'

Check warning on line 240 in core/src/Revolution/Processors/Security/User/Create.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Create.php#L240

Added line #L240 was not covered by tests
) {
$activationHash = bin2hex(random_bytes(32));

Check warning on line 242 in core/src/Revolution/Processors/Security/User/Create.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Create.php#L242

Added line #L242 was not covered by tests

/** @var modRegistry $registry */
$registry = $this->modx->getService('registry', 'registry.modRegistry');

Check warning on line 245 in core/src/Revolution/Processors/Security/User/Create.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Create.php#L245

Added line #L245 was not covered by tests
Expand Down
7 changes: 4 additions & 3 deletions core/src/Revolution/Processors/Security/User/Update.php
Expand Up @@ -20,6 +20,8 @@
use MODX\Revolution\modUserGroupMember;
use MODX\Revolution\modUserProfile;
use MODX\Revolution\modX;
use MODX\Revolution\Registry\modRegister;
use MODX\Revolution\Registry\modRegistry;

/**
* Update a user.
Expand Down Expand Up @@ -314,8 +316,8 @@ public function fireAfterActiveStatusChange() {
* @throws Exception
*/
public function sendNotificationEmail() {
if ($this->getProperty('passwordgenmethod') === 'user_email_specify' && $this->modx->getService('hashing', modHashing::class)) {
$activationHash = $this->modx->hashing->getHash('md5', 'hashing.modMD5', [])->hash($this->object->get('email') . '/' . $this->object->get('id'));
if ($this->getProperty('passwordgenmethod') === 'user_email_specify') {
$activationHash = bin2hex(random_bytes(32));

Check warning on line 320 in core/src/Revolution/Processors/Security/User/Update.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Update.php#L318-L320

Added lines #L318 - L320 were not covered by tests

/** @var modRegistry $registry */
$registry = $this->modx->getService('registry', 'registry.modRegistry');

Check warning on line 323 in core/src/Revolution/Processors/Security/User/Update.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Update.php#L323

Added line #L323 was not covered by tests
Expand Down Expand Up @@ -391,7 +393,6 @@ public function cleanup()
$this->object
);

Check warning on line 394 in core/src/Revolution/Processors/Security/User/Update.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Update.php#L387-L394

Added lines #L387 - L394 were not covered by tests
}

return $this->success('', $this->object);

Check warning on line 396 in core/src/Revolution/Processors/Security/User/Update.php

View check run for this annotation

Codecov / codecov/patch

core/src/Revolution/Processors/Security/User/Update.php#L396

Added line #L396 was not covered by tests
}
}

0 comments on commit 0e76364

Please sign in to comment.