From a8f4cf73d8e7a2c6cf0862eaa4271e9adc78f975 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Thu, 14 Feb 2019 15:48:20 +0100 Subject: [PATCH] V8: Use "Email" instead of "Username" on the login screen (#4383) * Use "Email" instead of "Username" on the login screen when using email as username in config * Fix placeholder too --- .../components/application/umblogin.directive.js | 10 ++++++++++ .../src/views/components/application/umb-login.html | 4 ++-- src/Umbraco.Web.UI/Umbraco/config/lang/en.xml | 2 +- src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml | 2 +- src/Umbraco.Web/Editors/BackOfficeServerVariables.cs | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js index 891e8f0e7b..39058b32d7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/application/umblogin.directive.js @@ -48,6 +48,7 @@ vm.externalLoginInfo = externalLoginInfo; vm.resetPasswordCodeInfo = resetPasswordCodeInfo; vm.backgroundImage = Umbraco.Sys.ServerVariables.umbracoSettings.loginBackgroundImage; + vm.usernameIsEmail = Umbraco.Sys.ServerVariables.umbracoSettings.usernameIsEmail; vm.$onInit = onInit; vm.togglePassword = togglePassword; @@ -61,6 +62,15 @@ vm.requestPasswordResetSubmit = requestPasswordResetSubmit; vm.setPasswordSubmit = setPasswordSubmit; + vm.labels = {}; + localizationService.localizeMany([ + vm.usernameIsEmail ? "general_email" : "general_username", + vm.usernameIsEmail ? "placeholders_email" : "placeholders_usernameHint"] + ).then(function (data) { + vm.labels.usernameLabel = data[0]; + vm.labels.usernamePlaceholder = data[1]; + }) + function onInit() { // Check if it is a new user diff --git a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-login.html b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-login.html index 2ce49880d7..d6ec18667c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/application/umb-login.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/application/umb-login.html @@ -153,8 +153,8 @@
- - + +
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml index d129e5de78..4abe29f492 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml @@ -485,7 +485,7 @@ Type to search... Type to filter... Type to add tags (press enter after each tag)... - Enter your email... + Enter your email Enter a message... Your username is usually your email #value or ?key=value diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml index a18573fef7..3b28215bef 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml @@ -488,7 +488,7 @@ Type to search... Type to filter... Type to add tags (press enter after each tag)... - Enter your email... + Enter your email Enter a message... Your username is usually your email #value or ?key=value diff --git a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs index 954491eab9..5f3e84916b 100644 --- a/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs +++ b/src/Umbraco.Web/Editors/BackOfficeServerVariables.cs @@ -58,7 +58,7 @@ namespace Umbraco.Web.Editors var keepOnlyKeys = new Dictionary { {"umbracoUrls", new[] {"authenticationApiBaseUrl", "serverVarsJs", "externalLoginsUrl", "currentUserApiBaseUrl"}}, - {"umbracoSettings", new[] {"allowPasswordReset", "imageFileTypes", "maxFileSize", "loginBackgroundImage", "canSendRequiredEmail"}}, + {"umbracoSettings", new[] {"allowPasswordReset", "imageFileTypes", "maxFileSize", "loginBackgroundImage", "canSendRequiredEmail", "usernameIsEmail"}}, {"application", new[] {"applicationPath", "cacheBuster"}}, {"isDebuggingEnabled", new string[] { }}, {"features", new [] {"disabledFeatures"}}