Exemple #1
0
    IEnumerator FindEmailUP(string emailSUP)
    {
        consoleText.text = "start find user email ...";
        WWWForm form = new WWWForm();

        form.AddField("email", emailSUP);
        WWW www = new WWW("http://www.local/php_wd/findEmail.php", form);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            consoleText.text = "Error: email !" + www.error;
            yield break;
        }
        consoleText.text = "... result >> " + www.text;
        if (www.text.Length == 1)
        {
            if (Equals(www.text, "1"))
            {
                consoleText.text = "Така пошта використовуєьться, виберіть іншу";
                isFieldOk       &= ~IsValidate.email;
            }
            else if (Equals(www.text, "0"))
            {
                consoleText.text = "User email OK !";
                isFieldOk       |= IsValidate.email;
            }
            SUPPanelActivBtn(btnSUP);
        }
        yield return(null);
    }
Exemple #2
0
    IEnumerator FindEmailIN(string emailSIN)
    {
        consoleText.text = "start find user email ...";
        WWWForm form = new WWWForm();

        form.AddField("email", emailSIN);
        WWW www = new WWW("http://www.local/php_wd/findEmail.php", form);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            consoleText.text = "Error: conect (email) ! ---------------------------------" + www.error;
            yield break;
        }
        consoleText.text = "... result >> " + www.text;
        if (www.text.Length == 1)
        {
            if (Equals(www.text, "1"))
            {
                consoleText.text = "User email OK !";
                isFieldOk       |= IsValidate.email;
            }
            else if (Equals(www.text, "0"))
            {
                ShowAlert(alert, textAlert, "Пошта відсутня !\nЗареєструйтесь !\nАбо перевірте написання !");
                isFieldOk &= ~IsValidate.email;
            }
            SINPanelActivBtn(btnSIN);
        }
        yield return(null);
    }
Exemple #3
0
    IEnumerator FindNameUP(string nameSUP)
    {
        consoleText.text = "start find user name ...";
        WWWForm form = new WWWForm();

        form.AddField("name", nameSUP);
        WWW www = new WWW("http://www.local/php_wd/findName.php", form);

        yield return(www);

        if (!string.IsNullOrEmpty(www.error))
        {
            consoleText.text = "Error: name !---------------------------------" + www.error;
            yield break;
        }
        consoleText.text = "... result >> " + www.text;
        if (www.text.Length == 1)
        {
            if (Equals(www.text, "1"))
            {
                consoleText.text = "Такий логін зайнятий виберіть інший";
                isFieldOk       &= ~IsValidate.login;
            }
            else if (Equals(www.text, "0"))
            {
                consoleText.text = "User name OK ! ";
                isFieldOk       |= IsValidate.login;
            }
            SUPPanelActivBtn(btnSUP);
        }
        yield return(null);
    }
Exemple #4
0
    //Confirm password
    public void EndEditRePass()
    {
        InputField pass   = GameObject.Find("IF_PassUP").GetComponent <InputField> ();
        InputField rePass = GameObject.Find("IF_RePassUP").GetComponent <InputField> ();

        if (ValidateField(pass, rePass))
        {
            isFieldOk |= IsValidate.rePass;
        }
        SUPPanelActivBtn(btnSUP);
    }
Exemple #5
0
 //Check pass
 public void EndEditPass(InputField targetField)
 {
     if (ValidateField(targetField) && Equals(targetField.tag, "fieldSIN"))
     {
         consoleText.text = "pass Ok !";
         SINPanelActivBtn(btnSIN);
     }
     else
     {
         isFieldOk &= ~IsValidate.pass;
     }
     if (ValidateField(targetField) && Equals(targetField.tag, "fieldSUP"))
     {
         isFieldOk |= IsValidate.pass;
         SUPPanelActivBtn(btnSUP);
     }
     else
     {
         isFieldOk &= ~IsValidate.pass;
     }
 }
Exemple #6
0
        public void ValidarSave(User user)
        {
            if (_userRepository.IsEmailExist(user.email))
            {
                throw new Exception("E-mail already exists");
            }

            if (!IsValidate.IsEmail(user.email))
            {
                throw new Exception("Invalid fields");
            }

            if (user.firstName.Length == 1)
            {
                throw new Exception("Invalid fields");
            }

            if (user.lastName.Length == 1)
            {
                throw new Exception("Invalid fields");
            }

            if (user.firstName == null || user.firstName == string.Empty)
            {
                throw new Exception("Missing fields");
            }

            if (user.lastName == null || user.lastName == string.Empty)
            {
                throw new Exception("Missing fields");
            }

            if (user.password == null || user.password == string.Empty)
            {
                throw new Exception("Missing fields");
            }

            if (user.phones.Count == 0)
            {
                throw new Exception("Missing fields");
            }

            foreach (var phone in user.phones)
            {
                if (phone.number.Length == 1)
                {
                    throw new Exception("Invalid fields");
                }

                if (phone.country_code.Length == 1)
                {
                    throw new Exception("Invalid fields");
                }

                if (phone.area_code.Length == 1)
                {
                    throw new Exception("Invalid fields");
                }

                if (phone.number == null || phone.number == string.Empty)
                {
                    throw new Exception("Missing fields");
                }

                if (phone.country_code == null || phone.country_code == string.Empty)
                {
                    throw new Exception("Missing fields");
                }

                if (phone.area_code == null || phone.area_code == string.Empty)
                {
                    throw new Exception("Missing fields");
                }
            }
        }