File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99} from "firebase/auth" ;
1010
1111import Ape from "./ape" ;
12- import { showRegisterCaptchaModal } from "./components/modals/RegisterCaptchaModal" ;
1312import { updateFromServer as updateConfigFromServer } from "./config/remote" ;
1413import * as DB from "./db" ;
1514import { authEvent } from "./events/auth" ;
@@ -229,14 +228,11 @@ export async function signUp(
229228 name : string ,
230229 email : string ,
231230 password : string ,
231+ captchaToken : string ,
232232) : Promise < AuthResult > {
233233 if ( ! isAuthAvailable ( ) ) {
234234 return { success : false , message : "Authentication uninitialized" } ;
235235 }
236- const captchaToken = await showRegisterCaptchaModal ( ) ;
237- if ( captchaToken === undefined || captchaToken === "" ) {
238- return { success : false , message : "Please complete the captcha" } ;
239- }
240236
241237 try {
242238 const createdAuthUser = await createUserWithEmailAndPassword (
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ import {
2222import { isDevEnvironment } from "../../../utils/env" ;
2323import { remoteValidationForm } from "../../../utils/remote-validation" ;
2424import { H3 } from "../../common/Headers" ;
25+ import { showRegisterCaptchaModal } from "../../modals/RegisterCaptchaModal" ;
2526import { InputField } from "../../ui/form/InputField" ;
2627import { SubmitButton } from "../../ui/form/SubmitButton" ;
2728import {
@@ -88,8 +89,19 @@ export function Register(): JSXElement {
8889 } ,
8990 onSubmit : async ( { value } ) => {
9091 disableLoginPageInputs ( ) ;
92+ const captchaToken = await showRegisterCaptchaModal ( ) ;
93+ if ( captchaToken === undefined || captchaToken === "" ) {
94+ showErrorNotification ( "Please complete the captcha" ) ;
95+ enableLoginPageInputs ( ) ;
96+ return ;
97+ }
9198 try {
92- const data = await signUp ( value . username , value . email , value . password ) ;
99+ const data = await signUp (
100+ value . username ,
101+ value . email ,
102+ value . password ,
103+ captchaToken ,
104+ ) ;
93105 if ( ! data . success ) {
94106 showErrorNotification ( data . message ) ;
95107 }
You can’t perform that action at this time.
0 commit comments