|
@@ -95,25 +95,28 @@ public class Register : MonoBehaviour {
|
|
|
SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
|
|
SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
|
|
|
byte[] pass = sha1.ComputeHash(pwd);
|
|
byte[] pass = sha1.ComputeHash(pwd);
|
|
|
|
|
|
|
|
- string postUrl = registerUserUrl + "name=" + UnityWebRequest.EscapeURL(Username) + "&password=" + UnityWebRequest.EscapeURL(Convert.ToBase64String(pass)) + "&email=" + UnityWebRequest.EscapeURL(Email) + "&s=" + UnityWebRequest.EscapeURL(salt) + "&did=" + deviceId + "&os=" + os;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ string postUrl = registerUserUrl + "name=" + UnityWebRequest.EscapeURL(Username) + "&password=" + UnityWebRequest.EscapeURL(Convert.ToBase64String(pass)) + "&email=" + UnityWebRequest.EscapeURL(Email) + "&s=" + UnityWebRequest.EscapeURL(salt) + "&did=" + deviceId + "&os=" + UnityWebRequest.EscapeURL(os);
|
|
|
|
|
+ Debug.Log(postUrl);
|
|
|
UnityWebRequest www = UnityWebRequest.Get(postUrl);
|
|
UnityWebRequest www = UnityWebRequest.Get(postUrl);
|
|
|
yield return www.SendWebRequest();
|
|
yield return www.SendWebRequest();
|
|
|
|
|
|
|
|
if (www.error != null) {
|
|
if (www.error != null) {
|
|
|
- errorText.text = "There was an error registering this user, try again later";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- string result = www.downloadHandler.text;
|
|
|
|
|
- if (int.TryParse(www.downloadHandler.text, out int userId)) {
|
|
|
|
|
- errorColor.a = 0;
|
|
|
|
|
- errorText.color = errorColor;
|
|
|
|
|
- PlayerPrefs.SetInt("UserId", userId);
|
|
|
|
|
- SceneManager.LoadScene("MainMenu");
|
|
|
|
|
- } else {
|
|
|
|
|
- errorText.text = "Failed to register, username/email already exists";
|
|
|
|
|
|
|
+ errorText.text = "There was an error registering this user, try again later: " + www.error;
|
|
|
errorColor.a = 1;
|
|
errorColor.a = 1;
|
|
|
errorText.color = errorColor;
|
|
errorText.color = errorColor;
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ string result = www.downloadHandler.text;
|
|
|
|
|
+ if (int.TryParse(www.downloadHandler.text, out int userId)) {
|
|
|
|
|
+ errorColor.a = 0;
|
|
|
|
|
+ errorText.color = errorColor;
|
|
|
|
|
+ PlayerPrefs.SetInt("UserId", userId);
|
|
|
|
|
+ SceneManager.LoadScene("MainMenu");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ errorText.text = "Failed to register, username/email already exists";
|
|
|
|
|
+ errorColor.a = 1;
|
|
|
|
|
+ errorText.color = errorColor;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|