mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
Added logging on Captcha error.
(cherry picked from commit d1ed4fed8a12434e360a690ce5e5d8c6448b11e1)
This commit is contained in:
@ -74,9 +74,10 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
||||
_logger.LogError(11389, e, "Unable to verify with HCaptcha.");
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
if (!responseMessage.IsSuccessStatusCode)
|
||||
{
|
||||
_logger.LogError("Error submitting Captcha token to HCaptcha: {status} - {message}", responseMessage.StatusCode, responseMessage.ReasonPhrase);
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -86,6 +87,12 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
||||
response.MaybeBot = score >= _globalSettings.Captcha.MaybeBotScoreThreshold;
|
||||
response.IsBot = score >= _globalSettings.Captcha.IsBotScoreThreshold;
|
||||
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;
|
||||
}
|
||||
|
||||
@ -125,6 +132,8 @@ public class HCaptchaValidationService : ICaptchaValidationService
|
||||
public double? Score { get; set; }
|
||||
[JsonPropertyName("score_reason")]
|
||||
public List<string> ScoreReason { get; set; }
|
||||
[JsonPropertyName("error-codes")]
|
||||
public List<string> ErrorCodes {get;set;}
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
Reference in New Issue
Block a user