Event does not fire on_user_deactivate

Permalink
hello everyone,

I have a requirement, send an email to the user, and deleted his login attempts from the "userloginattempts" table.
both functionalities will be called on the deactivate account.
I have written some code in the \application\bootstrap\app.php file.
following the code
Events::addListener('on_user_deactivate', function($event) {
    $user = $event->getUserInfoObject();
    $userEmail = $user->getUserEmail();
    $uId = $user->getUserId();
    $db = Loader::db();
    $q = "DELETE FROM userloginattempts WHERE userId = $uId";
    $db->Execute($q);
    UserSignupRequestsHelper::sendMail($userEmail);
    \Log::info(sprintf('User deactivated %s', $user->getUserName()));
});


There is using "on_user_deactivate" event, functionalities are inside the function, but it is not fired since the account deactivated

Note: User account gets deactivate when he attempts the wrong password 3 times.

Thanks,
Abdul Qayyum