Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
7e462f71
Commit
7e462f71
authored
Mar 26, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generalize solution of recaptcha reset
parent
07388c62
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
ReCaptcha.tsx
ui/shared/reCaptcha/ReCaptcha.tsx
+8
-0
AuthModalScreenOtpCode.tsx
ui/snippets/auth/screens/AuthModalScreenOtpCode.tsx
+1
-3
No files found.
ui/shared/reCaptcha/ReCaptcha.tsx
View file @
7e462f71
...
...
@@ -8,6 +8,12 @@ interface Props {
}
const
ReCaptchaInvisible
=
({
disabledFeatureMessage
}:
Props
,
ref
:
React
.
Ref
<
ReCaptcha
>
)
=>
{
const
[
attempt
,
setAttempt
]
=
React
.
useState
(
0
);
const
handleChange
=
React
.
useCallback
(()
=>
{
setAttempt
(
attempt
+
1
);
},
[
attempt
]);
if
(
!
config
.
services
.
reCaptchaV2
.
siteKey
)
{
return
disabledFeatureMessage
??
null
;
}
...
...
@@ -15,8 +21,10 @@ const ReCaptchaInvisible = ({ disabledFeatureMessage }: Props, ref: React.Ref<Re
return
(
<
ReCaptcha
ref=
{
ref
}
key=
{
attempt
}
sitekey=
{
config
.
services
.
reCaptchaV2
.
siteKey
}
size=
"invisible"
onChange=
{
handleChange
}
/>
);
};
...
...
ui/snippets/auth/screens/AuthModalScreenOtpCode.tsx
View file @
7e462f71
...
...
@@ -28,7 +28,6 @@ const AuthModalScreenOtpCode = ({ email, onSuccess, isAuth }: Props) => {
const
toast
=
useToast
();
const
recaptcha
=
useReCaptcha
();
const
[
isCodeSending
,
setIsCodeSending
]
=
React
.
useState
(
false
);
const
[
resendAttempts
,
setResendAttempts
]
=
React
.
useState
(
0
);
const
formApi
=
useForm
<
OtpCodeFormFields
>
({
mode
:
'
onBlur
'
,
...
...
@@ -96,7 +95,6 @@ const AuthModalScreenOtpCode = ({ email, onSuccess, isAuth }: Props) => {
description
:
apiError
?.
message
||
getErrorMessage
(
error
)
||
'
Something went wrong
'
,
});
}
finally
{
setResendAttempts
((
prev
)
=>
prev
+
1
);
setIsCodeSending
(
false
);
}
},
[
apiFetch
,
email
,
formApi
,
toast
,
recaptcha
]);
...
...
@@ -113,7 +111,7 @@ const AuthModalScreenOtpCode = ({ email, onSuccess, isAuth }: Props) => {
and enter your code below.
</
Text
>
<
AuthModalFieldOtpCode
isDisabled=
{
isCodeSending
}
/>
<
ReCaptcha
key=
{
resendAttempts
}
ref=
{
recaptcha
.
ref
}
/>
<
ReCaptcha
ref=
{
recaptcha
.
ref
}
/>
<
Button
variant=
"link"
display=
"flex"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment