From 2e5b7422cfbb7aca2d4a3fb1d065da5384e75886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Przyby=C5=82a?= Date: Sat, 9 Jan 2021 18:15:51 +0100 Subject: [PATCH] =?UTF-8?q?POS-44=20Poprawiono=20wy=C5=9Bwietlanie=20b?= =?UTF-8?q?=C5=82=C4=99d=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Klient/Klient/Klient.Android/MainActivity.cs | 39 +++++++++++++------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/Klient/Klient/Klient.Android/MainActivity.cs b/Klient/Klient/Klient.Android/MainActivity.cs index c7a2135..de6d9f5 100644 --- a/Klient/Klient/Klient.Android/MainActivity.cs +++ b/Klient/Klient/Klient.Android/MainActivity.cs @@ -45,16 +45,10 @@ namespace Klient.Droid var Login = FindViewById(Resource.Id.Login).Text; SecureString Password = new NetworkCredential("", FindViewById(Resource.Id.Password).Text).SecurePassword; - if (Login.Length < 3 || Login.Length > 12) + + if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password)) { FindViewById(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!"; - FindViewById(Resource.Id.Login).Text = ""; - FindViewById(Resource.Id.Password).Text = ""; - } - else if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password)) - { - FindViewById(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!"; - FindViewById(Resource.Id.Login).Text = ""; FindViewById(Resource.Id.Password).Text = ""; } else @@ -85,7 +79,6 @@ namespace Klient.Droid { string msg = await response.Content.ReadAsStringAsync(); FindViewById(Resource.Id.ErrorLogIn).Text = msg; - FindViewById(Resource.Id.Login).Text = ""; FindViewById(Resource.Id.Password).Text = ""; } @@ -101,14 +94,35 @@ namespace Klient.Droid var Login = FindViewById(Resource.Id.NewLogin).Text; SecureString Password = new NetworkCredential("", FindViewById(Resource.Id.NewPassword).Text).SecurePassword; SecureString Password2 = new NetworkCredential("", FindViewById(Resource.Id.RepeatPassword).Text).SecurePassword; + + if (Login.Length < 3 || Login.Length > 12) + { + FindViewById(Resource.Id.ErrorRegister).Text = "Login musi mięć od 3 do 12 znaków!"; + FindViewById(Resource.Id.NewPassword).Text = ""; + FindViewById(Resource.Id.RepeatPassword).Text = ""; - if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password) + } + else if (new NetworkCredential("", Password).Password.Length < 8 || new NetworkCredential("", Password).Password.Length > 20) + { + FindViewById(Resource.Id.ErrorRegister).Text = "Hasło musi mieć od 8 do 20 znaków!"; + FindViewById(Resource.Id.NewPassword).Text = ""; + FindViewById(Resource.Id.RepeatPassword).Text = ""; + + } + + else if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password) { FindViewById(Resource.Id.ErrorRegister).Text = "Hasła muszą być identyczne!"; - FindViewById(Resource.Id.NewLogin).Text = ""; - FindViewById(Resource.Id.Password).Text = ""; + FindViewById(Resource.Id.NewPassword).Text = ""; FindViewById(Resource.Id.RepeatPassword).Text = ""; } + else if(string.IsNullOrEmpty(FindViewById(Resource.Id.NewLogin).Text) || string.IsNullOrEmpty(FindViewById(Resource.Id.Email).Text) || string.IsNullOrEmpty(FindViewById(Resource.Id.NewPassword).Text) || string.IsNullOrEmpty(FindViewById(Resource.Id.RepeatPassword).Text) || string.IsNullOrEmpty(FindViewById(Resource.Id.Name).Text) || string.IsNullOrEmpty(FindViewById(Resource.Id.Surname).Text)) + { + FindViewById(Resource.Id.ErrorRegister).Text = "Wartości nie mogą być puste!"; + FindViewById(Resource.Id.NewPassword).Text = ""; + FindViewById(Resource.Id.RepeatPassword).Text = ""; + } + else { var values = new Dictionary @@ -131,7 +145,6 @@ namespace Klient.Droid { string msg = await response.Content.ReadAsStringAsync(); FindViewById(Resource.Id.ErrorRegister).Text = msg; - FindViewById(Resource.Id.NewLogin).Text = ""; FindViewById(Resource.Id.Password).Text = ""; FindViewById(Resource.Id.RepeatPassword).Text = ""; }