mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Handle Redump 503s / Timeouts (fixes #289)
This commit is contained in:
@@ -299,6 +299,7 @@ namespace MPF.Redump
|
||||
if (request is HttpWebRequest webRequest)
|
||||
{
|
||||
webRequest.CookieContainer = m_container;
|
||||
webRequest.Timeout = 5 * 1000;
|
||||
}
|
||||
|
||||
return request;
|
||||
@@ -346,11 +347,16 @@ namespace MPF.Redump
|
||||
Encoding = Encoding.UTF8;
|
||||
var response = UploadString(loginUrl, $"form_sent=1&redirect_url=&csrf_token={token}&req_username={username}&req_password={password}&save_pass=0&login=Login");
|
||||
|
||||
if (response.Contains("Incorrect username and/or password."))
|
||||
if (response.Contains("Incorrect username and/or password"))
|
||||
{
|
||||
Console.WriteLine("Invalid credentials entered, continuing without logging in...");
|
||||
return false;
|
||||
}
|
||||
else if (response.Contains("503 Service Unavailable"))
|
||||
{
|
||||
Console.WriteLine("Redump is not currently responding, continuing without logging in...");
|
||||
return null;
|
||||
}
|
||||
|
||||
// The user was able to be logged in
|
||||
Console.WriteLine("Credentials accepted! Logged into Redump...");
|
||||
|
||||
@@ -210,11 +210,11 @@ namespace MPF.Windows
|
||||
{
|
||||
bool? loggedIn = wc.Login(RedumpUsernameTextBox.Text, RedumpPasswordBox.Password);
|
||||
if (loggedIn == true)
|
||||
CustomMessageBox.Show("Redump login credentials accepted!", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
CustomMessageBox.Show(this, "Redump login credentials accepted!", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
else if (loggedIn == false)
|
||||
CustomMessageBox.Show("Redump login credentials denied!", "Failure", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
CustomMessageBox.Show(this, "Redump login credentials denied!", "Failure", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
else
|
||||
CustomMessageBox.Show("Error validating credentials!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
CustomMessageBox.Show(this, "Error validating credentials!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user