Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Authentication/Actions/EmailActivator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use CodeIgniter\Exceptions\PageNotFoundException;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\Shield\Exceptions\LogicException;
use CodeIgniter\Shield\Exceptions\RuntimeException;
use CodeIgniter\Shield\Models\UserIdentityModel;

Expand All @@ -23,6 +24,13 @@ public function show(): string
throw new RuntimeException('Cannot get the User.');
}

$userEmail = $user->getAuthEmail();
Copy link
Contributor

Choose a reason for hiding this comment

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

At this point calling getAuthEmail() is the same as just calling ->email, right? With no trait that needs the getAuth* methods do we even need them anymore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is the same as calling getEmail(), so it is the same as ->email.

About getAuth*() methods, we don't need them now. But when we introduce Interface for User, probably we will need them. So I am okay to remove getAuth*() now.

if ($userEmail === null) {
throw new LogicException(
'Email Activation needs user email address. user_id: ' . $user->getAuthId()
);
}

/** @var UserIdentityModel $identityModel */
$identityModel = model(UserIdentityModel::class);

Expand All @@ -44,7 +52,7 @@ public function show(): string
// Send the email
helper('email');
$return = emailer()->setFrom(setting('Email.fromEmail'), setting('Email.fromName') ?? '')
->setTo($user->getAuthEmail())
->setTo($userEmail)
->setSubject(lang('Auth.emailActivateSubject'))
->setMessage(view(setting('Auth.views')['action_email_activate_email'], ['code' => $code]))
->send();
Expand Down