public function MassPasswordReset::getResetUrl in Mass Password Change 8
Retrieves password reset email and extracts the login link.
1 call to MassPasswordReset::getResetUrl()
- MassPasswordReset::testOtherUsersMassPasswordReset in tests/
src/ Functional/ MassPasswordReset.php - Test Password reset function for other users.
File
- tests/
src/ Functional/ MassPasswordReset.php, line 100
Class
- MassPasswordReset
- Test the password reset function.
Namespace
Drupal\Tests\mass_password_change\FunctionalCode
public function getResetUrl(&$emails = NULL) {
if ($emails === NULL) {
// Assume the most recent email.
$emails = $this
->drupalGetMails();
}
if (empty($emails)) {
return FALSE;
}
$email = array_shift($emails);
$urls = [];
preg_match('#.+user/reset/(\\d+)/.+#', $email['body'], $urls);
return [
'url' => $urls[0],
'uid' => $urls[1],
];
}