mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
Better Captcha message.
This commit is contained in:
parent
28f6777f9a
commit
7f6101a6bc
@ -15,5 +15,10 @@ public CloudFlareCaptchaException(HttpResponse response, CloudFlareCaptchaReques
|
||||
Response = response;
|
||||
CaptchaRequest = captchaRequest;
|
||||
}
|
||||
|
||||
public bool IsExpired
|
||||
{
|
||||
get { return Response.Request.Cookies.ContainsKey("cf_clearance"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public HttpResponse PostResponse(HttpResponse response)
|
||||
{
|
||||
if (response.StatusCode == HttpStatusCode.Forbidden && response.Content.Contains(_cloudFlareChallengeScript))
|
||||
{
|
||||
_logger.Error("CloudFlare CAPTCHA block on {0}", response.Request.Url);
|
||||
_logger.Debug("CloudFlare CAPTCHA block on {0}", response.Request.Url);
|
||||
throw new CloudFlareCaptchaException(response, CreateCaptchaRequest(response));
|
||||
}
|
||||
|
||||
|
@ -246,6 +246,18 @@ protected virtual IList<ReleaseInfo> FetchReleases(IndexerPageableRequestChain p
|
||||
_indexerStatusService.RecordFailure(Definition.Id);
|
||||
_logger.Warn("Invalid API Key for {0} {1}", this, url);
|
||||
}
|
||||
catch (CloudFlareCaptchaException ex)
|
||||
{
|
||||
_indexerStatusService.RecordFailure(Definition.Id);
|
||||
if (ex.IsExpired)
|
||||
{
|
||||
_logger.Error(ex, "Expired CAPTCHA token for {0}, please refresh in indexer settings.", this);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Error(ex, "CAPTCHA token required for {0}, check indexer settings.", this);
|
||||
}
|
||||
}
|
||||
catch (IndexerException ex)
|
||||
{
|
||||
_indexerStatusService.RecordFailure(Definition.Id);
|
||||
@ -314,9 +326,16 @@ protected virtual ValidationFailure TestConnection()
|
||||
{
|
||||
_logger.Warn("Request limit reached");
|
||||
}
|
||||
catch (CloudFlareCaptchaException)
|
||||
catch (CloudFlareCaptchaException ex)
|
||||
{
|
||||
return new ValidationFailure("CaptchaToken", "Site protected by CloudFlare CAPTCHA. Valid CAPTCHA token required.");
|
||||
if (ex.IsExpired)
|
||||
{
|
||||
return new ValidationFailure("CaptchaToken", "CloudFlare CAPTCHA token expired, please Refresh.");
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ValidationFailure("CaptchaToken", "Site protected by CloudFlare CAPTCHA. Valid CAPTCHA token required.");
|
||||
}
|
||||
}
|
||||
catch (UnsupportedFeedException ex)
|
||||
{
|
||||
|
@ -3,12 +3,13 @@
|
||||
|
||||
<div class="col-sm-5">
|
||||
<div class="input-group">
|
||||
<input type="text" name="fields.{{order}}.value" validation-name="{{name}}" spellcheck="false" class="form-control x-captcha" readonly />
|
||||
<input type="text" name="fields.{{order}}.value" validation-name="{{name}}" spellcheck="false" class="form-control x-captcha" readonly placeholder="(optional)" />
|
||||
<span class="input-group-btn"><button class="btn btn-primary x-captcha-refresh" title="Refresh CAPTCHA Token"><i class="icon-sonarr-refresh" /></button></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span class="col-sm-1 help-inline">
|
||||
<i class="icon-sonarr-form-warning" title="Expires periodically and will need to be refreshed. Refreshing the CAPTCHA Token will embed a temporary Google reCaptcha widget on this page."/>
|
||||
<i class="icon-sonarr-form-warning" title="Expires periodically and will need to be refreshed."/>
|
||||
<i class="icon-sonarr-form-warning" title="Refreshing the CAPTCHA Token will embed a temporary Google reCaptcha widget on this page."/>
|
||||
</span>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user