Fix possible issues with requests
This commit is contained in:
@@ -29,8 +29,10 @@ public class AccountChangePassword : MonoBehaviour
|
||||
|
||||
async void ChangePassword()
|
||||
{
|
||||
changePasswordBackButton.interactable = false;
|
||||
if (changePasswordNewPasswordInput.text != changePasswordRetypeNewPasswordInput.text)
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Passwords do not match", Color.red);
|
||||
return;
|
||||
}
|
||||
@@ -46,27 +48,32 @@ public class AccountChangePassword : MonoBehaviour
|
||||
await request.SendWebRequest();
|
||||
if (request.result != UnityWebRequest.Result.Success)
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Failed to make HTTP request", Color.red);
|
||||
return;
|
||||
}
|
||||
string response = SensitiveInfo.Decrypt(request.downloadHandler.text, SensitiveInfo.SERVER_RECEIVE_TRANSFER_KEY);
|
||||
if (response == "-999")
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Server error while fetching data", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-998")
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Client version too outdated to access servers", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-997")
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Encryption/decryption issues", Color.red);
|
||||
return;
|
||||
}
|
||||
else if (response == "-996")
|
||||
{
|
||||
changePasswordBackButton.interactable = true;
|
||||
Tools.UpdateStatusText(changePasswordStatusText, "Can't send requests on self-built instance", Color.red);
|
||||
return;
|
||||
}
|
||||
@@ -84,5 +91,6 @@ public class AccountChangePassword : MonoBehaviour
|
||||
Tools.UpdateStatusText(changePasswordStatusText, (string)jsonResponse["message"], Color.red);
|
||||
}
|
||||
}
|
||||
changePasswordBackButton.interactable = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user