Fix possible issues with requests
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System.Numerics;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@@ -29,6 +28,7 @@ public class AccountLogin : MonoBehaviour
|
||||
|
||||
async void SubmitLogin()
|
||||
{
|
||||
loginBackButton.interactable = false;
|
||||
if (loginUsernameInput.text == string.Empty || loginPasswordInput.text == string.Empty)
|
||||
{
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "All input fields must be filled", Color.red);
|
||||
@@ -46,27 +46,32 @@ public class AccountLogin : MonoBehaviour
|
||||
await request.SendWebRequest();
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
loginBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "Failed to make HTTP request", Color.red);
|
||||
return;
|
||||
}
|
||||
string response = SensitiveInfo.Decrypt(request.downloadHandler.text, SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY);
|
||||
if (response == "-999")
|
||||
{
|
||||
loginBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "Server error while fetching data", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-998")
|
||||
{
|
||||
loginBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "Client version too outdated to access servers", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-997")
|
||||
{
|
||||
loginBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "Encryption/decryption issues", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-996")
|
||||
{
|
||||
loginBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(loginPanelStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
return;
|
||||
}
|
||||
@@ -97,5 +102,6 @@ public class AccountLogin : MonoBehaviour
|
||||
Tools.UpdateStatusText(loginPanelStatusText, (string)jsonResponse["message"], Color.red);
|
||||
}
|
||||
}
|
||||
loginBackButton.interactable = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user