1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

graphql: Expose CAPTCHA config and whether password registration is enabled

This commit is contained in:
Olivier 'reivilibre
2024-07-26 12:14:21 +01:00
committed by reivilibre
parent 4a275fa4b9
commit 8737d6f89b
4 changed files with 161 additions and 1 deletions

View File

@ -300,6 +300,27 @@ type BrowserSessionEdge {
cursor: String!
}
type CaptchaConfig {
"""
Which Captcha service is being used
"""
service: CaptchaService!
"""
The site key used by the instance
"""
siteKey: String!
id: ID!
}
"""
Which Captcha service is being used
"""
enum CaptchaService {
RECAPTCHA_V2
CLOUDFLARE_TURNSTILE
H_CAPTCHA
}
"""
A compat session represents a client session which used the legacy Matrix
login API.
@ -1414,6 +1435,10 @@ enum SetPrimaryEmailStatus {
}
type SiteConfig implements Node {
"""
The configuration of CAPTCHA provider.
"""
captchaConfig: CaptchaConfig
"""
The server name of the homeserver.
"""
@ -1447,6 +1472,10 @@ type SiteConfig implements Node {
"""
passwordChangeAllowed: Boolean!
"""
Whether passwords are enabled and users can register using a password.
"""
passwordRegistrationEnabled: Boolean!
"""
Minimum password complexity, from 0 to 4, in terms of a zxcvbn score.
The exact scorer (including dictionaries and other data tables)
in use is <https://crates.io/crates/zxcvbn>.

View File

@ -212,6 +212,22 @@ export type BrowserSessionEdge = {
node: BrowserSession;
};
export type CaptchaConfig = {
__typename?: 'CaptchaConfig';
id: Scalars['ID']['output'];
/** Which Captcha service is being used */
service: CaptchaService;
/** The site key used by the instance */
siteKey: Scalars['String']['output'];
};
/** Which Captcha service is being used */
export enum CaptchaService {
CloudflareTurnstile = 'CLOUDFLARE_TURNSTILE',
HCaptcha = 'H_CAPTCHA',
RecaptchaV2 = 'RECAPTCHA_V2'
}
/**
* A compat session represents a client session which used the legacy Matrix
* login API.
@ -1063,6 +1079,8 @@ export enum SetPrimaryEmailStatus {
export type SiteConfig = Node & {
__typename?: 'SiteConfig';
/** The configuration of CAPTCHA provider. */
captchaConfig?: Maybe<CaptchaConfig>;
/** Whether users can change their display name. */
displayNameChangeAllowed: Scalars['Boolean']['output'];
/** Whether users can change their email. */
@ -1081,6 +1099,8 @@ export type SiteConfig = Node & {
passwordChangeAllowed: Scalars['Boolean']['output'];
/** Whether passwords are enabled for login. */
passwordLoginEnabled: Scalars['Boolean']['output'];
/** Whether passwords are enabled and users can register using a password. */
passwordRegistrationEnabled: Scalars['Boolean']['output'];
/** The URL to the privacy policy. */
policyUri?: Maybe<Scalars['Url']['output']>;
/** The server name of the homeserver. */

View File

@ -529,6 +529,46 @@ export default {
],
"interfaces": []
},
{
"kind": "OBJECT",
"name": "CaptchaConfig",
"fields": [
{
"name": "id",
"type": {
"kind": "NON_NULL",
"ofType": {
"kind": "SCALAR",
"name": "Any"
}
},
"args": []
},
{
"name": "service",
"type": {
"kind": "NON_NULL",
"ofType": {
"kind": "SCALAR",
"name": "Any"
}
},
"args": []
},
{
"name": "siteKey",
"type": {
"kind": "NON_NULL",
"ofType": {
"kind": "SCALAR",
"name": "Any"
}
},
"args": []
}
],
"interfaces": []
},
{
"kind": "OBJECT",
"name": "CompatSession",
@ -2570,6 +2610,15 @@ export default {
"kind": "OBJECT",
"name": "SiteConfig",
"fields": [
{
"name": "captchaConfig",
"type": {
"kind": "OBJECT",
"name": "CaptchaConfig",
"ofType": null
},
"args": []
},
{
"name": "displayNameChangeAllowed",
"type": {
@ -2644,6 +2693,17 @@ export default {
},
"args": []
},
{
"name": "passwordRegistrationEnabled",
"type": {
"kind": "NON_NULL",
"ofType": {
"kind": "SCALAR",
"name": "Any"
}
},
"args": []
},
{
"name": "policyUri",
"type": {