mirror of
https://github.com/bitwarden/server.git
synced 2025-07-03 00:52:49 -05:00
Added logging on Captcha error.
(cherry picked from commit d1ed4fed8a12434e360a690ce5e5d8c6448b11e1)
This commit is contained in:
@ -77,6 +77,7 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
|||||||
|
|
||||||
if (!responseMessage.IsSuccessStatusCode)
|
if (!responseMessage.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
|
_logger.LogError("Error submitting Captcha token to HCaptcha: {status} - {message}", responseMessage.StatusCode, responseMessage.ReasonPhrase);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +87,12 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
|||||||
response.MaybeBot = score >= _globalSettings.Captcha.MaybeBotScoreThreshold;
|
response.MaybeBot = score >= _globalSettings.Captcha.MaybeBotScoreThreshold;
|
||||||
response.IsBot = score >= _globalSettings.Captcha.IsBotScoreThreshold;
|
response.IsBot = score >= _globalSettings.Captcha.IsBotScoreThreshold;
|
||||||
response.Score = score;
|
response.Score = score;
|
||||||
|
|
||||||
|
if (!response.Success && hcaptchaResponse.ErrorCodes != null && hcaptchaResponse.ErrorCodes.Any())
|
||||||
|
{
|
||||||
|
_logger.LogError("HCaptcha errors received when validating Captcha for user {email}: {@errors}", user.Email, hcaptchaResponse.ErrorCodes);
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +132,8 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
|||||||
public double? Score { get; set; }
|
public double? Score { get; set; }
|
||||||
[JsonPropertyName("score_reason")]
|
[JsonPropertyName("score_reason")]
|
||||||
public List<string> ScoreReason { get; set; }
|
public List<string> ScoreReason { get; set; }
|
||||||
|
[JsonPropertyName("error-codes")]
|
||||||
|
public List<string> ErrorCodes {get;set;}
|
||||||
|
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user