Rainlab Users - Problem with login on Activate

I got a problem with Rainlab Users onActivate.

When the user gets the email and click the button, the onActivate method from Account.php is called which activates the user and do a login.

However, on a usual login I also call an API in the background to login the user on a second application with the same credential.

Now since this activation + login is done, I cannot call the API since the user does not pass credentials for this login.

So now I face the problem, that if the user activates himself, he does not login to the second application which results in a kinda buggy result: First login, only half a login is done.

What would help is an optional Login in the end of onActivate or another event to logout the user…

I mean: Since there’re no credentials to pass to the API I have to avoid this login and make the user login manually, or do I overlook another solution?

Can I overwrite this method somehow and remove the login? Any events I missed?

Any help is welcome, thanks a lot :slight_smile:

Forgot about the possibility to overwrite components, but some older thread reminded me.

So for whoever has the same problem:

  • Extended the component within my plugin and overwrote the onActivate method. Basically a plain copy without the login in the end
  • Registered component in the Plugin.php and used it in my pages
  • Also had to adjust the partial folder in my theme since I overwrote all the partials from the original account component
  • In order to add a different redirect if the onActivate method is called, I also overwrote the onRun method. Basically: In case the onActiate is called, no matter the outcome, redirect to the login page…
    public function onRun()
        // Redirect to HTTPS checker
        if ($redirect = $this->redirectForceSecure()) {
            return $redirect;

        // Activation code supplied
        if ($code = $this->activationCode()) {
            # Modified: Activate account and redirect to the login page
            return Cms::redirect("user/login");


Maybe this helps somebody lateron :wink: