Call to Craft Users Login Function from Plugin I am migrating a 15,000+ users from a site's old CMS (WP), and have them set to Pending. All of their user information will be created and on Craft CMS, except their passwords will not be set, as migrating that is too complicated (for what I can tell.) So, the process I have in mind for previous users to login is:


User enters Username/Email &amp; PW, submits login form.
Form sends data to custom Custom Plugin Controller, and follows logic:


If user status==active, simply send form data to Craft's users/login and proceed as usual.
If user status==pending:


Check if username/email exists in previous users list. 


If it does not, simply send form data to Craft's users/login and proceed as usual.
If it does exist, it sends the Activation Email and redirects to special URL stating "You've been sent an email to re-activate your account on this new website."





Is this possible to do? It would be fairly straight forward to write, except I am unsure if there is a way to communicate with Craft's users/login via a plugin. Is it something like craft()-&gt;users-&gt;login( $userNameOrEmail, $userPassword )?

I'm aware I could also just send out batch email activation links to the migrated users, but I'd much prefer this method, in case they miss those e-mails and try logging in at a future date. Alternatively I could have a "Are you a user of the old site? Click here to re-activate your account." Link on the login page, but again users may not notice it and think they cant login anymore.

Any help would be hugely appreciated! Thanks.
What you're attempting to do is very doable.  This should be of help to you:

https://craftcms.com/classreference/services/UsersService

You can use the Yii forward function to pass along a request to another action handler:

    $this-&gt;forward('users/sendNewEmailVerifyEmail', false);