File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
packages/console/src/pages Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @logto/console " : patch
3
+ ---
4
+
5
+ always show enable CAPTCHA toggle
6
+
7
+ Even if there is no CAPTCHA provider, the toggle will be shown but disabled.
8
+
9
+ Also the back link of the captcha details page is changed to ` /security/captcha ` .
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ function CaptchaDetails() {
71
71
72
72
return (
73
73
< DetailsPage
74
- backLink = "/security"
74
+ backLink = "/security/captcha "
75
75
backLinkTitle = "security.captcha_details.back_to_security"
76
76
isLoading = { isLoading }
77
77
error = { error }
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ import { type RequestError } from '@/hooks/use-api';
10
10
11
11
import styles from './index.module.scss' ;
12
12
13
- function EnableCaptcha ( ) {
13
+ type Props = {
14
+ // eslint-disable-next-line react/boolean-prop-naming
15
+ readonly disabled ?: boolean ;
16
+ } ;
17
+
18
+ function EnableCaptcha ( { disabled } : Props ) {
14
19
const { t } = useTranslation ( undefined , { keyPrefix : 'admin_console' } ) ;
15
20
const { register, reset } = useFormContext < CaptchaPolicy > ( ) ;
16
21
const { data, isLoading } = useSWR < SignInExperience , RequestError > ( 'api/sign-in-exp' ) ;
@@ -32,6 +37,7 @@ function EnableCaptcha() {
32
37
< Switch
33
38
label = { t ( 'security.bot_protection.enable_captcha_description' ) }
34
39
{ ...register ( 'enabled' ) }
40
+ disabled = { disabled }
35
41
/>
36
42
</ div >
37
43
</ FormField >
Original file line number Diff line number Diff line change @@ -105,10 +105,7 @@ function Captcha() {
105
105
{ t ( 'security.bot_protection.captcha.placeholder' ) }
106
106
</ div >
107
107
{ data && ! isFreeTenant ? (
108
- < >
109
- < CaptchaCard captchaProvider = { data } />
110
- < EnableCaptcha />
111
- </ >
108
+ < CaptchaCard captchaProvider = { data } />
112
109
) : (
113
110
< Button
114
111
title = "security.bot_protection.captcha.add"
@@ -119,6 +116,7 @@ function Captcha() {
119
116
} }
120
117
/>
121
118
) }
119
+ < EnableCaptcha disabled = { isFreeTenant || ! data } />
122
120
</ FormField >
123
121
</ FormCard >
124
122
</ DetailsForm >
You can’t perform that action at this time.
0 commit comments