mirror of
https://github.com/bitwarden/mobile
synced 2026-01-03 00:53:27 +00:00
Feature/use hcaptcha if bot (#1476)
* Add captcha to login models and methods * Add captcha web auth to login * Extract captcha to abstract base class * Add Captcha to register * Null out captcha token after each successful challenge * Cancel > close
This commit is contained in:
@@ -15,5 +15,6 @@ namespace Bit.Core.Models.Request
|
||||
public Guid? OrganizationUserId { get; set; }
|
||||
public KdfType? Kdf { get; set; }
|
||||
public int? KdfIterations { get; set; }
|
||||
public string CaptchaResponse { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@ namespace Bit.Core.Models.Request
|
||||
public string Token { get; set; }
|
||||
public TwoFactorProviderType? Provider { get; set; }
|
||||
public bool? Remember { get; set; }
|
||||
public string CaptchaToken { get; set; }
|
||||
public DeviceRequest Device { get; set; }
|
||||
|
||||
public TokenRequest(string[] credentials, string[] codes, TwoFactorProviderType? provider, string token,
|
||||
bool? remember, DeviceRequest device = null)
|
||||
bool? remember, string captchaToken, DeviceRequest device = null)
|
||||
{
|
||||
if (credentials != null && credentials.Length > 1)
|
||||
{
|
||||
@@ -36,6 +37,7 @@ namespace Bit.Core.Models.Request
|
||||
Provider = provider;
|
||||
Remember = remember;
|
||||
Device = device;
|
||||
CaptchaToken = captchaToken;
|
||||
}
|
||||
|
||||
public Dictionary<string, string> ToIdentityToken(string clientId)
|
||||
@@ -77,6 +79,11 @@ namespace Bit.Core.Models.Request
|
||||
obj.Add("twoFactorProvider", ((int)Provider.Value).ToString());
|
||||
obj.Add("twoFactorRemember", Remember.GetValueOrDefault() ? "1" : "0");
|
||||
}
|
||||
if (CaptchaToken != null)
|
||||
{
|
||||
obj.Add("captchaResponse", CaptchaToken);
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user