From 17883358b6869bbf58e99cbb7fdbd2108cda214d Mon Sep 17 00:00:00 2001
From: Shannon
Date: Thu, 2 Jan 2014 14:13:43 +1100
Subject: [PATCH] Fixes some issues with the User membership provider, updates
user create dialog to also have an email address (which is required by
membership), adds validation to the member and user create dialogs to ensure
that the email address is validated to be a correcty formatted address.
---
.../Security/MembershipProviderBase.cs | 2 +-
src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 8 +
.../umbraco/config/create/UI.xml | 2 +-
src/Umbraco.Web.UI/umbraco/create/User.ascx | 35 +++++
.../umbraco/create/User.ascx.cs | 84 +++++++++++
.../umbraco/create/User.ascx.designer.cs | 105 +++++++++++++
src/Umbraco.Web.UI/umbraco/create/member.ascx | 11 +-
.../Application/UmbracoApplicationActions.js | 142 ++++++++++--------
.../umbraco/create/member.ascx.cs | 27 +---
.../umbraco/create/member.ascx.designer.cs | 11 +-
.../umbraco/create/userTasks.cs | 19 ++-
.../UsersMembershipProvider.cs | 16 +-
12 files changed, 358 insertions(+), 104 deletions(-)
create mode 100644 src/Umbraco.Web.UI/umbraco/create/User.ascx
create mode 100644 src/Umbraco.Web.UI/umbraco/create/User.ascx.cs
create mode 100644 src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs
diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs
index 901bec808b..71fb729b78 100644
--- a/src/Umbraco.Core/Security/MembershipProviderBase.cs
+++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs
@@ -605,7 +605,7 @@ namespace Umbraco.Core.Security
return pass;
}
- protected bool IsEmailValid(string email)
+ internal static bool IsEmailValid(string email)
{
const string pattern = @"^(?!\.)(""([^""\r\\]|\\[""\r\\])*""|"
+ @"([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?
PartialViewMacro.ascx
+
+ User.ascx
+ ASPXCodeBehind
+
+
+ User.ascx
+
ExamineManagement.ascx
ASPXCodeBehind
@@ -589,6 +596,7 @@
+
diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
index 88105d0ad2..3f063c134a 100644
--- a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
@@ -70,7 +70,7 @@
- /create/simple.ascx
+ /create/user.ascx
diff --git a/src/Umbraco.Web.UI/umbraco/create/User.ascx b/src/Umbraco.Web.UI/umbraco/create/User.ascx
new file mode 100644
index 0000000000..deb139c557
--- /dev/null
+++ b/src/Umbraco.Web.UI/umbraco/create/User.ascx
@@ -0,0 +1,35 @@
+<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="User.ascx.cs" Inherits="Umbraco.Web.UI.Umbraco.Create.User" %>
+<%@ Import Namespace="umbraco" %>
+
+
+ Login Name:
+ *
+
+
+
+
+
+ E-mail:
+ *
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI/umbraco/create/User.ascx.cs b/src/Umbraco.Web.UI/umbraco/create/User.ascx.cs
new file mode 100644
index 0000000000..ff69a0b44c
--- /dev/null
+++ b/src/Umbraco.Web.UI/umbraco/create/User.ascx.cs
@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Umbraco.Core.Security;
+using umbraco;
+using Umbraco.Core;
+using umbraco.BasePages;
+
+
+namespace Umbraco.Web.UI.Umbraco.Create
+{
+ public partial class User : UI.Controls.UmbracoUserControl
+ {
+ protected override void OnLoad(EventArgs e)
+ {
+ base.OnLoad(e);
+ DataBind();
+ }
+
+ ///
+ /// Validation to Check if Login Name Exists
+ ///
+ ///
+ ///
+ protected void LoginExistsCheck(object sender, ServerValidateEventArgs e)
+ {
+ var user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(Login.Text.Replace(" ", "").ToLower(), false);
+
+ if (Login.Text != "" && user != null)
+ e.IsValid = false;
+ else
+ e.IsValid = true;
+ }
+
+
+ ///
+ /// Validation to Check if Member with email Exists
+ ///
+ ///
+ ///
+ protected void EmailExistsCheck(object sender, ServerValidateEventArgs e)
+ {
+ var found = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUserNameByEmail(Email.Text.ToLower());
+
+ if (Email.Text != "" && found.IsNullOrWhiteSpace() == false && Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].RequiresUniqueEmail)
+ e.IsValid = false;
+ else
+ e.IsValid = true;
+ }
+
+ protected void sbmt_Click(object sender, EventArgs e)
+ {
+ if (Page.IsValid)
+ {
+ var formatted = string.Format("{0}|{1}", Login.Text, Email.Text);
+ var returnUrl = global::umbraco.presentation.create.dialogHandler_temp.Create(
+ Request.GetItemAsString("nodeType"),
+ -1,
+ formatted);
+
+ BasePage.Current.ClientTools
+ .ChangeContentFrameUrl(returnUrl)
+ .ChildNodeCreated()
+ .CloseModalWindow();
+
+ }
+
+ }
+
+ public global::umbraco.BusinessLogic.User CurrentUser
+ {
+ get { return Security.CurrentUser; }
+ }
+
+ protected void EmailValidator_OnServerValidate(object source, ServerValidateEventArgs args)
+ {
+ args.IsValid = MembershipProviderBase.IsEmailValid(args.Value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs b/src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs
new file mode 100644
index 0000000000..1017a1da04
--- /dev/null
+++ b/src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs
@@ -0,0 +1,105 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace Umbraco.Web.UI.Umbraco.Create {
+
+
+ public partial class User {
+
+ ///
+ /// validationSummary control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.ValidationSummary validationSummary;
+
+ ///
+ /// loginRequired control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RequiredFieldValidator loginRequired;
+
+ ///
+ /// loginExistsCheck control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator loginExistsCheck;
+
+ ///
+ /// Login control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Login;
+
+ ///
+ /// emailRequired control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RequiredFieldValidator emailRequired;
+
+ ///
+ /// emailExistsCheck control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator emailExistsCheck;
+
+ ///
+ /// EmailValidator control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator EmailValidator;
+
+ ///
+ /// Email control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Email;
+
+ ///
+ /// Textbox1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox Textbox1;
+
+ ///
+ /// sbmt control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button sbmt;
+ }
+}
diff --git a/src/Umbraco.Web.UI/umbraco/create/member.ascx b/src/Umbraco.Web.UI/umbraco/create/member.ascx
index cd871d0aa8..5d6ea30f8e 100644
--- a/src/Umbraco.Web.UI/umbraco/create/member.ascx
+++ b/src/Umbraco.Web.UI/umbraco/create/member.ascx
@@ -21,10 +21,15 @@
- E-mail:*
-
-
+
+
+
diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js
index d3598df711..d4d3eee96a 100644
--- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js
+++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js
@@ -6,7 +6,7 @@
Umbraco.Sys.registerNamespace("Umbraco.Application");
-Umbraco.Application.Actions = function () {
+Umbraco.Application.Actions = function() {
///
/// Application actions actions for the context menu, help dialogs, logout, etc...
/// This class supports an event listener model. Currently the available events are:
@@ -14,7 +14,6 @@ Umbraco.Application.Actions = function () {
///
return {
-
_utils: Umbraco.Utils, //alias to Umbraco Utils
_dialogWindow: null,
/// A reference to a dialog window to open, any action that doesn't open in an overlay, opens in a dialog
@@ -23,24 +22,24 @@ Umbraco.Application.Actions = function () {
_currApp: "",
_isSaving: "",
- addEventHandler: function (fnName, fn) {
+ addEventHandler: function(fnName, fn) {
/// Adds an event listener to the event name event
- if (typeof (jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
+ if (typeof(jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events
},
- removeEventHandler: function (fnName, fn) {
+ removeEventHandler: function(fnName, fn) {
/// Removes an event listener to the event name event
- if (typeof (jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
+ if (typeof(jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events
},
- showSpeachBubble: function (ico, hdr, msg) {
- if (typeof (UmbClientMgr.mainWindow().UmbSpeechBubble) != "undefined") {
+ showSpeachBubble: function(ico, hdr, msg) {
+ if (typeof(UmbClientMgr.mainWindow().UmbSpeechBubble) != "undefined") {
UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage(ico, hdr, msg);
}
else alert(msg);
},
- launchHelp: function (lang, userType) {
+ launchHelp: function(lang, userType) {
/// Launches the contextual help window
var rightUrl = UmbClientMgr.contentFrame().document.location.href.split("\/");
if (rightUrl.length > 0) {
@@ -54,13 +53,13 @@ Umbraco.Application.Actions = function () {
return false;
},
- launchAbout: function () {
+ launchAbout: function() {
/// Launches the about Umbraco window
UmbClientMgr.openModalWindow("dialogs/about.aspx", UmbClientMgr.uiKeys()['general_about'], true, 450, 390);
return false;
},
- launchCreateWizard: function () {
+ launchCreateWizard: function() {
/// Launches the create content wizard
if (this._currApp == 'media' || this._currApp == 'content' || this._currApp == '') {
@@ -71,12 +70,13 @@ Umbraco.Application.Actions = function () {
UmbClientMgr.openModalWindow("dialogs/create.aspx?nodeType=" + this._currApp + "&app=" + this._currApp + "&rnd=" + this._utils.generateRandom(), UmbClientMgr.uiKeys()['actions_create'] + " " + this._currApp, true, 620, 470);
return false;
- } else
+ }
+ else
alert('Not supported - please create by right clicking the parentnode and choose new...');
},
- logout: function (t) {
-
+ logout: function(t) {
+
if (!t) {
throw "The security token must be set in order to log a user out using this method";
}
@@ -90,7 +90,7 @@ Umbraco.Application.Actions = function () {
return false;
},
- submitDefaultWindow: function () {
+ submitDefaultWindow: function() {
if (!this._isSaving) {
this._isSaving = true;
jQuery(".editorIcon[id*=save]:first, .editorIcon:input:image[id*=Save]:first").click();
@@ -99,13 +99,22 @@ Umbraco.Application.Actions = function () {
return false;
},
- bindSaveShortCut: function () {
- jQuery(document).bind('keydown', 'ctrl+s', function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; });
- jQuery(":input").bind('keydown', 'ctrl+s', function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; });
- jQuery(document).bind('UMBRACO_TINYMCE_SAVE', function (evt, orgEvent) { UmbClientMgr.appActions().submitDefaultWindow(); return false; });
+ bindSaveShortCut: function() {
+ jQuery(document).bind('keydown', 'ctrl+s', function(evt) {
+ UmbClientMgr.appActions().submitDefaultWindow();
+ return false;
+ });
+ jQuery(":input").bind('keydown', 'ctrl+s', function(evt) {
+ UmbClientMgr.appActions().submitDefaultWindow();
+ return false;
+ });
+ jQuery(document).bind('UMBRACO_TINYMCE_SAVE', function(evt, orgEvent) {
+ UmbClientMgr.appActions().submitDefaultWindow();
+ return false;
+ });
},
- shiftApp: function (whichApp, appName) {
+ shiftApp: function(whichApp, appName) {
/// Changes the application
this._debug("shiftApp: " + whichApp + ", " + appName);
@@ -129,16 +138,16 @@ Umbraco.Application.Actions = function () {
jQuery("#FindDocuments .umbracoSearchHolder").fadeIn(500);
//need to set the recycle bin node id based on app
switch (this._currApp) {
- case ("media"):
- UmbClientMgr.mainTree().setRecycleBinNodeId(-21);
- break;
- case ("content"):
- UmbClientMgr.mainTree().setRecycleBinNodeId(-20);
- break;
+ case ("media"):
+ UmbClientMgr.mainTree().setRecycleBinNodeId(-21);
+ break;
+ case ("content"):
+ UmbClientMgr.mainTree().setRecycleBinNodeId(-20);
+ break;
}
}
- UmbClientMgr.mainTree().rebuildTree(whichApp, function (args) {
+ UmbClientMgr.mainTree().rebuildTree(whichApp, function(args) {
//the callback will fire when the tree rebuilding is done, we
//need to check the args to see if the tree was rebuild from cache
//and if it had a previously selected node, if it didn't then load the dashboard.
@@ -152,13 +161,13 @@ Umbraco.Application.Actions = function () {
UmbClientMgr.mainWindow().document.title = appName + this._windowTitle + window.location.hostname.toLowerCase().replace('www', '');
},
- getCurrApp: function () {
+ getCurrApp: function() {
return this._currApp;
},
//TODO: Move this into a window manager class
- openDialog: function (diaTitle, diaDoc, dwidth, dheight, optionalParams) {
+ openDialog: function(diaTitle, diaDoc, dwidth, dheight, optionalParams) {
/// Opens the dialog window
if (this._dialogWindow != null && !this._dialogWindow.closed) {
@@ -167,16 +176,16 @@ Umbraco.Application.Actions = function () {
this._dialogWindow = UmbClientMgr.mainWindow().open(diaDoc, 'dialogpage', "width=" + dwidth + "px,height=" + dheight + "px" + optionalParams);
},
- openDashboard: function (whichApp) {
+ openDashboard: function(whichApp) {
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
},
- actionTreeEditMode: function () {
+ actionTreeEditMode: function() {
///
UmbClientMgr.mainTree().toggleEditMode(true);
},
- actionSort: function () {
+ actionSort: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -185,7 +194,7 @@ Umbraco.Application.Actions = function () {
},
- actionChangeDocType: function () {
+ actionChangeDocType: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -194,7 +203,7 @@ Umbraco.Application.Actions = function () {
},
- actionRights: function () {
+ actionRights: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -202,7 +211,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionProtect: function () {
+ actionProtect: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -210,20 +219,20 @@ Umbraco.Application.Actions = function () {
}
},
- actionRollback: function () {
+ actionRollback: function() {
///
UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550);
},
- actionRefresh: function () {
+ actionRefresh: function() {
///
//raise nodeRefresh event
jQuery(window.top).trigger("nodeRefresh", []);
},
- actionNotify: function () {
+ actionNotify: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -231,11 +240,11 @@ Umbraco.Application.Actions = function () {
}
},
- actionUpdate: function () {
+ actionUpdate: function() {
///
},
- actionPublish: function () {
+ actionPublish: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -243,7 +252,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionToPublish: function () {
+ actionToPublish: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -253,8 +262,8 @@ Umbraco.Application.Actions = function () {
}
},
- actionQuit: function (t) {
-
+ actionQuit: function(t) {
+
if (!t) {
throw "The security token must be set in order to log a user out using this method";
}
@@ -263,13 +272,13 @@ Umbraco.Application.Actions = function () {
document.location.href = 'logout.aspx?t=' + t;
},
- actionRePublish: function () {
+ actionRePublish: function() {
///
UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), 'Republishing entire site', true, 450, 210);
},
- actionAssignDomain: function () {
+ actionAssignDomain: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -277,13 +286,13 @@ Umbraco.Application.Actions = function () {
}
},
- actionLiveEdit: function () {
+ actionLiveEdit: function() {
///
window.open("canvas.aspx?redir=/" + UmbClientMgr.mainTree().getActionNode().nodeId + ".aspx", "liveediting");
},
- actionNew: function () {
+ actionNew: function() {
/// Show the create new modal overlay
var actionNode = UmbClientMgr.mainTree().getActionNode();
if (actionNode.nodeType != '') {
@@ -293,6 +302,9 @@ Umbraco.Application.Actions = function () {
else if (actionNode.nodeType == "initmember") {
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380);
}
+ else if (actionNode.nodeType == "users") {
+ UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380);
+ }
else if (actionNode.nodeType == "initpython" || actionNode.nodeType == "initdlrscripting") {
UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 420, 380);
}
@@ -302,7 +314,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionNewFolder: function () {
+ actionNewFolder: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -310,7 +322,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionSendToTranslate: function () {
+ actionSendToTranslate: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -318,7 +330,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionEmptyTranscan: function () {
+ actionEmptyTranscan: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -326,7 +338,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionImport: function () {
+ actionImport: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -334,7 +346,7 @@ Umbraco.Application.Actions = function () {
}
},
- actionExport: function () {
+ actionExport: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -342,17 +354,17 @@ Umbraco.Application.Actions = function () {
}
},
- actionAudit: function () {
+ actionAudit: function() {
///
UmbClientMgr.openModalWindow('dialogs/viewAuditTrail.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_auditTrail'], true, 550, 500);
},
- actionPackage: function () {
+ actionPackage: function() {
///
},
- actionDelete: function () {
+ actionDelete: function() {
///
var actionNode = UmbClientMgr.mainTree().getActionNode();
@@ -377,7 +389,7 @@ Umbraco.Application.Actions = function () {
umbraco.presentation.webservices.legacyAjaxCalls.DeleteContentPermanently(
UmbClientMgr.mainTree().getActionNode().nodeId,
UmbClientMgr.mainTree().getActionNode().nodeType,
- function () {
+ function() {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(window.top).trigger("nodeDeleted", []);
@@ -388,12 +400,12 @@ Umbraco.Application.Actions = function () {
UmbClientMgr.mainTree().getActionNode().nodeId,
UmbClientMgr.mainTree().getActionNode().nodeName,
UmbClientMgr.mainTree().getActionNode().nodeType,
- function () {
+ function() {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(window.top).trigger("nodeDeleted", []);
},
- function (error) {
+ function(error) {
_this._debug("actionDelete: Raising public error event");
//raise public error event
jQuery(window.top).trigger("publicError", [error]);
@@ -403,19 +415,19 @@ Umbraco.Application.Actions = function () {
},
- actionDisable: function () {
+ actionDisable: function() {
///
/// Used for users when disable is selected.
///
if (confirm(uiKeys['defaultdialogs_confirmdisable'] + ' "' + UmbClientMgr.mainTree().getActionNode().nodeName + '"?\n\n')) {
- umbraco.presentation.webservices.legacyAjaxCalls.DisableUser(UmbClientMgr.mainTree().getActionNode().nodeId, function () {
+ umbraco.presentation.webservices.legacyAjaxCalls.DisableUser(UmbClientMgr.mainTree().getActionNode().nodeId, function() {
UmbClientMgr.mainTree().reloadActionNode();
});
}
},
- actionMove: function () {
+ actionMove: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
@@ -423,17 +435,17 @@ Umbraco.Application.Actions = function () {
}
},
- actionCopy: function () {
+ actionCopy: function() {
///
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
UmbClientMgr.openModalWindow("dialogs/moveOrCopy.aspx?app=" + this._currApp + "&mode=copy&id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_copy'], true, 500, 470);
}
},
- _debug: function (strMsg) {
+ _debug: function(strMsg) {
if (this._isDebug) {
Sys.Debug.trace("AppActions: " + strMsg);
}
}
- }
-}
+ };
+};
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.cs
index 72ff6239fc..e60411bda6 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.cs
@@ -1,3 +1,5 @@
+using Umbraco.Core.Security;
+
namespace umbraco.cms.presentation.create.controls
{
using System;
@@ -61,26 +63,6 @@ namespace umbraco.cms.presentation.create.controls
}
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- //
- // CODEGEN: This call is required by the ASP.NET Web Form Designer.
- //
- InitializeComponent();
- base.OnInit(e);
- }
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
-
- }
- #endregion
-
protected void sbmt_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
@@ -128,5 +110,10 @@ namespace umbraco.cms.presentation.create.controls
else
e.IsValid = true;
}
+
+ protected void EmailValidator_OnServerValidate(object source, ServerValidateEventArgs args)
+ {
+ args.IsValid = MembershipProviderBase.IsEmailValid(args.Value);
+ }
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.designer.cs
index 6af3644064..62289980ca 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.designer.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/member.ascx.designer.cs
@@ -11,7 +11,16 @@ namespace umbraco.cms.presentation.create.controls {
public partial class member {
-
+
+ ///
+ /// EmailValidator control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CustomValidator EmailValidator;
+
///
/// validationSummary control.
///
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs
index 4cc59ca11b..9541514225 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs
@@ -42,11 +42,22 @@ namespace umbraco
try
{
// Password is auto-generated. They are they required to change the password by editing the user information.
- var u = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].CreateUser(Alias,
- Membership.GeneratePassword(
+
+ var password = Membership.GeneratePassword(
Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredPasswordLength,
- Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredNonAlphanumericCharacters),
- "", "", "", true, null, out status);
+ Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].MinRequiredNonAlphanumericCharacters);
+
+ var parts = Alias.Split(new[] {'|'}, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length != 2)
+ {
+ return false;
+ }
+ var login = parts[0];
+ var email = parts[1];
+
+
+ var u = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].CreateUser(
+ login, password, email.Trim().ToLower(), "", "", true, null, out status);
_returnUrl = string.Format("users/EditUser.aspx?id={0}", u.ProviderUserKey.ToString());
diff --git a/src/umbraco.providers/UsersMembershipProvider.cs b/src/umbraco.providers/UsersMembershipProvider.cs
index 2f625095ad..d293fe612e 100644
--- a/src/umbraco.providers/UsersMembershipProvider.cs
+++ b/src/umbraco.providers/UsersMembershipProvider.cs
@@ -131,13 +131,6 @@ namespace umbraco.providers
///
protected override MembershipUser PerformCreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
{
- var args = new ValidatePasswordEventArgs(username, password, true);
- OnValidatingPassword(args);
- if (args.Cancel)
- {
- status = MembershipCreateStatus.InvalidPassword;
- return null;
- }
// TODO: Does umbraco allow duplicate emails??
//if (RequiresUniqueEmail && !string.IsNullOrEmpty(GetUserNameByEmail(email)))
@@ -162,7 +155,7 @@ namespace umbraco.providers
string salt;
var encodedPass = EncryptOrHashNewPassword(password, out salt);
- User.MakeNew(username, username, FormatPasswordForStorage(encodedPass, salt), ut);
+ User.MakeNew(username, username, FormatPasswordForStorage(encodedPass, salt), email, ut);
status = MembershipCreateStatus.Success;
}
@@ -346,7 +339,12 @@ namespace umbraco.providers
///
public override string GetUserNameByEmail(string email)
{
- throw new Exception("The method or operation is not implemented.");
+ var found = User.getAllByEmail(email.Trim().ToLower(), true);
+ if (found == null || found.Any() == false)
+ {
+ return null;
+ }
+ return found.First().LoginName;
}
///