Skip to content

Commit

Permalink
fix: fix user password setup link and user password reset link resolvers
Browse files Browse the repository at this point in the history
CU-86964fpej
  • Loading branch information
Dartui committed Oct 21, 2024
1 parent 96f1d5e commit 5265737
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/Repository/MergeTag/User/UserPasswordResetLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function __construct($params = [])
sprintf(
'wp-login.php?action=rp&key=%s&login=%s',
$trigger->{$this->keyPropertyName},
rawurlencode($trigger->{$this->getTriggerProp()}->data->user_login)
rawurlencode($trigger->{$this->getTriggerProp()}->user_login)
)
);
},
Expand Down
18 changes: 6 additions & 12 deletions src/Repository/Trigger/User/UserPasswordResetRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ public function __construct()
*/
public function context($username, $resetKey)
{
$user = get_user_by(
'login',
$username
);
$user = get_user_by('login', $username);

if (!$user instanceof \WP_User) {
return false;
}

/**
* Bail if we are handling the registration.
Expand All @@ -71,14 +72,7 @@ public function context($username, $resetKey)
return false;
}

$this->userId = $user->data->ID;

$user = get_userdata($this->userId);

if (!$user instanceof \WP_User) {
return false;
}

$this->userId = $user->ID;
$this->userObject = $user;
$this->passwordResetKey = $resetKey;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Repository/Trigger/User/UserRegistered.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function mergeTags()
sprintf(
'wp-login.php?action=rp&key=%s&login=%s',
$trigger->getPasswordResetKey(),
rawurlencode($trigger->userObject->userLogin)
rawurlencode($trigger->userObject->user_login)
),
'login'
);
Expand Down

0 comments on commit 5265737

Please sign in to comment.