public IEnumerator TC2IncorrectLogin() { GameObject loginCanvas = GameObject.Find("LoginCanvas"); InputField emailInput = loginCanvas.transform.Find("EmailInputField").GetComponent <InputField>(); InputField passwordInput = loginCanvas.transform.Find("PasswordInputField").GetComponent <InputField>(); LoginControllerScript loginController = loginCanvas.transform.Find("LoginController").GetComponent <LoginControllerScript>(); emailInput.text = "*****@*****.**"; passwordInput.text = "12345678"; loginController.login(); yield return(new WaitForSeconds(10)); Debug.Log(loginController.userData.userName); Assert.IsFalse(loginController.studentChk); }
public void CheckExistingUser(LoginControllerScript loginController, string user, string pw) { isExist = false; string encryptPw = Md5Sum(pw); string checkEncryptPw = ""; HTTP.Request someRequest = new HTTP.Request("get", url); someRequest.Send((request) => { // parse some JSON, for example: JSONObject thing = new JSONObject(request.response.Text); // accessData(thing); for (int i = 0; i < thing.list.Count; i++) { JSONObject j = thing.list[i]; JSONObject userName = j["UserName"]; if (user == userName.str) { isExist = true; JSONObject pass = j["Password"]; checkEncryptPw = pass.str; } } if (isExist) { if (encryptPw == checkEncryptPw) { PlayerPrefs.SetString("user", user); Debug.Log("Logged In"); loginController.LoggedIn(); } else { string text = "Wrong Password"; loginController.SetResponseText(text); Debug.Log(text); } } else { string text = "Invalid User"; loginController.SetResponseText(text); Debug.Log(text); } }); }