Compare Page Revisions
« Older Revision - Back to Page History - Newer Revision »
/sitecore
site
web.config
public partial class Login : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { /*--- Set the navigation url for the Register hyperlink ---*/ var registerHyperLink = (HyperLink)uxLogin.FindControl("RegisterHyperLink"); registerHyperLink.NavigateUrl = "~/Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]); uxLogin.RememberMeSet = false; if (!IsPostBack) { /*--- Restore remembered username(?) ---*/ var c = Request.Cookies["username"]; if (c == null) { uxUsernameTextBox.Text = ""; } else { uxUsernameTextBox.Text = c.Value; uxLogin.RememberMeSet = true; } } } protected TextBox uxUsernameTextBox { get { return uxLogin.FindControl("UserName") as TextBox; } } protected void uxLogin_LoggedIn(object sender, EventArgs e) { /*--- Inits ---*/ var url = Request.QueryString["url"]; /*--- Remember/Forget Username ---*/ if (uxLogin.RememberMeSet) Response.SetCookie("username", uxUsernameTextBox.Text, 365); else Response.DeleteCookie("username", Request); /*--- Redirect (?) ---*/ if (url == null) { Response.Redirect("~/"); // Main page for authenticated users } else { var url2 = Server.UrlDecode(url); Response.Redirect(url2); } } /* This field and the LoggingIn and LoginError event procedures place the user in the correct domain for the current site. This way the user doesn't have to specify the domain, logging in (for example) as "johndoe" instead of "domain\johndoe". */ private string _usernameEntered = string.Empty; protected void uxLogin_LoggingIn(object sender, LoginCancelEventArgs e) { var domainUser = Sitecore.Context.Domain.GetFullName(uxLogin.UserName); if (System.Web.Security.Membership.GetUser(domainUser) != null) { _usernameEntered = uxLogin.UserName; uxLogin.UserName = domainUser; } } protected void uxLogin_LoginError(object sender, EventArgs e) { uxLogin.UserName = _usernameEntered; } }
private string _usernameEntered = string.Empty; protected void uxCreateUserWizard_CreatingUser(object sender, EventArgs e) { /* Prefix what the user typed for a username with the domain for the current site. Retain what the user typed in case the registration fails. */ var domainUser = Sitecore.Context.Domain.GetFullName(uxCreateUserWizard.UserName); _usernameEntered = uxCreateUserWizard.UserName; uxCreateUserWizard.UserName = domainUser; } protected void uxCreateUserWizard_CreateUserError(object sender, CreateUserErrorEventArgs e) { /* Restore what the user typed */ uxCreateUserWizard.UserName = _usernameEntered; /* Other error-handling */ Literal ErrorLabel = (Literal)uxCreateUserWizard.CreateUserStep .ContentTemplateContainer.FindControl("ErrorMessage"); if (e.CreateUserError != MembershipCreateStatus.Success) { MembershipCreateUserException ex = new MembershipCreateUserException(e.CreateUserError); if (e.CreateUserError.ToString() == "InvalidPassword") { ErrorLabel.Text = "The password supplied is invalid. Passwords must conform to the password strength requirements."; } else { ErrorLabel.Text = ex.Message; } } }
/configuration/sitecore/sites/site
loginPage
requireLogin
/configuration/sitecore/settings/setting
sitecore\Company Administrator
sitecore\Sitecore Client Publishing
sitecore\Sitecore Client Users
/sitecore/content/Documents and Settings/All users/Start menu/Left/Content Editor
/sitecore/content/Documents and Settings/All users/Start menu/Left/Media Library
/sitecore/content/Documents and Settings/All users/Start menu/Left/Publish Site
/sitecore/content/Applications/Content Editor
/sitecore/content/Applications/Content Editor/Ribbons/Chunks/Write
/sitecore/content/Applications/Content Editor/Ribbons/Chunks/Workflow Edit
sitecore\My Site Administrator
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.