Skip to content

Commit

Permalink
rutracker: improve error message for failed logins
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed May 22, 2023
1 parent 1d89c13 commit 4142a9d
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Jackett.Common/Indexers/RuTracker.cs
Expand Up @@ -1441,17 +1441,11 @@ public override async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken
var result = await RequestLoginAndFollowRedirect(LoginUrl, pairs, CookieHeader, true, null, LoginUrl, true);
await ConfigureIfOK(result.Cookies, result.ContentString != null && result.ContentString.Contains("id=\"logged-in-username\""), () =>
{
var errorMessage = "Unknown error message, please report";
var parser = new HtmlParser();
var doc = parser.ParseDocument(result.ContentString);
var errormsg = doc.QuerySelector("div.msg-main");
if (errormsg != null)
errorMessage = errormsg.TextContent;
errormsg = doc.QuerySelector("h4[class=\"warnColor1 tCenter mrg_16\"]");
if (errormsg != null)
errorMessage = errormsg.TextContent;
throw new ExceptionWithConfigData(errorMessage, configData);
var errorMessage = doc.QuerySelector("h4.warnColor1.tCenter.mrg_16, div.msg-main")?.TextContent.Trim();
throw new ExceptionWithConfigData(errorMessage ?? "RuTracker authentication failed", configData);
});
return IndexerConfigurationStatus.RequiresTesting;
}
Expand Down

0 comments on commit 4142a9d

Please sign in to comment.