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.
This commit is contained in:
@@ -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!#$%&'*+/=?^_`{|}~]|(?<!\.)\.)*)(?<!\.)"
|
||||
|
||||
@@ -434,6 +434,13 @@
|
||||
<Compile Include="Umbraco\Create\PartialViewMacro.ascx.designer.cs">
|
||||
<DependentUpon>PartialViewMacro.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Create\User.ascx.cs">
|
||||
<DependentUpon>User.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Create\User.ascx.designer.cs">
|
||||
<DependentUpon>User.ascx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Umbraco\Dashboard\ExamineManagement.ascx.cs">
|
||||
<DependentUpon>ExamineManagement.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
@@ -589,6 +596,7 @@
|
||||
<Content Include="Config\Splashes\booting.aspx" />
|
||||
<Content Include="Config\Splashes\noNodes.aspx" />
|
||||
<Content Include="Umbraco\Create\PartialView.ascx" />
|
||||
<Content Include="Umbraco\Create\User.ascx" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_content.ico" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_default.ico" />
|
||||
<Content Include="Umbraco\Images\PinnedIcons\task_developer.ico" />
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</nodeType>
|
||||
<nodeType alias="users">
|
||||
<header>User</header>
|
||||
<usercontrol>/create/simple.ascx</usercontrol>
|
||||
<usercontrol>/create/user.ascx</usercontrol>
|
||||
<tasks>
|
||||
<create assembly="umbraco" type="userTasks" />
|
||||
<delete assembly="umbraco" type="userTasks" />
|
||||
|
||||
35
src/Umbraco.Web.UI/umbraco/create/User.ascx
Normal file
35
src/Umbraco.Web.UI/umbraco/create/User.ascx
Normal file
@@ -0,0 +1,35 @@
|
||||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="User.ascx.cs" Inherits="Umbraco.Web.UI.Umbraco.Create.User" %>
|
||||
<%@ Import Namespace="umbraco" %>
|
||||
<asp:ValidationSummary runat="server" DisplayMode="BulletList" ID="validationSummary" CssClass="error"></asp:ValidationSummary>
|
||||
<p>
|
||||
Login Name:
|
||||
<asp:RequiredFieldValidator ID="loginRequired"
|
||||
ErrorMessage='<%#ui.Text("errorHandling", "errorMandatoryWithoutTab", "Login Name", CurrentUser) %>'
|
||||
ControlToValidate="Login" runat="server">*</asp:RequiredFieldValidator>
|
||||
<asp:CustomValidator ID="loginExistsCheck" runat="server"
|
||||
ErrorMessage='<%#ui.Text("errorHandling", "errorExistsWithoutTab", "Login Name", CurrentUser) %>'
|
||||
ControlToValidate="Login" ValidateEmptyText="false" OnServerValidate="LoginExistsCheck"></asp:CustomValidator>
|
||||
<br />
|
||||
<asp:TextBox ID="Login" runat="server" Width="350px" CssClass="bigInput"></asp:TextBox>
|
||||
</p>
|
||||
<p>
|
||||
E-mail:
|
||||
<asp:RequiredFieldValidator ID="emailRequired"
|
||||
ErrorMessage='<%#ui.Text("errorHandling", "errorMandatoryWithoutTab", "E-mail", CurrentUser) %>'
|
||||
ControlToValidate="Email" runat="server">*</asp:RequiredFieldValidator>
|
||||
<asp:CustomValidator ID="emailExistsCheck" runat="server"
|
||||
ErrorMessage='<%#ui.Text("errorHandling", "errorExistsWithoutTab", "E-mail", CurrentUser) %>'
|
||||
ControlToValidate="Email" ValidateEmptyText="false" OnServerValidate="EmailExistsCheck"></asp:CustomValidator>
|
||||
<asp:CustomValidator runat="server" ID="EmailValidator" OnServerValidate="EmailValidator_OnServerValidate"
|
||||
ControlToValidate="Email"
|
||||
ErrorMessage="Invalid email address"
|
||||
Display="None" />
|
||||
<br />
|
||||
<asp:TextBox ID="Email" runat="server" Width="350px" CssClass="bigInput"></asp:TextBox>
|
||||
</p>
|
||||
<!-- added to support missing postback on enter in IE -->
|
||||
<asp:TextBox runat="server" Style="visibility: hidden; display: none;" ID="Textbox1" />
|
||||
<div style="padding-top: 15px;">
|
||||
<asp:Button ID="sbmt" runat="server" Style="margin-top: 14px" Width="90" OnClick="sbmt_Click" Text='<%# ui.Text("create") %>'></asp:Button>
|
||||
<em><%= ui.Text("or") %></em> <a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()"><%=ui.Text("cancel")%></a>
|
||||
</div>
|
||||
84
src/Umbraco.Web.UI/umbraco/create/User.ascx.cs
Normal file
84
src/Umbraco.Web.UI/umbraco/create/User.ascx.cs
Normal file
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validation to Check if Login Name Exists
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Validation to Check if Member with email Exists
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
105
src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs
generated
Normal file
105
src/Umbraco.Web.UI/umbraco/create/User.ascx.designer.cs
generated
Normal file
@@ -0,0 +1,105 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Create {
|
||||
|
||||
|
||||
public partial class User {
|
||||
|
||||
/// <summary>
|
||||
/// validationSummary control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ValidationSummary validationSummary;
|
||||
|
||||
/// <summary>
|
||||
/// loginRequired control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator loginRequired;
|
||||
|
||||
/// <summary>
|
||||
/// loginExistsCheck control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CustomValidator loginExistsCheck;
|
||||
|
||||
/// <summary>
|
||||
/// Login control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox Login;
|
||||
|
||||
/// <summary>
|
||||
/// emailRequired control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.RequiredFieldValidator emailRequired;
|
||||
|
||||
/// <summary>
|
||||
/// emailExistsCheck control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CustomValidator emailExistsCheck;
|
||||
|
||||
/// <summary>
|
||||
/// EmailValidator control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CustomValidator EmailValidator;
|
||||
|
||||
/// <summary>
|
||||
/// Email control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox Email;
|
||||
|
||||
/// <summary>
|
||||
/// Textbox1 control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox Textbox1;
|
||||
|
||||
/// <summary>
|
||||
/// sbmt control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button sbmt;
|
||||
}
|
||||
}
|
||||
@@ -21,10 +21,15 @@
|
||||
<asp:TextBox ID="Login" runat="server" Width="350px" CssClass="bigInput"></asp:TextBox><br />
|
||||
</p>
|
||||
<p>
|
||||
E-mail:<asp:RequiredFieldValidator ID="emailRequired" ErrorMessage="*" ControlToValidate="Email"
|
||||
E-mail:
|
||||
<asp:RequiredFieldValidator ID="emailRequired" ErrorMessage="*" ControlToValidate="Email"
|
||||
runat="server">*</asp:RequiredFieldValidator>
|
||||
<asp:CustomValidator ID="emailExistsCheck" runat="server" ErrorMessage="*" ControlToValidate="Email" ValidateEmptyText="false" OnServerValidate="EmailExistsCheck"></asp:CustomValidator>
|
||||
<br />
|
||||
<asp:CustomValidator ID="emailExistsCheck" runat="server" ErrorMessage="*" ControlToValidate="Email" ValidateEmptyText="false" OnServerValidate="EmailExistsCheck"></asp:CustomValidator>
|
||||
<asp:CustomValidator runat="server" ID="EmailValidator" OnServerValidate="EmailValidator_OnServerValidate"
|
||||
ControlToValidate="Email"
|
||||
ErrorMessage="Invalid email address"
|
||||
Display="None"/>
|
||||
<br />
|
||||
<asp:TextBox ID="Email" runat="server" Width="350px" CssClass="bigInput"></asp:TextBox><br />
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
Umbraco.Sys.registerNamespace("Umbraco.Application");
|
||||
|
||||
Umbraco.Application.Actions = function () {
|
||||
Umbraco.Application.Actions = function() {
|
||||
/// <summary>
|
||||
/// 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 () {
|
||||
/// </summary>
|
||||
|
||||
return {
|
||||
|
||||
_utils: Umbraco.Utils, //alias to Umbraco Utils
|
||||
_dialogWindow: null,
|
||||
/// <field name="_dialogWindow">A reference to a dialog window to open, any action that doesn't open in an overlay, opens in a dialog</field>
|
||||
@@ -23,24 +22,24 @@ Umbraco.Application.Actions = function () {
|
||||
_currApp: "",
|
||||
_isSaving: "",
|
||||
|
||||
addEventHandler: function (fnName, fn) {
|
||||
addEventHandler: function(fnName, fn) {
|
||||
/// <summary>Adds an event listener to the event name event</summary>
|
||||
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) {
|
||||
/// <summary>Removes an event listener to the event name event</summary>
|
||||
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) {
|
||||
/// <summary>Launches the contextual help window</summary>
|
||||
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() {
|
||||
/// <summary>Launches the about Umbraco window</summary>
|
||||
UmbClientMgr.openModalWindow("dialogs/about.aspx", UmbClientMgr.uiKeys()['general_about'], true, 450, 390);
|
||||
return false;
|
||||
},
|
||||
|
||||
launchCreateWizard: function () {
|
||||
launchCreateWizard: function() {
|
||||
/// <summary>Launches the create content wizard</summary>
|
||||
|
||||
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) {
|
||||
/// <summary>Changes the application</summary>
|
||||
|
||||
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) {
|
||||
/// <summary>Opens the dialog window</summary>
|
||||
|
||||
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() {
|
||||
/// <summary></summary>
|
||||
UmbClientMgr.mainTree().toggleEditMode(true);
|
||||
},
|
||||
|
||||
actionSort: function () {
|
||||
actionSort: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -185,7 +194,7 @@ Umbraco.Application.Actions = function () {
|
||||
|
||||
},
|
||||
|
||||
actionChangeDocType: function () {
|
||||
actionChangeDocType: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -194,7 +203,7 @@ Umbraco.Application.Actions = function () {
|
||||
|
||||
},
|
||||
|
||||
actionRights: function () {
|
||||
actionRights: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -202,7 +211,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionProtect: function () {
|
||||
actionProtect: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -210,20 +219,20 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionRollback: function () {
|
||||
actionRollback: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550);
|
||||
},
|
||||
|
||||
actionRefresh: function () {
|
||||
actionRefresh: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
//raise nodeRefresh event
|
||||
jQuery(window.top).trigger("nodeRefresh", []);
|
||||
},
|
||||
|
||||
actionNotify: function () {
|
||||
actionNotify: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -231,11 +240,11 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionUpdate: function () {
|
||||
actionUpdate: function() {
|
||||
/// <summary></summary>
|
||||
},
|
||||
|
||||
actionPublish: function () {
|
||||
actionPublish: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -243,7 +252,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionToPublish: function () {
|
||||
actionToPublish: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
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() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), 'Republishing entire site', true, 450, 210);
|
||||
},
|
||||
|
||||
actionAssignDomain: function () {
|
||||
actionAssignDomain: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -277,13 +286,13 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionLiveEdit: function () {
|
||||
actionLiveEdit: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
window.open("canvas.aspx?redir=/" + UmbClientMgr.mainTree().getActionNode().nodeId + ".aspx", "liveediting");
|
||||
},
|
||||
|
||||
actionNew: function () {
|
||||
actionNew: function() {
|
||||
/// <summary>Show the create new modal overlay</summary>
|
||||
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() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -310,7 +322,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionSendToTranslate: function () {
|
||||
actionSendToTranslate: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -318,7 +330,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionEmptyTranscan: function () {
|
||||
actionEmptyTranscan: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -326,7 +338,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionImport: function () {
|
||||
actionImport: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -334,7 +346,7 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionExport: function () {
|
||||
actionExport: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -342,17 +354,17 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionAudit: function () {
|
||||
actionAudit: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
UmbClientMgr.openModalWindow('dialogs/viewAuditTrail.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_auditTrail'], true, 550, 500);
|
||||
},
|
||||
|
||||
actionPackage: function () {
|
||||
actionPackage: function() {
|
||||
/// <summary></summary>
|
||||
},
|
||||
|
||||
actionDelete: function () {
|
||||
actionDelete: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
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() {
|
||||
/// <summary>
|
||||
/// Used for users when disable is selected.
|
||||
/// </summary>
|
||||
|
||||
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() {
|
||||
/// <summary></summary>
|
||||
|
||||
if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') {
|
||||
@@ -423,17 +435,17 @@ Umbraco.Application.Actions = function () {
|
||||
}
|
||||
},
|
||||
|
||||
actionCopy: function () {
|
||||
actionCopy: function() {
|
||||
/// <summary></summary>
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,16 @@ namespace umbraco.cms.presentation.create.controls {
|
||||
|
||||
|
||||
public partial class member {
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// EmailValidator control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.CustomValidator EmailValidator;
|
||||
|
||||
/// <summary>
|
||||
/// validationSummary control.
|
||||
/// </summary>
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -131,13 +131,6 @@ namespace umbraco.providers
|
||||
/// </returns>
|
||||
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
|
||||
/// </returns>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user