+ Start a Discussion
Sarma DuvvuriSarma Duvvuri 

Login page in lightning

I have to create the login page with User name and pass word in salesforce lightning (Like Naukri home page).

I have created  the fields, but i am not able to do in controller for login button.

<div class="slds Naukri">
    <ui:inputtext aura:id="User" label=" User Name " class="" value="" maxlength="30" placeholder="Enter Email Id" required="false" size="20"/> <br/>
        <ui:inputSecret aura:id="pwd" label=" Password " class="" value="" maxlength="10" placeholder="Enter upto 10 character" required="false" size="20"/> <br/>
            <div class="slds-float--right slds-button_brand">
                <div class="slds-grid buttons">   
            <lightning:button variant="brand" label="Login" onclick="{!c.handleLoginButtomClick}" />
Can you please help me in this.

Suraj TripathiSuraj Tripathi

Hi Sarma,

Please try this JS code in your controller. Hope it will help you.

handleLoginButtomClick : function(c, e, h){
	console.log('===Click on Login Button=== ');
	var UserName = c.find("User").get("v.value");
	var Password = c.find("pwd").get("v.value");
	console.log('UserName===>>> '+UserName);
	console.log('Password===>>> '+Password);

If It helps you mark as a best answer.



Hi Sarma,

I have also created a login page and please find the code below:

Login Page:

<aura:component  controller="Userempid"  implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
 <ltng:require styles="/resource/SLDS0110/assets/styles/salesforce-lightning-design-system-ltng.css" />
    <aura:attribute name = "Empiduser" type = "sfdc_contact__c"/>
     <aura:attribute name = "Empidpwd" type = "sfdc_contact__c"/>
    <aura:handler name="init" value="{!this}" action="{!c.handleLoginButtomClick}" />
        <lightning:layoutItem padding="around-small" size="12" class="main">
            <div >
                <form class="slds-form--stacked">
                    <ui:inputtext aura:id="User" label=" User Name " class="" value="{!v.Empiduser}" maxlength="30" placeholder="Employee Id" required="false" size="20"/> <br/>
                    <ui:inputSecret aura:id="pwd" label=" Password " class="" value="{!v.Empidpwd}" maxlength="10" placeholder="Password" required="false" size="20"/> <br/>
                    <div class="slds-float--left slds-button_brand">
                        <div class="slds-grid buttons">   
                            <lightning:button variant="brand" label="Login" title="Login" iconPosition = "Left" onclick="{!c.handleLoginButtomClick}"/>


JS Controller:

    handleLoginButtomClick : function(component, event, helper) {
        var testid = component.get("v.Empiduser"); 
        var testpw = component.get("v.Empidpwd");
        alert("testid value':"+testid +"testpw value"+testpw);

Edward Hobbs 2Edward Hobbs 2

I activated the HTML content module, put in the code that the generator gave me. Saved, added to the checkout page in layouts. But as I wrote in the first message, it’s just icons, when you click on them that something is loaded, the page is updated, but the new user is not registered, and not logged in.


Deepali KulshresthaDeepali Kulshrestha
Hi Sarma,

Please refer below code to create login page:

Aura component:-
<aura:component implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" access="global" controller="LoginPageClass">
       <aura:attribute name = "Empiduser" type = "String"/>
     <aura:attribute name = "Empidpwd" type = "String"/>
    <div class="slds-form-element slds-align_absolute-center slds-m-top_x-large">
        <div class="slds-col slds-size_6-of-12">
                <div class="slds-align_absolute-center slds-m-top_small slds-text-heading_large">
                    <span>Login Page</span>
                <div class="slds-form-element__control">
                    <lightning:input label="User Name" name="abc" id="username" placeholder="User Name" value="{!v.Empiduser}" />
                <div class="slds-form-element__control">
                    <lightning:input label="Password" type="password" name="abc" id="password"  placeholder="Password" value="{!v.Empidpwd}" />
                <div class="slds-align_absolute-center" style="height:4rem">
                    <lightning:button variant="success" label="Login" onclick="{!c.loginPage}"/>

Controller class:-

public class LoginPageClass {
    public static String getcontact(String username,String userpassw ){
        List<Contact> lcont=new List<Contact>([select Username__c,Password__c from Contact where Username__c=:username  Limit 1]);
            return 'User dose not exit!';
            if(lcont[0].Password__c==userpassw ){
                return 'Login successfully';
                return 'Invalid Password';

Handler js file:-
    loginPage : function(component, event, helper) {
        var action = component.get("c.getcontact");
        var userid = component.get("v.Empiduser"); 
        var pass= component.get("v.Empidpwd");
        if($A.util.isEmpty(userid ) || $A.util.isUndefined(userid )){
            alert('Please Enter User Name!');
         if($A.util.isEmpty(pass) || $A.util.isUndefined(pass)){
            alert('Please Enter Password!');
              username:userid ,
              var rtnValue = a.getReturnValue();
              console.log('The field list is :'+JSON.stringify(a.getReturnValue()));
         component.set("v.userid ",'');

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Ashu sharma 38Ashu sharma 38
Hi Deepali,

Any Idea about  Communtes login page Sample code for Lightning.


Lakudra BledeLakudra Blede
Erotic entertainment use, inclination for sex cams club (https://www.sexcams.club/" target="_blank) , masturbation, and sexual and relationship fulfillment were surveyed among two examples of men.
Visit xvideos tube (https://www.xvideos.tube/" target="_blank) entertainment use was related with sexual disappointment, more noteworthy inclination for pornlike sex, and increasingly visit masturbation in the two investigations.
Sex entertainment use was related with relationship disappointment in xnxx top (https://www.xnxx.top/" target="_blank) it were. The information didnt bolster the thought that sex entertainment contrarily impacts sexual or relationship fulfillment.
By means of inclination for xhamster llc (https://www.xhamster.llc/" target="_blank) , truth be told, it might support sexual fulfillment by advancing sexual assortment.
The information were steady with a model in which chaturbates (https://www.chaturbates.net/" target="_blank) entertainment adversely, in a roundabout way influences sexual and relationship fulfillment by means of masturbation recurrence.
Investigating erotic shemale cams pro (https://www.shemalecamspro.com/" target="_blank) effect on sentimental connections is a moderately ongoing improvement in sex entertainment look into writing.
Lakudra BledeLakudra Blede
It is contended that presentation to the messages contained inside hotfallingdevil sex cam (https://www.sexcams.club/cam/hotfallingdevil/) erotic entertainment makes an inclination for the sorts of sexual practices.

They drives littlesubgirl porno (https://www.sexcams.club/cam/littlesubgirl/) clients to feel explicitly disappointed when their inclinations are not met by their sexual accomplices.

Another chance is that it cant to the messages contained inside naughtyelle erotic (https://www.sexcams.club/cam/naughtyelle/) entertainment however visit masturbation, which results from visit sex entertainment use.

That undermines shoppers sentiments of sexual siswet19 (https://www.sexcams.club/cam/siswet19/) fulfillment by contrarily affecting sexual execution, arousability, or sentiments of sexual enthusiasm toward ones accomplice.

To begin with, it intends to duplicate and broaden existing examination by evaluating the level of relationship between anabel054 sex cam (https://www.sexcams.club/cam/anabel054/) use and sexual fulfillment.

Various connection considers have been led looking at the relationship between migurtt porno (https://www.sexcams.club/cam/migurtt/) entertainment use and relationship and sexual fulfillment.
Big WinnerBig Winner
it’s completely impossible for me to make an authorization page on the site https://greatcasinocanada.com/casinos/, the idea is that the user can log in to the site under his account, track new bonuses, put ratings for the casino, etc., in the future it will be a personal account in which you can create your personal ratings / preferences, but with a login page problems
Neha Sharma 368Neha Sharma 368
Thanks for the amazing information.
It will help me to rectify glitches from my website: https://www.tistabene.com
Oskar DixonOskar Dixon
Great discussion! All information is so useful! I also want to advise you to check this site (https://skillhub.com/it-resume-writing-service) to get qualified help.