From 23274ef914f2034a980fcc2cb2a771287f94c8c3 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 3 Oct 2016 23:20:17 -0400 Subject: [PATCH] Password rules for registration. --- src/App/Pages/RegisterPage.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/App/Pages/RegisterPage.cs b/src/App/Pages/RegisterPage.cs index ac2f809a5..c49c521aa 100644 --- a/src/App/Pages/RegisterPage.cs +++ b/src/App/Pages/RegisterPage.cs @@ -165,7 +165,18 @@ namespace Bit.App.Pages if(string.IsNullOrWhiteSpace(PasswordCell.Entry.Text)) { await DisplayAlert(AppResources.AnErrorHasOccurred, - string.Format(AppResources.ValidationFieldRequired, "Your Name"), AppResources.Ok); + string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword), AppResources.Ok); + return; + } + + var passwordCharArray = PasswordCell.Entry.Text.ToCharArray(); + if(PasswordCell.Entry.Text.Length < 8 || !passwordCharArray.Any(char.IsLetter) + || !(passwordCharArray.Any(char.IsDigit) || passwordCharArray.Any(c => !char.IsLetterOrDigit(c)))) + { + await DisplayAlert(AppResources.AnErrorHasOccurred, + "Master password must be at least 8 characters long and contain at least 1 letter and 1 number " + + "or special character.", + AppResources.Ok); return; }