1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-06 06:02:40 +03:00

Render reCAPTCHA challenge on the registration form

This commit is contained in:
Quentin Gliech
2024-05-10 17:17:19 +02:00
parent c422c29a60
commit a3beeb2398
18 changed files with 342 additions and 19 deletions

View File

@@ -40,7 +40,7 @@ pub use self::{
AuthorizationCode, AuthorizationGrant, AuthorizationGrantStage, Client, DeviceCodeGrant,
DeviceCodeGrantState, InvalidRedirectUriError, JwksOrJwksUri, Pkce, Session, SessionState,
},
site_config::SiteConfig,
site_config::{CaptchaConfig, CaptchaService, SiteConfig},
tokens::{
AccessToken, AccessTokenState, RefreshToken, RefreshTokenState, TokenFormatError, TokenType,
},

View File

@@ -15,6 +15,25 @@
use chrono::Duration;
use url::Url;
/// Which Captcha service is being used
#[derive(Debug, Clone)]
pub enum CaptchaService {
RecaptchaV2,
}
/// Captcha configuration
#[derive(Debug, Clone)]
pub struct CaptchaConfig {
/// Which Captcha service is being used
pub service: CaptchaService,
/// The site key used by the instance
pub site_key: String,
/// The secret key used by the instance
pub secret_key: String,
}
/// Random site configuration we want accessible in various places.
#[allow(clippy::struct_excessive_bools)]
#[derive(Debug, Clone)]
@@ -51,4 +70,7 @@ pub struct SiteConfig {
/// Whether users can change their password.
pub password_change_allowed: bool,
/// Captcha configuration
pub captcha: Option<CaptchaConfig>,
}