U4-10368 Need option to set username different than e-mail for AD compatibility

This commit is contained in:
Shannon
2017-09-05 22:35:40 +10:00
parent 66affa7f85
commit 0dee1f0fac
5 changed files with 39 additions and 4 deletions

View File

@@ -13,6 +13,15 @@
string AuthCookieName { get; }
string AuthCookieDomain { get; }
string AuthCookieDomain { get; }
/// <summary>
/// A boolean indicating that by default the email address will be the username
/// </summary>
/// <remarks>
/// Even if this is true and the username is different from the email in the database, the username field will still be shown.
/// When this is false, the username and email fields will be shown in the user section.
/// </remarks>
bool UsernameIsEmail { get; }
}
}

View File

@@ -25,6 +25,19 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return GetOptionalTextElement("allowPasswordReset", true); }
}
/// <summary>
/// A boolean indicating that by default the email address will be the username
/// </summary>
/// <remarks>
/// Even if this is true and the username is different from the email in the database, the username field will still be shown.
/// When this is false, the username and email fields will be shown in the user section.
/// </remarks>
[ConfigurationProperty("usernameIsEmail")]
internal InnerTextConfigurationElement<bool> UsernameIsEmail
{
get { return GetOptionalTextElement("usernameIsEmail", true); }
}
[ConfigurationProperty("authCookieName")]
internal InnerTextConfigurationElement<string> AuthCookieName
{
@@ -55,6 +68,18 @@ namespace Umbraco.Core.Configuration.UmbracoSettings
get { return AllowPasswordReset; }
}
/// <summary>
/// A boolean indicating that by default the email address will be the username
/// </summary>
/// <remarks>
/// Even if this is true and the username is different from the email in the database, the username field will still be shown.
/// When this is false, the username and email fields will be shown in the user section.
/// </remarks>
bool ISecuritySection.UsernameIsEmail
{
get { return UsernameIsEmail; }
}
string ISecuritySection.AuthCookieName
{
get { return AuthCookieName; }

View File

@@ -15,7 +15,7 @@
vm.labels = {};
vm.maxFileSize = Umbraco.Sys.ServerVariables.umbracoSettings.maxFileSize + "KB";
vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes);
vm.emailIsUsername = true;
vm.usernameIsEmail = Umbraco.Sys.ServerVariables.umbracoSettings.usernameIsEmail;
//create the initial model for change password
vm.changePasswordModel = {
@@ -68,7 +68,7 @@
setUserDisplayState();
formatDatesToLocal(vm.user);
vm.emailIsUsername = user.email === user.username;
vm.usernameIsEmail = Umbraco.Sys.ServerVariables.umbracoSettings.usernameIsEmail || user.email === user.username;
//go get the config for the membership provider and add it to the model
authResource.getMembershipProviderConfig().then(function (data) {

View File

@@ -43,7 +43,7 @@
<span class="help-inline" val-msg-for="email" val-toggle-msg="valServerField"></span>
</umb-control-group>
<umb-control-group label="@general_username" ng-if="!vm.emailIsUsername" required="true">
<umb-control-group label="@general_username" ng-if="!vm.usernameIsEmail" required="true">
<input
type="text"
localize="placeholder"

View File

@@ -286,6 +286,7 @@ namespace Umbraco.Web.Editors
GetMaxRequestLength()
},
{"keepUserLoggedIn", UmbracoConfig.For.UmbracoSettings().Security.KeepUserLoggedIn},
{"usernameIsEmail", UmbracoConfig.For.UmbracoSettings().Security.UsernameIsEmail},
{"cssPath", IOHelper.ResolveUrl(SystemDirectories.Css).TrimEnd('/')},
{"allowPasswordReset", UmbracoConfig.For.UmbracoSettings().Security.AllowPasswordReset},
{"loginBackgroundImage", UmbracoConfig.For.UmbracoSettings().Content.LoginBackgroundImage},