From bf7d9b5646003b4faf9b61f8108f77b5a497383a Mon Sep 17 00:00:00 2001 From: Brandon Maharaj Date: Thu, 16 Feb 2023 13:15:40 -0500 Subject: [PATCH] [SG-1022] Update min password requirements to 12 char (#2368) * work: adjusted numbers to 12 * work: made string dynamic * fix: spaces --- .../Accounts/BaseChangePasswordViewModel.cs | 2 +- .../Pages/Accounts/RegisterPageViewModel.cs | 2 +- .../Accounts/SetPasswordPageViewModel.cs | 2 +- src/App/Resources/AppResources.Designer.cs | 41 ++++++++++--------- src/App/Resources/AppResources.resx | 6 +-- src/Core/Constants.cs | 2 +- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs b/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs index 5b8eae328..e90162158 100644 --- a/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs +++ b/src/App/Pages/Accounts/BaseChangePasswordViewModel.cs @@ -162,7 +162,7 @@ namespace Bit.App.Pages { if (MasterPassword.Length < Constants.MasterPasswordMinimumChars) { - await _platformUtilsService.ShowDialogAsync(AppResources.MasterPasswordLengthValMessage, + await _platformUtilsService.ShowDialogAsync(string.Format(AppResources.MasterPasswordLengthValMessageX, Constants.MasterPasswordMinimumChars), AppResources.MasterPasswordPolicyValidationTitle, AppResources.Ok); return false; } diff --git a/src/App/Pages/Accounts/RegisterPageViewModel.cs b/src/App/Pages/Accounts/RegisterPageViewModel.cs index c924c0dbc..ebfc522c1 100644 --- a/src/App/Pages/Accounts/RegisterPageViewModel.cs +++ b/src/App/Pages/Accounts/RegisterPageViewModel.cs @@ -148,7 +148,7 @@ namespace Bit.App.Pages } if (MasterPassword.Length < Constants.MasterPasswordMinimumChars) { - await _platformUtilsService.ShowDialogAsync(AppResources.MasterPasswordLengthValMessage, + await _platformUtilsService.ShowDialogAsync(string.Format(AppResources.MasterPasswordLengthValMessageX, Constants.MasterPasswordMinimumChars), AppResources.AnErrorHasOccurred, AppResources.Ok); return; } diff --git a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs index ecacbb265..51d468275 100644 --- a/src/App/Pages/Accounts/SetPasswordPageViewModel.cs +++ b/src/App/Pages/Accounts/SetPasswordPageViewModel.cs @@ -152,7 +152,7 @@ namespace Bit.App.Pages if (MasterPassword.Length < Constants.MasterPasswordMinimumChars) { await Page.DisplayAlert(AppResources.MasterPasswordPolicyValidationTitle, - AppResources.MasterPasswordLengthValMessage, AppResources.Ok); + string.Format(AppResources.MasterPasswordLengthValMessageX, Constants.MasterPasswordMinimumChars), AppResources.Ok); return; } } diff --git a/src/App/Resources/AppResources.Designer.cs b/src/App/Resources/AppResources.Designer.cs index 78e07d023..45b51397a 100644 --- a/src/App/Resources/AppResources.Designer.cs +++ b/src/App/Resources/AppResources.Designer.cs @@ -1,6 +1,7 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -13,10 +14,12 @@ namespace Bit.App.Resources { /// /// A strongly-typed resource class, for looking up localized strings, etc. - /// This class was generated by MSBuild using the GenerateResource task. - /// To add or remove a member, edit your .resx file then rerun MSBuild. /// - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Build.Tasks.StronglyTypedResourceBuilder", "15.1.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class AppResources { @@ -3670,7 +3673,7 @@ namespace Bit.App.Resources { } /// - /// Looks up a localized string similar to Log In with another device. + /// Looks up a localized string similar to Log in with device. /// public static string LogInWithAnotherDevice { get { @@ -3787,11 +3790,11 @@ namespace Bit.App.Resources { } /// - /// Looks up a localized string similar to Master password must be at least 8 characters long.. + /// Looks up a localized string similar to Master password must be at least {0} characters long.. /// - public static string MasterPasswordLengthValMessage { + public static string MasterPasswordLengthValMessageX { get { - return ResourceManager.GetString("MasterPasswordLengthValMessage", resourceCulture); + return ResourceManager.GetString("MasterPasswordLengthValMessageX", resourceCulture); } } @@ -4019,18 +4022,7 @@ namespace Bit.App.Resources { return ResourceManager.GetString("Ms", resourceCulture); } } - - /// - /// Looks up a localized string similar to Mx. - /// - public static string Mx - { - get - { - return ResourceManager.GetString("Mx", resourceCulture); - } - } - + /// /// Looks up a localized string similar to You must log into the main Bitwarden app before you can use the extension.. /// @@ -4049,6 +4041,15 @@ namespace Bit.App.Resources { } } + /// + /// Looks up a localized string similar to Mx. + /// + public static string Mx { + get { + return ResourceManager.GetString("Mx", resourceCulture); + } + } + /// /// Looks up a localized string similar to My vault. /// diff --git a/src/App/Resources/AppResources.resx b/src/App/Resources/AppResources.resx index 4284f4590..e05cb91ab 100644 --- a/src/App/Resources/AppResources.resx +++ b/src/App/Resources/AppResources.resx @@ -583,8 +583,8 @@ A master password hint can help you remember your password if you forget it. - - Master password must be at least 8 characters long. + + Master password must be at least {0} characters long. Minimum numbers @@ -2146,7 +2146,7 @@ Scanning will happen automatically. Your vault timeout exceeds the restrictions set by your organization. - + One or more organization policies prevents your from exporting your individual vault. diff --git a/src/Core/Constants.cs b/src/Core/Constants.cs index c67a67537..f41b2b7c2 100644 --- a/src/Core/Constants.cs +++ b/src/Core/Constants.cs @@ -54,7 +54,7 @@ public const int Argon2Iterations = 3; public const int Argon2MemoryInMB = 64; public const int Argon2Parallelism = 4; - public const int MasterPasswordMinimumChars = 8; + public const int MasterPasswordMinimumChars = 12; public static readonly string[] AndroidAllClearCipherCacheKeys = {