locked
custom login screen in html client RRS feed

  • Question

  • I Created an html client application with no authentication. i designed my own login and logout screen. in the login screen i have added a query with employees which is a table from my sql database. when i click on the login button iam checking the user is valid or not from the getemployees and assigning the value to the localstorage keys. the code is like this in the login_execute method

    myapp.LoginScreen.Login_execute = function (screen) { screen.getEmployees().done(function (invLines) {
            invLines.data.forEach(function (invLine) {
                if (invLine.EmployeeID == screen.EmployeeID && screen.Password == invLine.PWD) {
                    localStorage.setItem("EmployeeID", invLine.EmpID.toString());
                    localStorage.setItem("EmployeeName", invLine.FirstName + " " + invLine.Lastname);
                    localStorage.setItem("Rolename", invLine.Role.RoleName);
                    localStorage.setItem("RoleId", invLine.Role.RoleId);
    
                }
            });
        });}`

    the data is fetched with the above condition when clicked twice on the login button. Can some one help me on this,to get the data in a single click event.

    I want to show a message with Invalid credentials if the employeeid and password are not matching else should move to another screen.

    Wednesday, March 23, 2016 8:19 AM

All replies

  • Hi B Adarsh Kumar,

    From your description above, I think you can consider creating Users screen, users are managed within the running application. 

    Only users with the built-in  SecurityAdministration permission have the ability to manage users.  By default, the administrator account that was specified when the application was published has the SecurityAdministration permission assigned to it.  Those users with this permission will see the Administration navigation group with a Users and Roles screen when they open a LightSwitch application.

    More information: Authentication in Visual Studio LightSwitch

    Have a good day.

    Regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 28, 2016 6:49 AM
  • Hi Angie,

    Thanks, for the reply.

    What if i don;t want to use in the in-built Security. I want my own control on the login and user creation, i don;t want to use my own authentication.

    I want to know why the login button should be executed twice to check the functionality with the login_execute method.

    Regards,

    Adarsh

    Wednesday, March 30, 2016 5:02 AM
  • I want to show a message with Invalid credentials if the employeeid and password are not matching else should move to another screen.

    Hello,

    Thanks for your feedback.

    First it's recommended to use try{...} catch{...} for this login page.

    Secondly,  redirect to other screen when mismatch EmployeeID and Password, like: Response.Redirect(default);  

    In addition, you could also take the User screen authentication into consideration, I think it's a little convenient. Here is a reference: Creating a Custom Login Page for a LightSwitch Application

    Have a good day.

    Regards,

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 6, 2016 9:50 AM