Users are keeping deactivated automatically
Created 2 years ago by lckamal

I have set auto activation mode in admin. but when user activates at some point he automatically becomes deactivated.

Any idea how?

piterden  —  2 years ago

You are using RegisterFormBuilder from UsersModule, or your own?

lckamal  —  2 years ago

I have used my own. but everything is identical to RegisterFormBuilder

class MyRegisterFormBuilder extends RegisterFormBuilder
{
    protected $roles = [];

    protected $model = 'Anomaly\UsersModule\User\UserModel';

    protected $handler = 'Anomaly\UsersModule\User\Register\RegisterFormHandler';

    protected $fields = [
        'first_name' => [
            'instructions' => false,
            'placeholder' => 'theme::field.first_name.name',
            'rules' => [
                'required'
            ],
            'required' => true,
            'validators'   => [
                'required' => [
                    'message' => 'First Name is required.',
                ],
            ],
        ],
        'last_name' => [
            'instructions' => false,
            'placeholder' => 'theme::field.last_name.name',
            'required' => true,
            'validators'   => [
                'required' => [
                    'last_name.message' => 'Last name is required.',
                ],
            ],
        ],
        'email'        => [
            'instructions' => false,
            'placeholder' => 'theme::field.email.name',
            'validators'   => [
                'required' => [
                    'email.message' => 'Email is required.',
                ],
            ],
        ],
        'password'     => [
            'instructions' => false,
            'placeholder' => 'theme::field.password.name',
        ],
        'roles' => [
            'instructions' => false,
            'placeholder' => 'theme::field.roles.name',
            'validators'   => [
                'roles.required' => [
                    'message' => 'Please check if you are a Job seeker or an Employer.',
                ],
            ],
        ],
    ];

    protected $actions = [
        'blue' => [
            'text' => 'anomaly.module.users::button.register',
        ],
    ];

    protected $options = [
        'redirect'          => '/',
        'success_message'   => 'anomaly.module.users::success.user_registered',
        'pending_message'   => 'anomaly.module.users::message.pending_admin_activation',
        'confirm_message'   => 'anomaly.module.users::message.pending_email_activation',
        'activated_message' => 'anomaly.module.users::message.account_activated',
    ];

    public function onSaving()
    {
        $entry = $this->getFormEntry();
        if($first_name = $this->getFormValue('first_name')){
            $entry->display_name = $first_name.' '.$this->getFormValue('last_name');
        }
        if($email = $this->getFormvalue('email')){
            $entry->username = $email;
        }
    }

    public function onSaved()
    {
        $this->dispatch(new AssociateActivationRoles($this));
    }

    public function getRoles()
    {
        return $this->roles;
    }

    public function setRoles($roles)
    {
        $this->roles = $roles;

        return $this;
    }
piterden  —  2 years ago

So, you sad user have activated normally, but then, he becomes deactivated. Could you explain more detailed about that moment?

lckamal  —  2 years ago

Yes. When I check from admin panel on Users module. The listing goes increasing. it was 50 and I activated all from mysql query. Users were complaining that after they are logged in, after some moment they are automatically logged out and account is deactivated.

piterden  —  2 years ago

Do you mean active column in DB changed to zero by session timeout?

lckamal  —  2 years ago

Yes. activated column.

piterden  —  2 years ago

what about your self account?

lckamal  —  2 years ago

Not in my case. Tried with some accounts. This is strange issue. Another issue reported about form where they fill fields and on submit it resets. And they can't submit the form.

After clearing cache and browsing history they can fill the form again.

piterden  —  2 years ago

It seems you have setup formbuilder incorrect. What if you try just like this:

class MyRegisterFormBuilder extends RegisterFormBuilder {}

Would it works?

lckamal  —  2 years ago

@piterden - This was due to same TNTSearch lock issue. Working now by disabling tntsearch.

piterden  —  2 years ago

Yeah, this tntsearch is a bit buggy. I'm trying to not use at all.