diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs index 2bab497b2b..a206f9e01e 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -195,6 +195,12 @@ namespace Umbraco.Core.Configuration.UmbracoSettings get { return GetOptionalTextElement("loginBackgroundImage", string.Empty); } } + [ConfigurationProperty("emailRegex")] + internal InnerTextConfigurationElement EmailRegex + { + get { return GetOptionalTextElement("emailRegex", "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"); } + } + string IContentSection.NotificationEmailAddress { get { return Notifications.NotificationEmailAddress; } @@ -357,6 +363,11 @@ namespace Umbraco.Core.Configuration.UmbracoSettings string IContentSection.LoginBackgroundImage { get { return LoginBackgroundImage; } + } + + string IContentSection.EmailRegex + { + get { return EmailRegex; } } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs index 7e874c9582..b06d60ea2f 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/IContentSection.cs @@ -74,6 +74,8 @@ namespace Umbraco.Core.Configuration.UmbracoSettings bool EnablePropertyValueConverters { get; } - string LoginBackgroundImage { get; } + string LoginBackgroundImage { get; } + + string EmailRegex { get; } } } \ No newline at end of file diff --git a/src/Umbraco.Core/Security/MembershipProviderBase.cs b/src/Umbraco.Core/Security/MembershipProviderBase.cs index 41fc8d197c..06de1ebd17 100644 --- a/src/Umbraco.Core/Security/MembershipProviderBase.cs +++ b/src/Umbraco.Core/Security/MembershipProviderBase.cs @@ -8,6 +8,7 @@ using System.Web; using System.Web.Configuration; using System.Web.Hosting; using System.Web.Security; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Models; @@ -677,10 +678,7 @@ namespace Umbraco.Core.Security internal static bool IsEmailValid(string email) { - const string pattern = @"^(?!\.)(""([^""\r\\]|\\[""\r\\])*""|" - + @"([-a-z0-9!#$%&'*+/=?^_`{|}~]|(?
- +
@@ -30,17 +30,19 @@ - Required - + @@ -51,7 +53,7 @@ class="input-block-level" ng-model="vm.user.username" umb-auto-focus name="username" - required + required val-server-field="Username" /> Required diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 3b185ef4b1..287a21c2bf 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -287,6 +287,7 @@ namespace Umbraco.Web.Editors }, {"keepUserLoggedIn", UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn}, {"usernameIsEmail", UmbracoConfig.For.UmbracoSettings().Security.UsernameIsEmail}, + {"emailRegex", UmbracoConfig.For.UmbracoSettings().Content.EmailRegex}, {"cssPath", IOHelper.ResolveUrl(SystemDirectories.Css).TrimEnd('/')}, {"allowPasswordReset", UmbracoConfig.For.UmbracoSettings().Security.AllowPasswordReset}, {"loginBackgroundImage", UmbracoConfig.For.UmbracoSettings().Content.LoginBackgroundImage},