public void CreateNewUser()
    {
        var nameText          = name.GetComponent <InputField> ().text;
        var phoneText         = phone.GetComponent <InputField> ().text;
        var emailText         = email.GetComponent <InputField> ().text;
        var passwordText      = password.GetComponent <InputField> ().text;
        int everyThingIsRight = 0;

        if (string.IsNullOrEmpty(nameText))
        {
            nameError.SetActive(true);
        }
        else
        {
            nameError.SetActive(false);
            everyThingIsRight++;
        }
        if (phoneText.Length < 8)
        {
            phoneError.SetActive(true);
        }
        else
        {
            phoneError.SetActive(false);
            everyThingIsRight++;
        }
        if (string.IsNullOrEmpty(emailText) || !emailText.Contains("@"))
        {
            emailError.SetActive(true);
        }
        else
        {
            emailError.SetActive(false);
            everyThingIsRight++;
        }
        if (passwordText.Length < 6)
        {
            passwordError.SetActive(true);
        }
        else
        {
            passwordError.SetActive(false);
            everyThingIsRight++;
        }
        if (everyThingIsRight >= 4)
        {
            Loading = true;
            FirebaseAuth.GetFireBaseAuthInstance().CreateNewUserWithEmailAndPassword(nameText, phoneText, emailText, passwordText, Constants.UserType.User, delegate(string userID) {
                Loading = false;
                Success = true;
                CloseModal();
                LoadHomeSceneAsync();
            }, delegate(string error) {
                Loading = false;
                OpenErrorPopup(error);
            });
        }
    }
 void CreateNewCompany()
 {
     FirebaseAuth.GetFireBaseAuthInstance().CreateNewCompanyWithEmailAndPassword(name.GetComponent <InputField> ().text, email.GetComponent <InputField> ().text, password.GetComponent <InputField> ().text, delegate(string userID) {
         CloseModal();
         Loading = false;
         Success = true;
         CreateNewCompanyDataBase(userID);
     }, delegate(string error) {
         Loading = false;
         OpenErrorPopup(error);
     });
 }
Ejemplo n.º 3
0
 public void FacebookLogin()
 {
     Loading = true;
     FirebaseAuth.GetFireBaseAuthInstance().FacebookLogin(delegate(string userId) {
         DataManager.LoadUserInfoAux(userId, delegate {
             Loading = false;
             ChangeScene();
         });
     }, delegate(string error) {
         Loading = false;
         Error   = true;
     });
 }
Ejemplo n.º 4
0
 public void OnConfirmForgotPasswordClick()
 {
     if (string.IsNullOrEmpty(forgotEmail.text) || !forgotEmail.text.Contains("@"))
     {
         forgotEmailError.SetActive(true);
     }
     else
     {
         Loading = true;
         forgotEmailError.SetActive(false);
         FirebaseAuth.GetFireBaseAuthInstance().ForgotPassword(forgotEmail.text, delegate() {
             success.SetActive(true);
             forgotPassword.SetActive(false);
             Loading = false;
         }, delegate(string error) {
             Error   = true;
             Loading = false;
         });
     }
 }
Ejemplo n.º 5
0
    public void OnLoginClick()
    {
        var emailText         = email.GetComponent <InputField> ().text;
        var passwordText      = password.GetComponent <InputField> ().text;
        int everyThingIsRight = 0;

        if (string.IsNullOrEmpty(emailText) || !emailText.Contains("@"))
        {
            emailError.SetActive(true);
        }
        else
        {
            emailError.SetActive(false);
            everyThingIsRight++;
        }
        if (passwordText.Length < 6)
        {
            passwordError.SetActive(true);
        }
        else
        {
            passwordError.SetActive(false);
            everyThingIsRight++;
        }

        if (everyThingIsRight >= 2)
        {
            Loading = true;
            FirebaseAuth.GetFireBaseAuthInstance().UserLogin(email.GetComponent <InputField> ().text, password.GetComponent <InputField> ().text, delegate(string id) {
                DataManager.LoadUserInfoAux(id, delegate {
                    Loading = false;
                    LoadHomeSceneAsync();
                });
            }, delegate(string error) {
                Loading = false;
                OpenErrorPopup(error);
            });
        }
    }