Exemple #1
0
    IEnumerator sendLoginRequest(string username, string password)
    {
        if (isDatabaseSetup == true)
        {
            IEnumerator e = DC.Login(username, password);
            while (e.MoveNext())
            {
                yield return(e.Current);
            }
            WWW returned = e.Current as WWW;
            if (returned.text == "Success")
            {
                //Password was correct
                blankErrors();
                part = 2;                 //show logged in UI

                //blank username field
                input_login_username.text = "";                 //password field is blanked at the end of this function, even when error is returned

                //set logged in username and password to variables
                loggedIn_Username = username;
                loggedIn_Password = password;
            }
            if (returned.text == "incorrectUser")
            {
                //Account with username not found in database
                login_error.text = "Username not found";
                part             = 0;     //back to login UI
            }
            if (returned.text == "incorrectPass")
            {
                //Account with username found, but password incorrect
                part             = 0;     //back to login UI
                login_error.text = "Incorrect Password";
            }
            if (returned.text == "ContainsUnsupportedSymbol")
            {
                //One of the parameters contained a - symbol
                part             = 0;     //back to login UI
                login_error.text = "Unsupported Symbol '-'";
            }
            if (returned.text == "Error")
            {
                //Account Not Created, another error occurred
                part             = 0;     //back to login UI
                login_error.text = "Database Error. Try again later.";
            }

            //blank password field
            input_login_password.text = "";
        }
    }
Exemple #2
0
    IEnumerator Login(string username, string password)
    {
        IEnumerator e = DC.Login(username, password);

        while (e.MoveNext())
        {
            yield return(e.Current);
        }
        WWW returned = e.Current as WWW;

        if (returned.text == "incorrectUser")
        {
            //Username not found in database
            //Do Stuff
            debug.text           = "Username available";
            debug.color          = Color.green;
            uname                = temp;
            proceed.interactable = true;
        }
        if (returned.text == "incorrectPass")
        {
            //Username found but password incorrect
            //Do Stuff
            debug.text = "Username not Available";
            //proceed.interactable = false;
        }
        if (returned.text == "ContainsUnsupportedSymbol")
        {
            //One of the parameters contained a “-“ symbol
            //Do Stuff
            debug.text = "Username not Valid";
        }
        if (returned.text == "Error")
        {
            //Should not login as another error occurred
            //Do Stuff
            debug.text = "Error";
        }
    }