[SalesForce] the equivalent of Site.login(username, password, url) in the Lightning environment

As a preface, I'm fairly new to development in Lightning so apologies if this is a stupid question.

I'm working on a custom component to use in our community login page. I tried using "Site.login(username, password, url)" in my server-side controller but it doesn't seem to work. Is there something I could be missing with how to login using Lightning?

CODE:

Component Controller "login" Function:

login : function(component) {
    // username and password passed from component
    var usernameValue = component.find("username");
    var passwordValue = component.find("password");

    // invocation of server-side login function
    var usernameFound = component.get("c.lightningLogin2");        
    usernameFound.setParams({
        username: usernameValue, 
        password: passwordValue
    });
}

Apex Controller "lightningLogin2" Function:

@AuraEnabled
public static void lightningLogin2 (String username, String password) {
    User u = Plexus_Utility.getUserDetails(username);
    if (u != null) {
        Site.login(username, password, '/s');
    }
}

*"Plexus_Utility.getUserDetails(username);" returns a user if one is found

Best Answer

When I recently turned on communities this example controller (and a login form Lightning Component front) end was automatically added to the Developer Edition org:

global class LightningLoginFormController {

    ...

    @AuraEnabled
    public static String login(String username, String password, String startUrl) {
        try{
            ApexPages.PageReference lgn = Site.login(username, password, startUrl);
            aura.redirect(lgn);
            return null;
        }
        catch (Exception ex) {
            return ex.getMessage();            
        }
    }

    ...

so Site.login appears to be the way to go.