Add widget to login page

Posted by Community Admin on 04-Aug-2018 17:20

Add widget to login page

All Replies

Posted by Community Admin on 15-Jun-2011 00:00

I am attempting to recreate a site that was created in version 3 to the most current version. An issue that I am running across is that in version 3, there was an easier way to add a widget/control to the login page as well as be able to style more than the background area. I installed the starter kit and it only allows me to style the background. I cannot find a login.aspx page on either installation. Version 3 allowed me to make changes using the login.aspx or login.aspx.cs pages. How can I make these same changes in version 4? 

Posted by Community Admin on 17-Jun-2011 00:00

Hi Brian,

Yes, it's possible to achieve this functionality in 4.x as well, you can customize the login page by mapping the template for LoginForm. Please find below the default templates that we're using for LoginForm:

<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI"
    TagPrefix="sitefinity" %>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields"
    TagPrefix="sffields" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
   
<%@ Control Language="C#" %>
<sitefinity:ResourceLinks ID="resourcesLinks" runat="server">
    <sitefinity:ResourceFile JavaScriptLibrary="JQuery">
    </sitefinity:ResourceFile>
</sitefinity:ResourceLinks>
   
<sitefinity:ClientLabelManager id="clientLabelManager" runat="server">
    <Labels>
        <sitefinity:ClientLabel ClassId="Labels" Key="SelfLogoutUserConfirm" runat="server" />
        <sitefinity:ClientLabel ClassId="Labels" Key="UserNotSelected" runat="server" />
        <sitefinity:ClientLabel ClassId="Labels" Key="LogoutUserConfirm" runat="server" />
    </Labels>
</sitefinity:ClientLabelManager>
   
<sffields:FormManager runat="server" id="formManager" />
<asp:Panel ID="loginPanel" runat="server">
    <div class="sfForm">
        <div class="sfFormIn">
            <div class="sfLoginShadowTopRight">
            </div>
            <div class="sfLoginShadowBottomLeft">
            </div>
            <h2>
                <asp:Literal ID="LoginTitle" Text="<%$ Resources:Labels, LoginToManage %>" runat="server" />
            </h2>
            <asp:Label runat="server" ID="FailureText" EnableViewState="False" Visible="false"
                CssClass="sfFailure" />  
            <ol>
                <li id="ProvidersHolder" runat="server">
                    <asp:Label ID="ProvidersLabel" Text="<%$ Resources:Labels, Provider %>" AssociatedControlID="ProvidersList"
                        runat="server" CssClass="sfTxtLbl" />
                    <asp:DropDownList ID="ProvidersList" AutoPostBack="false" AccessKey="l" runat="server" />
                </li>
                <li>
                    <asp:Label ID="UserNameLabel" Text="<%$ Resources:Labels, Username %>" AssociatedControlID="UserName"
                        runat="server" CssClass="sfTxtLbl" />
                    <asp:TextBox ID="UserName" AccessKey="u" runat="server" CssClass="sfTxt" />
                    <asp:RequiredFieldValidator ID="UserNameRequired" Display="Dynamic" ControlToValidate="UserName"
                        ValidationGroup="LoginBox" ErrorMessage="<%$ Resources:Labels, UsernameCannotBeEmpty %>"
                        CssClass="sfValidator" runat="server">
                <strong><asp:Literal ID="UserNameRequiredLiteral" runat="server" Text="<%$ Resources:Labels, UsernameCannotBeEmpty %>" /></strong>
                    </asp:RequiredFieldValidator>
                </li>
                <li>
                    <asp:Label ID="PasswordLabel" Text="<%$ Resources:Labels, Password %>" AssociatedControlID="Password"
                        runat="server" CssClass="sfTxtLbl" />
                    <asp:TextBox ID="Password" TextMode="Password" AccessKey="p" runat="server" CssClass="sfTxt" />
                    <asp:RequiredFieldValidator ID="PasswordRequired" Display="Dynamic" ControlToValidate="Password"
                        ValidationGroup="LoginBox" ErrorMessage="<%$ Resources:Labels, PasswordCannotBeEmpty %>"
                        CssClass="sfValidator" runat="server">
                <strong><asp:Literal ID="PasswordRequiredLiteral" runat="server" Text="<%$ Resources:Labels, PasswordCannotBeEmpty %>" /></strong>
                    </asp:RequiredFieldValidator>
                </li>
                <li class="sfCheckBoxWrapper">
                    <asp:CheckBox runat="server" ID="RememberMe" />
                    <asp:Label ID="RememberMeTextLabel" Text="<%$ Resources:Labels, RememberMe %>" AssociatedControlID="RememberMe"
                        runat="server" />
                </li>
            </ol>
            <p class="sfSubmitBtn sfMainFormBtns">
                <asp:LinkButton ID="LoginButton" CommandName="Login" CssClass="sfLinkBtn sfSave"
                    ValidationGroup="LoginBox" runat="server">
                    <strong class="sfLinkBtnIn">
                        <asp:Literal ID="LoginButtonLiteral" runat="server" Text="<%$ Resources:Labels, LoginCaps %>"></asp:Literal>
                    </strong>
                </asp:LinkButton>
                <!-- do not remove this button. It is used for the default form submit (pressing enter) -->
                <div style="display: none;">
                    <asp:Button ID="hiddenSubmitButton" runat="server" CommandName="Login" ValidationGroup="LoginBox" />
                </div>
            </p>       
        </div>
    </div>
</asp:Panel>
<asp:Panel ID="userListPanel" runat="server" Visible="false">
    <div class="sfForm">
        <div class="sfFormIn">
            <div class="sfLoginShadowTopRight"></div>
            <div class="sfLoginShadowBottomLeft"></div>
            <h2><asp:Literal ID="UsersListPanelLoginTitle" Text="<%$ Resources:Labels, LoginToManage %>" runat="server" /></h2>
            <p class="sfNeutral"><asp:Literal ID="userLimitLabel" runat="server" Text="<%$ Resources:Labels, UserLimitLabel%>" /></p>
            <sffields:ChoiceField runat="server" id="userListChoice" RenderChoicesAs="RadioButtons"
                DisplayMode="Write" />
            <p class="sfSubmitBtn sfMainFormBtns">
                <asp:LinkButton ID="logoutButton" runat="server" OnClientClick="return AlertLogOut();" CssClass="sfLinkBtn sfPrimary">
                    <strong class="sfLinkBtnIn">
                        <asp:Literal ID="LogoutButtonLiteral" runat="server" Text="<%$ Resources:Labels, LogoutButtonText%>"></asp:Literal>
                    </strong>
                </asp:LinkButton>
            </p>
        </div>
    </div>
</asp:Panel>
   
<asp:Panel ID="selfLogoffPanel" runat="server" Visible="false">
    <div class="sfForm">
        <div class="sfFormIn">
            <div class="sfLoginShadowTopRight"></div>
            <div class="sfLoginShadowBottomLeft"></div>
            <h2><asp:Literal ID="SelfLogoffPanelLoginTitle" Text="<%$ Resources:Labels, LoginToManage %>" runat="server" /></h2>
            <p class="sfNeutral"><asp:Literal ID="selfLogoffLabel" runat="server" Text="<%$ Resources:Labels, SelfLogoffLabel%>" /></p>
            <p class="sfSubmitBtn sfMainFormBtns">
                <asp:LinkButton ID="selfLogoutButton" runat="server" OnClientClick="return AlertSelfLogOut();" CssClass="sfLinkBtn sfPrimary">
                    <strong class="sfLinkBtnIn">
                        <asp:Literal ID="LogoutOtherUserAndEnterLiteral" runat="server" Text="<%$ Resources:Labels, SelftLogoutButtonText%>"></asp:Literal>
                    </strong>
                </asp:LinkButton>
                <asp:LinkButton ID="selfLogoutCancelButton" runat="server" Text="<%$ Resources:Labels, Cancel%>" CssClass="sfCancel" />
            </p>
        </div>
    </div>
</asp:Panel>
   
<asp:Panel ID="denyLogonPanel" runat="server" Visible="false">
    <div class="sfForm">
        <div class="sfFormIn">
            <div class="sfLoginShadowTopRight"></div>
            <div class="sfLoginShadowBottomLeft"></div>
                <h2><asp:Literal ID="DenyLogonPanelLoginTitle" Text="<%$ Resources:Labels, LoginToManage %>" runat="server" /></h2>
                <p class="sfNeutral"><asp:Literal ID="denyLogonMesage" runat="server" Text="<%$ Resources:Labels, DenyLogonMesage%>" /></p>
                <p><asp:Literal ID="loginRetryMessage" runat="server" Text="<%$ Resources:Labels, LoginRetryMessage%>" /></p>
        </div>
    </div>
</asp:Panel>
   
<asp:PlaceHolder ID="loginLinksHolder" runat="server">
    <div class="sfLoginHelp">
        <asp:Literal ID="HelpTitleLiteral" runat="server" Text="<%$ Resources:Labels, Help %>" />:
        <a id="PasswordRecoveryLink" href="~/Sitefinity/Login/PasswordRecovery" runat="server" onclick="toggleSmtpErrorMessage();">
            <asp:Literal ID="PasswordRecoveryTextLiteral" runat="server" Text="<%$ Resources:Labels, ForgotYourPassword %>" />
        </a>
        <a id="ChangePasswordLink" href="~/Sitefinity/Login/ChangePassword" runat="server" onclick="toggleSmtpErrorMessage();">
            <asp:Literal ID="ChangePasswordTextLiteral" runat="server" Text="<%$ Resources:Labels, ChangePassword %>" />
        </a>
        <a id="CreateUserLink" href="~/Sitefinity/Login/Register" runat="server">
            <asp:Literal ID="RegisterUserTextLiteral" runat="server" Text="<%$ Resources:Labels, Register %>" />
        </a>
        <a id="HelpLink" href="~/Sitefinity/Help/UsersAndRoles/LoggingIn" runat="server">
            <asp:Literal ID="HelpLinkLiteral" runat="server" Text="<%$ Resources:Labels, Help %>" />
        </a>       
    </div>
</asp:PlaceHolder>
   
<div id="smtpNotSetContainer" class="sfNeutral sfDetailedInfo" style="display:none;">  
    <h3>
        <asp:Literal ID="ErrorMessageNoSmtpConfigLiteral" runat="server" Text="<%$ Resources:ErrorMessages, TheSystemHasNotBeenConfiguredToSendEmails %>" />
    </h3>
    <ul>
        <li><asp:Literal ID="ErrorMessageContactAdminToResetYourPasswordLiteral" runat="server" Text="<%$ Resources:ErrorMessages, ContactAnAdministratorToResetYourPasswordManually %>" /></li>
        <li>
            <asp:Literal ID="ErrorOrAskAnAdministratorToConfigureTheSystemLiteral" runat="server" Text="<%$ Resources:ErrorMessages, OrAskAnAdministratorToConfigureThSystem %>" />
            <a href="javascript:void(0)" onclick="toggleVisibility('smtpNotSetSolution')">
                <asp:Literal ID="ErrorMessageSmtpDetailsTitle" runat="server" Text="<%$ Resources:ErrorMessages, Details %>" />
            </a>
        </li>
    </ul>
    <div id="smtpNotSetSolution" class="sfDetailedHowTo" style="display: none; ">
        <p><asp:Literal ID="ErrorMessageSmtpSettingsNotSetLiteral" runat="server" Text="<%$ Resources:ErrorMessages, SmtpSettingsAreNotSet %>" /></p>
        <h3><asp:Literal ID="ErrorMessageHowToSetSmtpLiteral" runat="server" Text="<%$ Resources:ErrorMessages, HowToSetSMTP %>" /></h3>
        <ol>
            <li><asp:Literal ID="Literal20" runat="server" Text="<%$ Resources:ErrorMessages, GoToSettingsConfiguration %>" /></li>
            <li><asp:Literal ID="Literal21" runat="server" Text="<%$ Resources:ErrorMessages, SelectSystemSMTPSettings %>" /></li>
        </ol>
    </div>
</div>
   
<div id="smtpPermissionDeniedContainer" class="sfNeutral sfDetailedInfo" style="display:none;">
    <h3>
        <asp:Literal ID="ErrorMessageTheSysIsNotPermittedToSendEmailsLiteral" runat="server" Text="<%$ Resources:ErrorMessages, TheSystemHasIsNotPermittedToSendEmails %>" />
    </h3>
    <ul>
        <li><asp:Literal ID="ErrorMessageContactAdminToResetYourPasswordSmtpLiteral" runat="server" Text="<%$ Resources:ErrorMessages, ContactAnAdministratorToResetYourPasswordManually %>" /></li>
        <li>
            <asp:Literal ID="ErrorOrAskAnAdministratorToConfigureTheSystemSmtpLiteral" runat="server" Text="<%$ Resources:ErrorMessages, OrAskAnAdministratorToConfigureThSystem %>" />
            <a href="javascript:void(0)" onclick="toggleVisibility('smtpPermissionsDeniedDetails')">
                <asp:Literal ID="ErrorMessageSmtpPermissionDeniedDetailsTitle" runat="server" Text="<%$ Resources:ErrorMessages, Details %>" />
            </a>
        </li>
    </ul>
    <div id="smtpPermissionsDeniedDetails" class="sfDetailedHowTo" style="display: none; ">
        <p><asp:Literal ID="SmtpPermissionErrorMessage" runat="server" /></p>     
    </div>
</div>
   
<asp:HiddenField id="logoutUser" runat="server" value="" />
<asp:HiddenField id="loginTicket" runat="server" value="" />
<asp:HiddenField id="mode" runat="server" value="" />
<asp:HiddenField id="smtpSettingsAreSet" runat="server" value="" />
<asp:HiddenField id="smtpPermissionDenied" runat="server" value="" />
   
<telerik:RadCodeBlock runat="server">
<script type="text/javascript">
   
    var userChoices;
    var smtpSettingsAreSet;
    var smtpPermissionDenied;
   
    function pageLoad()
        userChoices = $find("<%= userListChoice.ClientID %>");
        smtpSettingsAreSet = getBooleanHiddenField("<%= smtpSettingsAreSet.ClientID %>");
        smtpPermissionDenied = getBooleanHiddenField("<%= smtpPermissionDenied.ClientID %>");
    
   
    function getBooleanHiddenField(id)
        var field = $get(id);
   
        if (field !== null && field.value)
            return Boolean.parse(field.value);
        
   
        return false;
    
   
    function toggleVisibility()
        var elem = arguments[0] ? document.getElementById(arguments[0]) : this;
        if (elem.style.display == "block")
            elem.style.display = "none";
        
        else
            elem.style.display = "block";
        
    
   
    function toggleSmtpErrorMessage()
        if (!smtpSettingsAreSet)
            toggleVisibility('smtpNotSetContainer');
         else if (smtpPermissionDenied)
            toggleVisibility('smtpPermissionDeniedContainer');
        
    
   
    function AlertSelfLogOut()
        var clientLabelManager = $find('<%= clientLabelManager.ClientID %>');
        var result = confirm(clientLabelManager.getLabel('Labels', 'SelfLogoutUserConfirm'));
        return result;
    
   
    function AlertLogOut()
        var clientLabelManager = $find('<%= clientLabelManager.ClientID %>');
        var value = userChoices.get_value();
   
        if (value == null || value.length == 0)
            alert(clientLabelManager.getLabel('Labels', 'UserNotSelected'));
            return false;
        
   
        var selectedItemId = userChoices.get_value(); // selectedItem[0].id;
        var result = confirm(clientLabelManager.getLabel('Labels', 'LogoutUserConfirm'));
   
        if (result)
            $get('<%= logoutUser.ClientID %>').value = value;
   
        
        return result;
    
   
</script>
</telerik:RadCodeBlock>
To map the templatein the backend go to Administration->Settings->Advanced->Controls>ViewMap->Create new and fill in the fields accordingly(all without the quotes):
HostType: Telerik.Sitefinity.Security.Web.UI.LoginForm
LayoutTemplatePath: "relative path to your custom LoginForm.ascx template"
If you have any additional questions, please let me know, I'll be glad to help.


All the best,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed