Welcome Guest, Not a member yet? Register   Sign In
Shield Authentication Actions Customize
#1

Hi,
i am trying on a new composer install Codeigniter & Shield to include a new Authentication Action "activate by admin".
First i try to copy EmailActivator named it AdminActivator and delete the email part and the createCodeIdentity.
But i ended in a 404!
Then i try copy EmailActivator named it AdminActivator and delete the email part and add to show function
PHP Code:
$this->deleteIdentity($user); 
and create the function
PHP Code:
private function deleteIdentity(User $user)
    {
        /** @var UserIdentityModel $identityModel */
        $identityModel model(UserIdentityModel::class);
        $identityModel->deleteIdentitiesByType($user$this->type);
    
This works but!

Now i wanna make this secure for any updates of Shield. So i make some folder under App (Authentication/Actions) and place there my new AdminActivator.php
In App/Config/Auth.php 
PHP Code:
public array $actions = [
        'register' => \Authentication\Actions\AdminActivator::class,
        'login'    => null,
    ]; 
And voila i get this error 
Code:
Call to a member function createIdentity() on null
VENDORPATH/codeigniter4/shield/src/Authentication/Authenticators/Session.php at line 209

what am i missing?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB