POS-44 Poprawiono wyświetlanie błędów
This commit is contained in:
parent
a41b7d3829
commit
a6679995b6
@ -45,16 +45,10 @@ namespace Klient.Droid
|
|||||||
var Login = FindViewById<EditText>(Resource.Id.Login).Text;
|
var Login = FindViewById<EditText>(Resource.Id.Login).Text;
|
||||||
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.Password).Text).SecurePassword;
|
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<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 = "";
|
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -85,7 +79,6 @@ namespace Klient.Droid
|
|||||||
{
|
{
|
||||||
string msg = await response.Content.ReadAsStringAsync();
|
string msg = await response.Content.ReadAsStringAsync();
|
||||||
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = msg;
|
FindViewById<TextView>(Resource.Id.ErrorLogIn).Text = msg;
|
||||||
FindViewById<EditText>(Resource.Id.Login).Text = "";
|
|
||||||
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -101,14 +94,35 @@ namespace Klient.Droid
|
|||||||
var Login = FindViewById<EditText>(Resource.Id.NewLogin).Text;
|
var Login = FindViewById<EditText>(Resource.Id.NewLogin).Text;
|
||||||
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword;
|
SecureString Password = new NetworkCredential("", FindViewById<EditText>(Resource.Id.NewPassword).Text).SecurePassword;
|
||||||
SecureString Password2 = new NetworkCredential("", FindViewById<EditText>(Resource.Id.RepeatPassword).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<TextView>(Resource.Id.ErrorRegister).Text = "Hasła muszą być identyczne!";
|
||||||
FindViewById<EditText>(Resource.Id.NewLogin).Text = "";
|
FindViewById<EditText>(Resource.Id.NewPassword).Text = "";
|
||||||
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
|
||||||
FindViewById<EditText>(Resource.Id.RepeatPassword).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
|
else
|
||||||
{
|
{
|
||||||
var values = new Dictionary<string, string>
|
var values = new Dictionary<string, string>
|
||||||
@ -131,7 +145,6 @@ namespace Klient.Droid
|
|||||||
{
|
{
|
||||||
string msg = await response.Content.ReadAsStringAsync();
|
string msg = await response.Content.ReadAsStringAsync();
|
||||||
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = msg;
|
FindViewById<TextView>(Resource.Id.ErrorRegister).Text = msg;
|
||||||
FindViewById<EditText>(Resource.Id.NewLogin).Text = "";
|
|
||||||
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
FindViewById<EditText>(Resource.Id.Password).Text = "";
|
||||||
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
|
FindViewById<EditText>(Resource.Id.RepeatPassword).Text = "";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user