Welcome Guest, Not a member yet? Register   Sign In
Shield: check user isActivated() do not work properly by using custom action register
#1
Exclamation 
(This post was last modified: 10-22-2024, 11:08 PM by SonzoXide.)

Hi guys. I need little help for this case.
I am using custom action for register, like this one below:
PHP Code:
public array $actions = [
        'register'  => RegisterAction::class,
        'login'    => null,
    ]; 


and it works properly. but when i wanna to check if the user is already active or not by using
auth()->user()->isActivated() or auth()->user()->isNotActivated() it return differently from active properties.
PHP Code:
/** @var Session $authenticator */
        $authenticator auth('session')->getAuthenticator();

        $user $authenticator->getPendingUser();

        dd([
            'isActivated'  => $user->isActivated(),
            'isNotActivated'=> $user->isNotActivated(),
            'active'        => $user->active
        
]); 


result:
Code:
['isActivated' => true, 'isNotActivated' => false, 'active' => false]

or am i doing it wrongly?

Thank you in advanced.
Reply
#2

The output when the value is set to 'register' => \CodeIgniter\Shield\Authentication\Actions\EmailActivator::class, is as follows for me:

Code:
auth()->user()->isActivated() boolean false

auth()->user()->isNotActivated() boolean true

auth()->user()->active boolean false

So, it seems that you might have missed something.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB