From 563867cd8b40d2b8367d8e0b1760b5034862c528 Mon Sep 17 00:00:00 2001
From: Shannon
Date: Tue, 14 Jan 2014 16:21:00 +1100
Subject: [PATCH] Temp fix for: U4-3968 Umbraco 7.01 - Membership - Public
Access - Add Single User protection - crash, fixes protectPage so that it
uses the membership provider to make changes, updates the UI logic so that if
you choose an existing user it will you about it, fixes it so you cannot
arbitrarily change a member's password.
---
src/Umbraco.Core/Models/MemberType.cs | 24 +
.../Security/MembershipProviderExtensions.cs | 5 +
.../umbraco/dialogs/protectPage.aspx | 17 +-
src/Umbraco.Web/Umbraco.Web.csproj | 17 +-
.../umbraco/controls/passwordChanger.ascx.cs | 4 +-
.../umbraco/dialogs/protectPage.aspx | 170 -------
.../umbraco/dialogs/protectPage.aspx.cs | 418 +++++++++++++++---
.../dialogs/protectPage.aspx.designer.cs | 295 ------------
src/umbraco.cms/businesslogic/ContentType.cs | 11 +-
.../businesslogic/member/MemberType.cs | 5 +-
10 files changed, 411 insertions(+), 555 deletions(-)
delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx
delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.designer.cs
diff --git a/src/Umbraco.Core/Models/MemberType.cs b/src/Umbraco.Core/Models/MemberType.cs
index 2b32681392..01a3d57738 100644
--- a/src/Umbraco.Core/Models/MemberType.cs
+++ b/src/Umbraco.Core/Models/MemberType.cs
@@ -15,6 +15,7 @@ namespace Umbraco.Core.Models
{
//Dictionary is divided into string: PropertyTypeAlias, Tuple: MemberCanEdit, VisibleOnProfile, PropertyTypeId
private IDictionary> _memberTypePropertyTypes;
+ private string _alias;
public MemberType(int parentId) : base(parentId)
{
@@ -27,6 +28,29 @@ namespace Umbraco.Core.Models
}
private static readonly PropertyInfo MemberTypePropertyTypesSelector = ExpressionHelper.GetPropertyInfo>>(x => x.MemberTypePropertyTypes);
+ private static readonly PropertyInfo AliasSelector = ExpressionHelper.GetPropertyInfo(x => x.Alias);
+
+ ///
+ /// The Alias of the ContentType
+ ///
+ [DataMember]
+ public override string Alias
+ {
+ get { return _alias; }
+ set
+ {
+ //NOTE: WE are overriding this because we don't want to do a ToSafeAlias when the alias is the special case of
+ // "_umbracoSystemDefaultProtectType" which is used internally, currently there is an issue with the safe alias as it strips
+ // leading underscores which we don't want in this case.
+ // see : http://issues.umbraco.org/issue/U4-3968
+
+ SetPropertyValueAndDetectChanges(o =>
+ {
+ _alias = value == "_umbracoSystemDefaultProtectType" ? value : value.ToSafeAlias();
+ return _alias;
+ }, _alias, AliasSelector);
+ }
+ }
///
/// Gets or Sets a Dictionary of Tuples (MemberCanEdit, VisibleOnProfile, PropertyTypeId) by the PropertyTypes' alias.
diff --git a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs
index daa4623747..85db27ac97 100644
--- a/src/Umbraco.Core/Security/MembershipProviderExtensions.cs
+++ b/src/Umbraco.Core/Security/MembershipProviderExtensions.cs
@@ -20,5 +20,10 @@ namespace Umbraco.Core.Security
return (membershipProvider is UmbracoMembershipProviderBase);
}
+ public static UmbracoMembershipProviderBase AsUmbracoMembershipProvider(this MembershipProvider membershipProvider)
+ {
+ return (UmbracoMembershipProviderBase)membershipProvider;
+ }
+
}
}
diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx
index 19edd39dfc..8f57f60b7c 100644
--- a/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx
+++ b/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx
@@ -1,7 +1,6 @@
-<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" Codebehind="protectPage.aspx.cs" AutoEventWireup="True" Inherits="umbraco.presentation.umbraco.dialogs.protectPage" %>
+<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="umbraco.presentation.umbraco.dialogs.protectPage" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
<%= umbraco.ui.Text("publicAccess", "paSimple", base.getUser())%>
-
<%= umbraco.ui.Text("publicAccess", "paSimpleHelp", base.getUser())%>
-
-
-
-
-
-
<%= umbraco.ui.Text("publicAccess", "paAdvanced", base.getUser())%>
-
<%= umbraco.ui.Text("publicAccess", "paAdvancedHelp", base.getUser())%>
-
-
-
- <%= umbraco.ui.Text("publicAccess", "paAdvancedNoGroups", base.getUser())%>
-
-
-
-
-
-
- <%= umbraco.ui.Text("or") %> <%=umbraco.ui.Text("cancel")%>
-
-
-
-
-
-
- <%= umbraco.ui.Text("publicAccess", "paSetLogin", base.getUser())%>
-
-
-
-
-
-
-
-
-
-
-
- <%= umbraco.ui.Text("publicAccess", "paSelectRoles", base.getUser())%>
-
-
-
-
-
-
-
-
-
-
-
-
- <%=umbraco.ui.Text("paLoginPageHelp")%>
-
-
-
-
-
-
-
-
- <%=umbraco.ui.Text("paErrorPageHelp")%>
-
-
-
-
-
-
-
-
- <%= umbraco.ui.Text("or") %> <%=umbraco.ui.Text("cancel")%>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
index 50a4a033e3..e301ae3de8 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs
@@ -1,9 +1,11 @@
-using System;
+using System;
+using System.Globalization;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Windows.Forms.VisualStyles;
using Umbraco.Core;
+using Umbraco.Core.Logging;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.web;
using umbraco.controls;
@@ -24,11 +26,16 @@ namespace umbraco.presentation.umbraco.dialogs
}
- protected System.Web.UI.WebControls.Literal jsShowWindow;
+ protected Literal jsShowWindow;
protected DualSelectbox _memberGroups = new DualSelectbox();
protected ContentPicker loginPagePicker = new ContentPicker();
protected ContentPicker errorPagePicker = new ContentPicker();
+ override protected void OnInit(EventArgs e)
+ {
+ base.OnInit(e);
+ }
+
protected void selectMode(object sender, EventArgs e)
{
p_mode.Visible = false;
@@ -48,11 +55,11 @@ namespace umbraco.presentation.umbraco.dialogs
}
}
- protected void Page_Load(object sender, System.EventArgs e)
+ protected void Page_Load(object sender, EventArgs e)
{
// Check for editing
int documentId = int.Parse(helper.Request("nodeId"));
- cms.businesslogic.web.Document documentObject = new cms.businesslogic.web.Document(documentId);
+ var documentObject = new Document(documentId);
jsShowWindow.Text = "";
ph_errorpage.Controls.Add(errorPagePicker);
@@ -63,12 +70,12 @@ namespace umbraco.presentation.umbraco.dialogs
pp_loginPage.Text = ui.Text("paLoginPage");
pp_errorPage.Text = ui.Text("paErrorPage");
- pane_chooseMode.Text = ui.Text("publicAccess", "paHowWould", base.getUser());
- pane_pages.Text = ui.Text("publicAccess", "paSelectPages", base.getUser());
- pane_simple.Text = ui.Text("publicAccess", "paSimple", base.getUser());
- pane_advanced.Text = ui.Text("publicAccess", "paAdvanced", base.getUser());
+ pane_chooseMode.Text = ui.Text("publicAccess", "paHowWould", UmbracoUser);
+ pane_pages.Text = ui.Text("publicAccess", "paSelectPages", UmbracoUser);
+ pane_simple.Text = ui.Text("publicAccess", "paSimple", UmbracoUser);
+ pane_advanced.Text = ui.Text("publicAccess", "paAdvanced", UmbracoUser);
- if (!IsPostBack)
+ if (IsPostBack == false)
{
if (Access.IsProtected(documentId, documentObject.Path) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected)
{
@@ -80,23 +87,27 @@ namespace umbraco.presentation.umbraco.dialogs
int loginPage = Access.GetLoginPage(documentObject.Path);
try
{
- Document loginPageObj = new Document(loginPage);
+ var loginPageObj = new Document(loginPage);
if (loginPageObj != null)
{
- loginPagePicker.Value = loginPage.ToString();
+ loginPagePicker.Value = loginPage.ToString(CultureInfo.InvariantCulture);
}
- Document errorPageObj = new Document(errorPage);
- errorPagePicker.Value = errorPage.ToString();
+ var errorPageObj = new Document(errorPage);
+ errorPagePicker.Value = errorPage.ToString(CultureInfo.InvariantCulture);
}
- catch
+ catch (Exception ex)
{
+ LogHelper.Error("An error occurred initializing the protect page editor", ex);
}
if (Access.GetProtectionType(documentId) == ProtectionType.Simple)
{
- MembershipUser m = Access.GetAccessingMembershipUser(documentId);
- simpleLogin.Text = m.UserName;
+ MembershipUser m = Access.GetAccessingMembershipUser(documentId);
pane_simple.Visible = true;
+ pp_pass.Visible = false;
+ simpleLogin.Visible = false;
+ SimpleLoginLabel.Visible = true;
+ SimpleLoginLabel.Text = m.UserName;
pane_advanced.Visible = false;
bt_protect.CommandName = "simple";
@@ -116,17 +127,17 @@ namespace umbraco.presentation.umbraco.dialogs
// Load up membergrouops
_memberGroups.ID = "Membergroups";
_memberGroups.Width = 175;
- string selectedGroups = "";
- string[] _roles = Roles.GetAllRoles();
+ var selectedGroups = "";
+ var roles = Roles.GetAllRoles();
- if (_roles.Length > 0)
+ if (roles.Length > 0)
{
- foreach (string role in _roles)
+ foreach (string role in roles)
{
ListItem li = new ListItem(role, role);
- if (!IsPostBack)
+ if (IsPostBack == false)
{
- if (cms.businesslogic.web.Access.IsProtectedByMembershipRole(int.Parse(helper.Request("nodeid")), role))
+ if (Access.IsProtectedByMembershipRole(int.Parse(helper.Request("nodeid")), role))
selectedGroups += role + ",";
}
_memberGroups.Items.Add(li);
@@ -147,26 +158,14 @@ namespace umbraco.presentation.umbraco.dialogs
// Put user code to initialize the page here
}
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
+ protected void ChangeOnClick(object sender, EventArgs e)
{
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
+ SimpleLoginNameValidator.IsValid = true;
+ SimpleLoginLabel.Visible = false;
+ simpleLogin.Visible = true;
+ pp_pass.Visible = true;
}
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
-
- }
- #endregion
-
protected void protect_Click(object sender, CommandEventArgs e)
{
if (string.IsNullOrEmpty(errorPagePicker.Value))
@@ -175,55 +174,52 @@ namespace umbraco.presentation.umbraco.dialogs
if (string.IsNullOrEmpty(loginPagePicker.Value))
cv_loginPage.IsValid = false;
+ //reset
+ SimpleLoginNameValidator.IsValid = true;
if (Page.IsValid)
{
int pageId = int.Parse(helper.Request("nodeId"));
- p_buttons.Visible = false;
- pane_advanced.Visible = false;
- pane_simple.Visible = false;
-
+
if (e.CommandName == "simple")
{
var member = Membership.GetUser(simpleLogin.Text);
if (member == null)
{
+ var tempEmail = "u" + Guid.NewGuid().ToString("N") + "@example.com";
+
// this needs to work differently depending on umbraco members or external membership provider
if (Membership.Provider.IsUmbracoMembershipProvider() == false)
{
- member = Membership.CreateUser(simpleLogin.Text, simplePassword.Text);
+ member = Membership.CreateUser(simpleLogin.Text, simplePassword.Text, tempEmail);
}
else
{
- try
+ //if it's the umbraco membership provider, then we need to tell it what member type to create it with
+ if (MemberType.GetByAlias(Constants.Conventions.MemberTypes.SystemDefaultProtectType) == null)
{
- if (cms.businesslogic.member.MemberType.GetByAlias(Constants.Conventions.MemberTypes.SystemDefaultProtectType) == null)
- {
- cms.businesslogic.member.MemberType.MakeNew(BusinessLogic.User.GetUser(0), Constants.Conventions.MemberTypes.SystemDefaultProtectType);
- }
+ MemberType.MakeNew(BusinessLogic.User.GetUser(0), Constants.Conventions.MemberTypes.SystemDefaultProtectType);
}
- catch
+ var provider = Membership.Provider.AsUmbracoMembershipProvider();
+ MembershipCreateStatus status;
+ member = provider.CreateUser(Constants.Conventions.MemberTypes.SystemDefaultProtectType,
+ simpleLogin.Text, simplePassword.Text, tempEmail, null, null, true, null, out status);
+ if (status != MembershipCreateStatus.Success)
{
- cms.businesslogic.member.MemberType.MakeNew(BusinessLogic.User.GetUser(0), Constants.Conventions.MemberTypes.SystemDefaultProtectType);
+ SimpleLoginNameValidator.IsValid = false;
+ SimpleLoginNameValidator.ErrorMessage = "Could not create user: " + status;
+ return;
}
-
- // create member
- Member mem = cms.businesslogic.member.Member.MakeNew(simpleLogin.Text, "", cms.businesslogic.member.MemberType.GetByAlias(Constants.Conventions.MemberTypes.SystemDefaultProtectType), UmbracoUser);
- // working around empty password restriction for Umbraco Member Mode
- mem.Password = simplePassword.Text;
- member = Membership.GetUser(simpleLogin.Text);
}
}
- else
+ else if (pp_pass.Visible)
{
- //Membership.Provider.ChangePassword(member.UserName, )
-
- // change password if it's not empty
- if (string.IsNullOrWhiteSpace(simplePassword.Text) == false)
- {
- var mem = Member.GetMemberFromLoginName(simpleLogin.Text);
- mem.Password = simplePassword.Text;
- }
+ SimpleLoginNameValidator.IsValid = false;
+ SimpleLoginLabel.Visible = true;
+ SimpleLoginLabel.Text = simpleLogin.Text;
+ simpleLogin.Visible = false;
+ pp_pass.Visible = false;
+ return;
}
// Create or find a memberGroup
@@ -246,7 +242,7 @@ namespace umbraco.presentation.umbraco.dialogs
Access.ProtectPage(false, pageId, int.Parse(loginPagePicker.Value), int.Parse(errorPagePicker.Value));
foreach (ListItem li in _memberGroups.Items)
- if (("," + _memberGroups.Value + ",").IndexOf("," + li.Value + ",") > -1)
+ if (("," + _memberGroups.Value + ",").IndexOf("," + li.Value + ",", StringComparison.Ordinal) > -1)
Access.AddMembershipRoleToDocument(pageId, li.Value);
else
Access.RemoveMembershipRoleFromDocument(pageId, li.Value);
@@ -254,6 +250,10 @@ namespace umbraco.presentation.umbraco.dialogs
feedback.Text = ui.Text("publicAccess", "paIsProtected", new cms.businesslogic.CMSNode(pageId).Text, null) + "
" + ui.Text("closeThisWindow") + "";
+ p_buttons.Visible = false;
+ pane_advanced.Visible = false;
+ pane_simple.Visible = false;
+
ClientTools.ReloadActionNode(true, false);
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
@@ -276,5 +276,289 @@ namespace umbraco.presentation.umbraco.dialogs
feedback.type = global::umbraco.uicontrols.Feedback.feedbacktype.success;
}
+
+ protected CustomValidator SimpleLoginNameValidator;
+ protected Label SimpleLoginLabel;
+
+ ///
+ /// tempFile control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlInputHidden tempFile;
+
+ ///
+ /// feedback control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Feedback feedback;
+
+ ///
+ /// p_mode control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel p_mode;
+
+ ///
+ /// pane_chooseMode control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_chooseMode;
+
+ ///
+ /// rb_simple control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RadioButton rb_simple;
+
+ ///
+ /// rb_advanced control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RadioButton rb_advanced;
+
+ ///
+ /// p_noGroupsFound control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel p_noGroupsFound;
+
+ ///
+ /// bt_selectMode control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button bt_selectMode;
+
+ ///
+ /// pane_simple control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_simple;
+
+ ///
+ /// PropertyPanel1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
+
+ ///
+ /// pp_login control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel pp_login;
+
+ ///
+ /// simpleLogin control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox simpleLogin;
+
+ ///
+ /// pp_pass control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel pp_pass;
+
+ ///
+ /// simplePassword control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox simplePassword;
+
+ ///
+ /// pane_advanced control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_advanced;
+
+ ///
+ /// PropertyPanel3 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3;
+
+ ///
+ /// PropertyPanel2 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2;
+
+ ///
+ /// groupsSelector control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.PlaceHolder groupsSelector;
+
+ ///
+ /// p_buttons control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel p_buttons;
+
+ ///
+ /// pane_pages control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_pages;
+
+ ///
+ /// pp_loginPage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel pp_loginPage;
+
+ ///
+ /// ph_loginpage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.PlaceHolder ph_loginpage;
+
+ ///
+ /// cv_loginPage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator cv_loginPage;
+
+ ///
+ /// pp_errorPage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel pp_errorPage;
+
+ ///
+ /// ph_errorpage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.PlaceHolder ph_errorpage;
+
+ ///
+ /// cv_errorPage control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator cv_errorPage;
+
+ ///
+ /// bt_protect control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button bt_protect;
+
+ ///
+ /// bt_buttonRemoveProtection control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button bt_buttonRemoveProtection;
+
+ ///
+ /// errorId control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlInputHidden errorId;
+
+ ///
+ /// loginId control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.HtmlControls.HtmlInputHidden loginId;
+
+ ///
+ /// js control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.PlaceHolder js;
+
+
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.designer.cs
deleted file mode 100644
index 6ed66eea24..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.designer.cs
+++ /dev/null
@@ -1,295 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.4200
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace umbraco.presentation.umbraco.dialogs {
-
-
- public partial class protectPage {
-
- ///
- /// tempFile control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.HtmlControls.HtmlInputHidden tempFile;
-
- ///
- /// feedback control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Feedback feedback;
-
- ///
- /// p_mode control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Panel p_mode;
-
- ///
- /// pane_chooseMode control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_chooseMode;
-
- ///
- /// rb_simple control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.RadioButton rb_simple;
-
- ///
- /// rb_advanced control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.RadioButton rb_advanced;
-
- ///
- /// p_noGroupsFound control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Panel p_noGroupsFound;
-
- ///
- /// bt_selectMode control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Button bt_selectMode;
-
- ///
- /// pane_simple control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_simple;
-
- ///
- /// PropertyPanel1 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
-
- ///
- /// pp_login control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel pp_login;
-
- ///
- /// simpleLogin control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.TextBox simpleLogin;
-
- ///
- /// pp_pass control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel pp_pass;
-
- ///
- /// simplePassword control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.TextBox simplePassword;
-
- ///
- /// pane_advanced control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_advanced;
-
- ///
- /// PropertyPanel3 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel PropertyPanel3;
-
- ///
- /// PropertyPanel2 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel PropertyPanel2;
-
- ///
- /// groupsSelector control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder groupsSelector;
-
- ///
- /// p_buttons control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Panel p_buttons;
-
- ///
- /// pane_pages control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_pages;
-
- ///
- /// pp_loginPage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel pp_loginPage;
-
- ///
- /// ph_loginpage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder ph_loginpage;
-
- ///
- /// cv_loginPage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.CustomValidator cv_loginPage;
-
- ///
- /// pp_errorPage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel pp_errorPage;
-
- ///
- /// ph_errorpage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder ph_errorpage;
-
- ///
- /// cv_errorPage control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.CustomValidator cv_errorPage;
-
- ///
- /// bt_protect control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Button bt_protect;
-
- ///
- /// bt_buttonRemoveProtection control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Button bt_buttonRemoveProtection;
-
- ///
- /// errorId control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.HtmlControls.HtmlInputHidden errorId;
-
- ///
- /// loginId control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.HtmlControls.HtmlInputHidden loginId;
-
- ///
- /// js control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder js;
- }
-}
diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs
index 71d676f54d..1f14459c40 100644
--- a/src/umbraco.cms/businesslogic/ContentType.cs
+++ b/src/umbraco.cms/businesslogic/ContentType.cs
@@ -199,10 +199,17 @@ namespace umbraco.cms.businesslogic
/// The Alias of the ContentType
/// The Iconurl of Contents of this ContentType
protected static void Create(int NodeId, string Alias, string IconUrl)
+ {
+ Create(NodeId, Alias, IconUrl, true);
+ }
+
+ internal static void Create(int nodeId, string alias, string iconUrl, bool formatAlias)
{
SqlHelper.ExecuteNonQuery(
- "Insert into cmsContentType (nodeId,alias,icon) values (" + NodeId + ",'" + helpers.Casing.SafeAliasWithForcingCheck(Alias) +
- "','" + IconUrl + "')");
+ "Insert into cmsContentType (nodeId,alias,icon) values (" +
+ nodeId + ",'" +
+ (formatAlias ? helpers.Casing.SafeAliasWithForcingCheck(alias) : alias) +
+ "','" + iconUrl + "')");
}
///
diff --git a/src/umbraco.cms/businesslogic/member/MemberType.cs b/src/umbraco.cms/businesslogic/member/MemberType.cs
index 0a0612dc83..449531315c 100644
--- a/src/umbraco.cms/businesslogic/member/MemberType.cs
+++ b/src/umbraco.cms/businesslogic/member/MemberType.cs
@@ -245,7 +245,10 @@ namespace umbraco.cms.businesslogic.member
Guid uniqueId = Guid.NewGuid();
CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId);
- ContentType.Create(n.Id, Text, "");
+ ContentType.Create(n.Id, Text, "",
+ //don't format the alias if it equals this. See: http://issues.umbraco.org/issue/U4-3968
+ Text != "_umbracoSystemDefaultProtectType");
+
MemberType mt = new MemberType(n.Id);
mt.IconUrl = "member.gif";
NewEventArgs e = new NewEventArgs();