Login Control
I have added the Login control that comes with Sitefinity to a page and am trying to change the Label for the username field. I have changed it but am not seeing any changes when I publish. Any ideas?
Hi Alex,
It is a bug that we logged for fixing with ID 105800
Kind regards,
Ivan Dimitrov
the Telerik team
Is there a way to modify that control?
Hi Alex,
You can use LayoutTemplatePath property of the control to map the template and make some changes there
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %><%@ Control Language="C#" %><sitefinity:ClientLabelManager id="clientLabelManager" runat="server"> <Labels> <sitefinity:ClientLabel ClassId="Labels" Key="LogoutUserConfirm" runat="server" /> <sitefinity:ClientLabel ClassId="Labels" Key="UserNotSelected" runat="server" /> <sitefinity:ClientLabel ClassId="Labels" Key="SelfLogoutUserConfirm" runat="server" /> </Labels></sitefinity:ClientLabelManager><div class="sfLoginWrp"><asp:Panel ID="loginPanel" runat="server"> <asp:Label runat="server" ID="FailureText" EnableViewState="False" Visible="false" CssClass="sfFailure" /> <ol class="sfLoginFieldsWrp"> <li id="ProvidersHolder" runat="server" class="sfLoginField"> <asp:Label ID="Label4" Text="<%$ Resources:Labels, Provider %>" AssociatedControlID="ProvidersList" runat="server" CssClass="sfTxtLbl" /> <asp:DropDownList ID="ProvidersList" AutoPostBack="false" AccessKey="l" runat="server" /> </li> <li class="sfLoginField"> <asp:Label ID="Label1" 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="Literal1" runat="server" Text="<%$ Resources:Labels, UsernameCannotBeEmpty %>" /></strong> </asp:RequiredFieldValidator> </li> <li class="sfLoginField"> <asp:Label ID="Label2" 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="Literal2" runat="server" Text="<%$ Resources:Labels, PasswordCannotBeEmpty %>" /></strong> </asp:RequiredFieldValidator> </li> <li class="sfLoginField sfCheckBoxWrapper" id="rememberMeContainer" runat="server"> <asp:CheckBox runat="server" ID="RememberMe" /> <asp:Label ID="Label3" Text="<%$ Resources:Labels, RememberMe %>" AssociatedControlID="RememberMe" runat="server" /> </li> </ol> <div class="sfSubmitBtn"> <asp:LinkButton ID="LoginButton" CommandName="Login" CssClass="sfLinkBtn sfSave" ValidationGroup="LoginBox" runat="server"> <strong class="sfLinkBtnIn"> <asp:Literal ID="createNewLabelLiteral" 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> </div> </asp:Panel><asp:Panel ID="userListPanel" runat="server" Visible="false"> <p class="sfNeutral"><asp:Literal ID="userLimitLabel" runat="server" Text="<%$ Resources:Labels, UserLimitLabel%>" /></p> <asp:DropDownList ID="userListChoice" runat="server" /> <div class="sfSubmitBtn"> <asp:LinkButton ID="logoutButton" runat="server" OnClientClick="return AlertLogOut();" CssClass="sfLinkBtn"> <strong class="sfLinkBtnIn"> <asp:Literal ID="Literal3" runat="server" Text="<%$ Resources:Labels, LogoutButtonText%>"></asp:Literal> </strong> </asp:LinkButton> </div> </asp:Panel><asp:Panel ID="selfLogoffPanel" runat="server" Visible="false"> <p class="sfNeutral"><asp:Literal ID="selfLogoffLabel" runat="server" Text="<%$ Resources:Labels, SelfLogoffLabel%>" /></p> <div class="sfSubmitBtn"> <asp:LinkButton ID="selfLogoutButton" runat="server" OnClientClick="return AlertSelfLogOut();" CssClass="sfLinkBtn"> <strong class="sfLinkBtnIn"> <asp:Literal ID="Literal4" runat="server" Text="<%$ Resources:Labels, SelftLogoutButtonText%>"></asp:Literal> </strong> </asp:LinkButton> <asp:LinkButton ID="selfLogoutCancelButton" runat="server" Text="<%$ Resources:Labels, Cancel%>" CssClass="sfCancel" /> </div> </asp:Panel><asp:Panel ID="denyLogonPanel" runat="server" Visible="false"> <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> </asp:Panel><asp:PlaceHolder ID="loginLinksHolder" runat="server"> <div class="sfLoginHelp"> <asp:Literal ID="Literal5" runat="server" Text="<%$ Resources:Labels, Help %>" />: <a id="PasswordRecoveryLink" href="~/Sitefinity/Login/PasswordRecovery" runat="server" onclick="toggleSmtpErrorMessage();"> <asp:Literal ID="Literal6" runat="server" Text="<%$ Resources:Labels, ForgotYourPassword %>" /> </a> <a id="ChangePasswordLink" href="~/Sitefinity/Login/ChangePassword" runat="server" onclick="toggleSmtpErrorMessage();"> <asp:Literal ID="Literal7" runat="server" Text="<%$ Resources:Labels, ChangePassword %>" /> </a> <a id="CreateUserLink" href="~/Sitefinity/Login/Register" runat="server"> <asp:Literal ID="Literal8" runat="server" Text="<%$ Resources:Labels, Register %>" /> </a> <a id="HelpLink" href="~/Sitefinity/Help/UsersAndRoles/LoggingIn" runat="server"> <asp:Literal ID="Literal9" runat="server" Text="<%$ Resources:Labels, Help %>" /> </a> </div></asp:PlaceHolder><div id="smtpNotSetContainer" class="sfNeutral sfDetailedInfo" style="display:none;"> <p> <strong><asp:Literal runat="server" ID="Literal10" Text="<%$ Resources:ErrorMessages, TheSystemHasNotBeenConfiguredToSendEmails %>" /></strong> </p> <ul> <li><asp:Literal runat="server" ID="Literal11" Text="<%$ Resources:ErrorMessages, ContactAnAdministratorToResetYourPasswordManually %>" /></li> <li> <asp:Literal runat="server" ID="Literal12" Text="<%$ Resources:ErrorMessages, OrAskAnAdministratorToConfigureThSystem %>" /> <a href="javascript:void(0)" onclick="toggleVisibility('smtpNotSetSolution')"> <asp:Literal runat="server" ID="Literal13" Text="<%$ Resources:ErrorMessages, Details %>" /> </a> </li> </ul> <div id="smtpNotSetSolution" class="sfDetailedHowTo" style="display: none; "> <p><asp:Literal runat="server" ID="Literal19" Text="<%$ Resources:ErrorMessages, SmtpSettingsAreNotSet %>" /></p> <p><strong><asp:Literal runat="server" ID="Literal14" Text="<%$ Resources:ErrorMessages, HowToSetSMTP %>" /></strong></p> <ol> <li><asp:Literal runat="server" ID="Literal15" Text="<%$ Resources:ErrorMessages, GoToSettingsConfiguration %>" /></li> <li><asp:Literal runat="server" ID="Literal16" Text="<%$ Resources:ErrorMessages, SelectSystemSMTPSettings %>" /></li> </ol> </div></div><div id="smtpPermissionDeniedContainer" class="sfNeutral sfDetailedInfo" style="display:none;"> <h3> <asp:Literal runat="server" ID="Literal18" Text="<%$ Resources:ErrorMessages, TheSystemHasIsNotPermittedToSendEmails %>" /> </h3> <ul> <li><asp:Literal runat="server" ID="Literal20" Text="<%$ Resources:ErrorMessages, ContactAnAdministratorToResetYourPasswordManually %>" /></li> <li> <asp:Literal runat="server" ID="Literal21" Text="<%$ Resources:ErrorMessages, OrAskAnAdministratorToConfigureThSystem %>" /> <a href="javascript:void(0)" onclick="toggleVisibility('smtpPermissionsDeniedDetails')"> <asp:Literal runat="server" ID="Literal22" 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></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="" /><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 value = userChoices.get_value(); var clientLabelManager = $find('<%= clientLabelManager.ClientID %>'); 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>Do I create a new control (.acx file) or add this code into the "Widget Templates" section of the backend?
Where do I add the code you provided?
Thanks!
Alex Lorenz
Hello Alex,
You have to crate an ascx file in the project and then set the control to use this template by using LayoutTemplatePath property.
Regards,
Ivan Dimitrov
the Telerik team
Maybe I'm missing a step. I paste that into an ascx web control, enter "~/Sitefinity/UserControls/login.ascx" into LayoutTemplatePath, and I receive the following message "C029: LayoutTemplate does not contain an IEditableTextControl with ID UserName for the username." Do I need to do any backend code for the control?
Thanks,
Alex Lorenz
Hi Alex,
It turned out that there is problem with the template. The error says that the ASP.NET Login control cannot find a require control - UserName, which obviously is declared into the template above. I will need some more time to investigate this issue and update the post.
All the best,
Ivan Dimitrov
the Telerik team
Ivan-
Did you have time to fix the template. I'm receiving the same error.
Thanks
Jeff
Hi Jeff,
There is a bug with ID - 108042, but its status is "Not Done". I hope that we will be able to see what the problem is before the SP1.
Kind regards,
Ivan Dimitrov
the Telerik team
I'm still getting this error too. Has this been resolved?
I was trying to have the login button use the login button image url field but had no luck. Then it was suggested to use css and customize the template so I can set the login buttons text to blank so the image doesn't have strange text on it.
The project I'm modifying for is 5.1.3270. Does the above template work for this?