CyberStore Ecommerce 2023 Documentation
CustomerLoginControl Class
Members  Example 


Dovetail.Ecommerce.Controls Namespace : CustomerLoginControl Class

A Customer login control.

 

Remarks

The CustomerLoginControl allows a user to log in without authentication. If the user has authentication, it provides links to edit the Account and to log out. If there are Items in the Shopping Cart, the control displays a link to the checkout process.

Property Usage

By changing the values of the control's properties in the SitePages.config file for your Site, you can enable or disable certain behaviors, set certain defaults, alter aspects of the display or otherwise cusomtize your site's implementaion of the control.

The following describes properties pertaining to key functional areas of the control that can be configured to suit your needs.

Extending Logon Actions

Following the validation of a user login request, the CustomerLoginControl normally re-renders the existing web page showing the user's name and providing them with a link that they can click to logout by indicating they are not that person.

 

The text displayed in that link, before their name can be customized from its default of "Click if you are not " to whatever is desired using the ClickHereIfNot property.

Alternatively, the control can be setup to automatically redirect the user to the CyberStore's application home page using the RedirectHomeAfterLogin property and setting its value to true.

Should it be desirable to redirect the user to any other location after successfully authenticating, the query string variable RETURNURL can be included in any link to the login page that would then redirect after login to the URL specified such as in the example below.

Sample Link with RETURNURL
Copy Code
<a href="/ecommerce/CustomerLoginForm.aspx?RETURNURL=CustomerMyAccount.aspx">Login and Redirect to the MyAccount page</a>

Customizing Button Text

The CustomerLoginControl has various properties that allow you to customize button text accordingly:

Authenticating Novo CMS Users on Login

A single sign-on experience is available for users of both the CyberStore and novo systems. This is controlled using the CyberStore Connect API integration as well as certain management functions in CyberStore console that make the synchronization of CyberStore Accounts and novo Users automatic. Additional synchronization options are available to connect CyberStore Customer Classes to novo User Groups.

When properly configured, the CyberStore login function can be extended to also authenticate the Account with the integrated novo CMS application. To enable this functionality, set the AuthenticateNovoOnLogin property to true.

Properties Inherited from the Base CyberStoreBaseControl

Properties specific to the CyberStoreBaseControl can be listed in the following categories:

Override Properties

When the IgnoreControl property is set to true, all processing of a control is skipped, and the control's Visible property is set to false ensuring that it is not rendered in the resulting CyberStore page.

Contextual Properties

Contextual properties define specific details about the current instance of the control based on context. Context can be set by any number of factors including the log in state of the Shopper, the Site being visited, or the properties that have been established for a control.

The AttributesBag property is used internal to control processing and is the collection of attributes, or properties, and their values based on how the control is configured. The attributes in this property are set by processing the SitePages.config file as well as any specific declared property values in any registered sub controls. It allows for the passing down of all properties to a control and any registered sub controls.

The ComConfigUserData and Site_ID properties are read-only values made available to all CyberStore controls to aid in processing and establishing context about the Site and Shopper.

Sub Controls

The table below lists and describes sub controls used by the default CustomerLoginControl.

Sub Control Description
CommonValidEmailControl Requests an email for the shopper and validates the input.
CommonRequiredPasswordControl Displays two password text boxes and performs all validation for these fields.
CustomerChangeRequestShipDateControl Dispalys a requested ship date and provides a change button that spawins the requested ship date pop-up when clicked.
Example
<Control src="CustomerLoginControl.ascx" 
    AuthenticateNovoOnLogin="false"
    CheckoutButtonText="CheckOut"
    ClickHereIfNot="Click here if you are not "
    EditAccountButtonText="Edit Account"
    LoginButtonText="Login"
    RedirectHomeAfterLogin="false"
    SavedCartButtonText="Saved Carts"
/>
Control Markup

The following is the markup for this control.

Developer's Note:

To create a custom version of the control, copy all of the code below into a file of the same name and place it into your Site's control folder (e.g., ../YourSiteFolder/Control). The CyberStore page engine will then override the default markup with your customized version.

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CustomerLoginControl.ascx.cs"
    Inherits="Dovetail.Ecommerce.Controls.CustomerLoginControl" %>
<@ Register TagPrefix="uc1" TagName="CommonValidEmailControl" Src="~/Control/CommonValidEmailControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CommonRequiredPasswordControl" Src="~/Control/CommonRequiredPasswordControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CustomerChangeRequestShipDateControl" Src="~/Control/CustomerChangeRequestShipDateControl.ascx" >
<asp:Panel ID="loginPanel" runat="server" DefaultButton="btn_login">
    <asp:ValidationSummary ID="ValidationSummary_acc" runat="server" EnableClientScript="false" HeaderText="Important Message:" CssClass="ValidationMessage"
        EnableViewState="false" Enabled="false"></asp:ValidationSummary>
    <asp:Label ID="lbl_loginmessage" runat="server" CssClass="ValidationMessage" EnableViewState="false">Important Message:</asp:Label>
    <asp:Label ID="lbl_logoutmessage" runat="server" CssClass="Formlabel" EnableViewState="false"></asp:Label>
    <table class="LoginFormTable" id="Table1" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td>
                <asp:Label ID="lbl_emailaddress" runat="server" CssClass="FormLabel" Text="Email Address:" /><br>
                <uc1:CommonValidEmailControl ID="Email1" ButtonToClick="btn_login" runat="server" />
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lbl_password" runat="server" CssClass="FormLabel" Text="Password" /><br>
                <uc1:CommonRequiredPasswordControl ID="Password1" ButtonToClick="btn_login" runat="server" />
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            <p>
                            <asp:Label ID="registerLabel" runat="server">
                                <a href="CustomerRegistrationForm.aspx" class="register LoginLink">Click here to register.</a>
                            </asp:Label>
                            <br />
                                <asp:Label ID="lbl_forgotpassword" runat="server"><a href="CustomerForgotPasswordForm.aspx" class="password LoginLink">Forgot your password?</a></asp:Label>
                                </p>
                        </td>
                        <td align="left">
                            <asp:Button ID="btn_login" ClientIDMode="Static" TabIndex="1" runat="server" CssClass="FormButton LoginButton"
                                Text="Login" OnClick="btn_login_Click"></asp:Button>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Panel>
<asp:Panel ID="logincompletePanel" runat="server">
    <table class="LoggedInAsTable">
        <tr>
            <td>
                <asp:Label ID="LoginNotification" runat="server" CssClass="ValidationMessage" EnableViewState="false">Important Message:</asp:Label>
                <p class="LoginSuccessText">
                    <asp:Label ID="loginLabel" runat="server">You logged in successfully.</asp:Label>
                </p>
                <p class="LoginAsText">
                    <asp:Label ID="loginLabel1" runat="server">You are logged in as</asp:Label>
                </p>
                <div class="LoginSuccessName">
                    <asp:Label ID="loginuserLabel" runat="server"></asp:Label></div>
                <div class="LoginSuccessCompany">
                    <asp:Label ID="logincompanyLabel" runat="server" CssClass="FormOutput"></asp:Label></div>
                <asp:Button ID="checkoutButton" runat="server" CssClass="FormButton" Text="CheckOut">
                </asp:Button>
                <asp:Button ID="editaccountButton" runat="server" CssClass="FormButton" Text="Edit Account"
                    Visible="false"></asp:Button>
                <button class="FormButton" id="SavedCartsbtn" onclick="window.location='CustomerSavedCart.aspx'"
                    type="button" runat="server" visible="false">
                    <%= SavedCartButtonText %></button><br>
                <asp:Label ID="loginverifyLabel" runat="server" CssClass="FormLabel"></asp:Label>
                <p>
                </p>
            </td>
        </tr>
    </table>
</asp:Panel>
<uc1:CustomerChangeRequestShipDateControl ID="CustomerChangeRequestShipDateControl1" runat="server" />
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
      System.Web.UI.TemplateControl
         System.Web.UI.UserControl
            Dovetail.Ecommerce.ControlBases.CyberStoreBaseControl
               Dovetail.Ecommerce.Controls.CustomerLoginControl

See Also

Reference

CustomerLoginControl Members
Dovetail.Ecommerce.Controls Namespace