locked
How to customize the login screen? RRS feed

  • Question

  • How can I customize the login screen?
    Saturday, September 4, 2010 5:01 PM

Answers

  • In Beta 1, LightSwitch has a bug where it always prompts the user to log in even if the user is already authenticated (i.e., has an authentication ticket).  This is being fixed for Beta 2 such that the user will be allowed entry into the application if they are already authenticated.  So if you provide authentication through external means (such as through a custom login.aspx page) then LightSwitch would respect that.  However, any external authentication should use the web.config file of the LightSwitch app since it specifies the name to use for the authentication cookie.

    Friday, September 17, 2010 2:53 PM
  • Hi,

    LightSwitch does not currently support receiving external authentication. Bbakermai's proposal hinges on a way to get the init params (user credentials) from the external system to login silently, but LightSwitch does not currently support any such mechanism at startup.

    Regards,

    -Dan Leeaphon

    Tuesday, September 14, 2010 2:42 PM

All replies

  • Hi,

    I'm pretty sure that you can't customize the login screen, at least in the Beta. We currently have no plans to expose it via extensibility.

    What is your scenario?

    Regards,


    Steve Hoag Microsoft aka the V-Bee
    Monday, September 6, 2010 1:27 AM
    Moderator
  • For me, it would be branding, either application or company. Plus, it's the first contact with the app a user may have, so the ability to add some helpful information would be quite useful (e.g., why am I being asked to login?, what application did I click on?, and all the really dumb questions we laugh about at the water cooler, etc.).
    If you believe that I've answered your question, please remember to mark it as answered.

    MicroApplications, Inc. -- Information Systems Integration and Custom Software Development
    Monday, September 6, 2010 11:40 PM
  • My basic scenario is that I have an existing website, and I want to deploy the .xap file to be launched by the existing website.

    The user has already logged into my website, I do not want them to need to log in again.

    Tuesday, September 7, 2010 1:24 PM
  • I want to reaffirm what has been said here, not so much about customizing the look of the login screen, but more so the ability of a ightSwitch app to receive and recognize external authentication that has already taken place. Has anyone put up a Connect Feedback item in this area? Would it take a lookless custom control that had access to init params and that could be instantiated at app startup and then authenticate silently?
    If you believe that I've answered your question, please remember to mark it as answered.

    MicroApplications, Inc. -- Information Systems Integration and Custom Software Development
    Friday, September 10, 2010 1:48 PM
  • Hi,

    LightSwitch does not currently support receiving external authentication. Bbakermai's proposal hinges on a way to get the init params (user credentials) from the external system to login silently, but LightSwitch does not currently support any such mechanism at startup.

    Regards,

    -Dan Leeaphon

    Tuesday, September 14, 2010 2:42 PM
  • Here's the Connect link for the feature request Michael and I have outlined above:

    https://connect.microsoft.com/VisualStudio/feedback/details/597925/forms-authentication-via-init-params

    Bob Baker


    If you believe that I've answered your question, please remember to mark it as answered.

    MicroApplications, Inc. -- Information Systems Integration and Custom Software Development
    Wednesday, September 15, 2010 4:17 AM
  • Hi guys

    Have anyone of you figured out how to change at least the resources files generated on the Microsoft.LightSwitch.Client.Internal to edit at least the string values to do some translation.

    I mean maybe the possiblitiy to expose them as resx and change values and so some globalization.

    CommandsView_Actions=Actions
    CommandsView_Data=Data
    CommandsView_Home=Home
    CurrentUserControl_Logout=Log Off
    LoginPage_InvalidLoginInfo=The login information entered is not correct.
    LoginPage_Login=Log In
    LoginPage_Password=Password
    LoginPage_UserName=User Name
    LogoutCommand_LogoutFailure=Unable to log out the current user.

    Thx for your prompt response.

    Best Regards

    Pedro

    Wednesday, September 15, 2010 5:35 PM
  • In Beta 1, LightSwitch has a bug where it always prompts the user to log in even if the user is already authenticated (i.e., has an authentication ticket).  This is being fixed for Beta 2 such that the user will be allowed entry into the application if they are already authenticated.  So if you provide authentication through external means (such as through a custom login.aspx page) then LightSwitch would respect that.  However, any external authentication should use the web.config file of the LightSwitch app since it specifies the name to use for the authentication cookie.

    Friday, September 17, 2010 2:53 PM
  • In Beta 1, LightSwitch has a bug where it always prompts the user to log in even if the user is already authenticated (i.e., has an authentication ticket).  This is being fixed for Beta 2 such that the user will be allowed entry into the application if they are already authenticated.  So if you provide authentication through external means (such as through a custom login.aspx page) then LightSwitch would respect that.  However, any external authentication should use the web.config file of the LightSwitch app since it specifies the name to use for the authentication cookie.


    Thank You! Thank You! Thank You!

    This should allow me to do things like launch LightSwitch from inside a DotNetNuke website.

    Friday, September 17, 2010 6:08 PM
  • Hey ADefwebserver, I'm doing the same but what im trying to do is just specify the role provider to map to the DNNRoleProvider instead of the SqlMembership on the web.config of LS. I;ve already map the LS app with the DB of DNN but what im trying to do is to match the RoleProvider to follow the DNNRoleProvider, Do you have any advice for that?.

    Best Regards

    Pedro

    Sunday, September 19, 2010 5:29 AM
  • Hey ADefwebserver, I'm doing the same but what im trying to do is just specify the role provider to map to the DNNRoleProvider instead of the SqlMembership on the web.config of LS. I;ve already map the LS app with the DB of DNN but what im trying to do is to match the RoleProvider to follow the DNNRoleProvider, Do you have any advice for that?.

    Best Regards

    Pedro


    This is just my opinion, not the last word on the subject so feel free to disagree and I could be wrong. But DotNetNuke is not using the ASP Membership Provider as an application normally would because it has the multi-portal situation that the ASPMembershiop provider wasn't meant to handle.

    If you look at all the samples at:

    http://dnnsilverlight.adefwebserver.com/

    I am simply getting the UserId from the HTTPContext and then using that to get the proper records for a person. Trust me this works great. They ARE Authenticated (this nasty exploit discovered today that we are all dealing with right now not withstanding :)). 

    Sunday, September 19, 2010 5:38 AM
  • 1. Switch your LightSwitch solution to “File View”

    2. Click on Show All Files

    3. Right click on the Server Generated project and Add New Item

    4. Add the ASPX page called SingIn with the appropriate code.

      <form id=”form1″ runat=”server”><div>

     

    <p>Sign in</p>

    <asp:Label ID=”Label1″ runat=”server” Text=”User Name”></asp:Label>

    <asp:TextBox ID=”TextBox1″ runat=”server” Width=”128px”></asp:TextBox>

    <asp:Label ID=”Label2″ runat=”server” Text=”Password”></asp:Label>

    <asp:TextBox ID=”TextBox2″ runat=”server”

    TextMode=”Password” Width=”128px”></asp:TextBox>

    <asp:Button ID=”BtnSingIn” runat=”server” Text=”Sign In”

    onclick=”BtnSingIn_Click”/>

    <center><label id=”lblForgot”>Forgot password </label>

    <a href=”https://www.in4doctor.com” target=”_self”>click here</a></center>

    </div>

    </form>

    5- Now we need to write BtnSingIn_Click event:

    protected void BtnSingIn_Click(object sender, EventArgs e)

     

    {

    Microsoft.LightSwitch.Security.ServerGenerated.Implementation.User user;

    Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService x = new Microsoft.LightSwitch.Security.ServerGenerated.Implementation.AuthenticationService();

    user = x.Login(TextBox1.Text, TextBox2.Text, false, “”);

    if (user != null)

    {

    Response.Write(“<script>window.parent.location=\”http://www.StudentCourse.Com/default.htm\”</script>”);

    } // you need to change the URL according to your Project

    }

    6. We now need to get SingIn.aspx to be included in the build output.  Right click on your project in solution explorer and select Unload Project.

    7. Right click the project and select Edit.

    8. Search the file and for default.htm.  You should find a section called _BuildFile.

    9. Underneath the _BuildFile section for default.htm, add the following.

    <_BuildFile Include=”ServerGenerated\Singin.aspx”>
    <SubFolder>
    </SubFolder>
    <PublishType>
    </PublishType>
    </_BuildFile>

    10. Now Insert your login account  the and enjoy

    ——————————————–

    Jamil Bin Milhem

    lightswitch Developer IN4ma Team

    Jordan

    Jamil.milhem@in4ma.com

    • Proposed as answer by Jamil MilheM Thursday, December 15, 2011 1:58 PM
    Wednesday, May 25, 2011 8:04 AM
  • Hi Jamil,

    Your solution worked. I have one question though. How do I include an image for the login screen? Can I use the same steps from 6-9 to include my image and use it in the asp.net login page? Thanks.

     

    Surfel17

    Monday, August 22, 2011 4:21 PM
  • This sample in vb code?
    Monday, October 31, 2011 7:24 PM
  • I've posted a step-by-step guide for creating your own custom ASP.NET-based login page and integrating it with your LightSwitch app.

    http://blogs.msdn.com/b/mthalman/archive/2011/12/08/creating-a-custom-login-page-for-a-lightswitch-application.aspx

    Thursday, December 8, 2011 2:23 PM