POS-44 Poprawiono wyświetlanie błędów

This commit is contained in:
Wojciech Przybyła 2021-01-09 18:15:51 +01:00
parent 6586dc6170
commit 5b909f6d1a

View File

@ -45,16 +45,10 @@ namespace Klient.Droid
var Login = FindViewById<EditText>(Resource.Id.Login).Text;
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.Password).Text).SecurePassword;
if (Login.Length < 3 || Login.Length > 12)
if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
{
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!";
FindViewById<EditText>(Resource.Id.Login).Text = "";
FindViewById<EditText>(Resource.Id.Password).Text = "";
}
else if (string.IsNullOrWhiteSpace(new NetworkCredential("", Password).Password))
{
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = "Hasło musi mieć od 3 do 12 znaków!";
FindViewById<EditText>(Resource.Id.Login).Text = "";
FindViewById<EditText>(Resource.Id.Password).Text = "";
}
else
@ -85,7 +79,6 @@ namespace Klient.Droid
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = msg;
FindViewById<EditText>(Resource.Id.Login).Text = "";
FindViewById<EditText>(Resource.Id.Password).Text = "";
}
@ -101,14 +94,35 @@ namespace Klient.Droid
var Login = FindViewById<EditText>(Resource.Id.NewLogin).Text;
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword;
SecureString Password2 = new NetworkCredential("", FindViewById<EditText>(Resource.Id.RepeatPassword).Text).SecurePassword;
if (Login.Length < 3 || Login.Length > 12)
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Login musi mięć od 3 do 12 znaków!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(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<TextView>(Resource.Id.ErrorRegister).Text = "Hasło musi mieć od 8 do 20 znaków!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else if (new NetworkCredential("", Password).Password != new NetworkCredential("", Password2).Password)
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Hasła muszą być identyczne!";
FindViewById<EditText>(Resource.Id.NewLogin).Text = "";
FindViewById<EditText>(Resource.Id.Password).Text = "";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else if(string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.NewLogin).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Email).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.NewPassword).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.RepeatPassword).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Name).Text) || string.IsNullOrEmpty(FindViewById<EditText>(Resource.Id.Surname).Text))
{
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = "Wartości nie mogą być puste!";
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}
else
{
var values = new Dictionary<string, string>
@ -131,7 +145,6 @@ namespace Klient.Droid
{
string msg = await response.Content.ReadAsStringAsync();
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = msg;
FindViewById<EditText>(Resource.Id.NewLogin).Text = "";
FindViewById<EditText>(Resource.Id.Password).Text = "";
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
}