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