File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/Authentication/Actions Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 55use CodeIgniter \Exceptions \PageNotFoundException ;
66use CodeIgniter \HTTP \IncomingRequest ;
77use CodeIgniter \HTTP \RedirectResponse ;
8+ use CodeIgniter \Shield \Exceptions \LogicException ;
89use CodeIgniter \Shield \Exceptions \RuntimeException ;
910use CodeIgniter \Shield \Models \UserIdentityModel ;
1011
@@ -23,6 +24,13 @@ public function show(): string
2324 throw new RuntimeException ('Cannot get the User. ' );
2425 }
2526
27+ $ userEmail = $ user ->getAuthEmail ();
28+ if ($ userEmail === null ) {
29+ throw new LogicException (
30+ 'Email Activation needs user email address. user_id: ' . $ user ->getAuthId ()
31+ );
32+ }
33+
2634 /** @var UserIdentityModel $identityModel */
2735 $ identityModel = model (UserIdentityModel::class);
2836
@@ -44,7 +52,7 @@ public function show(): string
4452 // Send the email
4553 helper ('email ' );
4654 $ return = emailer ()->setFrom (setting ('Email.fromEmail ' ), setting ('Email.fromName ' ) ?? '' )
47- ->setTo ($ user -> getAuthEmail () )
55+ ->setTo ($ userEmail )
4856 ->setSubject (lang ('Auth.emailActivateSubject ' ))
4957 ->setMessage (view (setting ('Auth.views ' )['action_email_activate_email ' ], ['code ' => $ code ]))
5058 ->send ();
You can’t perform that action at this time.
0 commit comments