@@ -108,12 +108,26 @@ export async function sendPasswordResetEmail(
108
108
actionCodeSettings
109
109
) ;
110
110
}
111
- await authentication . sendPasswordResetEmail ( authInternal , request ) . catch ( async ( error ) => {
112
- if ( error . code === `auth/${ AuthErrorCode . MISSING_RECAPTCHA_TOKEN } ` ) {
113
- console . log ( "Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow." ) ;
114
- const requestWithRecaptcha = await injectRecaptchaFields ( authInternal , request , RecaptchaActionName . GET_OOB_CODE , true ) ;
115
- if ( actionCodeSettings ) {
116
- _setActionCodeSettingsOnRequest ( authInternal , requestWithRecaptcha , actionCodeSettings ) ;
111
+ await authentication
112
+ . sendPasswordResetEmail ( authInternal , request )
113
+ . catch ( async error => {
114
+ if ( error . code === `auth/${ AuthErrorCode . MISSING_RECAPTCHA_TOKEN } ` ) {
115
+ console . log (
116
+ 'Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.'
117
+ ) ;
118
+ const requestWithRecaptcha = await injectRecaptchaFields (
119
+ authInternal ,
120
+ request ,
121
+ RecaptchaActionName . GET_OOB_CODE ,
122
+ true
123
+ ) ;
124
+ if ( actionCodeSettings ) {
125
+ _setActionCodeSettingsOnRequest (
126
+ authInternal ,
127
+ requestWithRecaptcha ,
128
+ actionCodeSettings
129
+ ) ;
130
+ }
117
131
}
118
132
} ) ;
119
133
}
@@ -274,10 +288,16 @@ export async function createUserWithEmailAndPassword(
274
288
) ;
275
289
signUpResponse = signUp ( authInternal , requestWithRecaptcha ) ;
276
290
} else {
277
- signUpResponse = signUp ( authInternal , request ) . catch ( async ( error ) => {
291
+ signUpResponse = signUp ( authInternal , request ) . catch ( async error => {
278
292
if ( error . code === `auth/${ AuthErrorCode . MISSING_RECAPTCHA_TOKEN } ` ) {
279
- console . log ( "Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow." ) ;
280
- const requestWithRecaptcha = await injectRecaptchaFields ( authInternal , request , RecaptchaActionName . SIGN_UP_PASSWORD ) ;
293
+ console . log (
294
+ 'Sign-up is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-up flow.'
295
+ ) ;
296
+ const requestWithRecaptcha = await injectRecaptchaFields (
297
+ authInternal ,
298
+ request ,
299
+ RecaptchaActionName . SIGN_UP_PASSWORD
300
+ ) ;
281
301
return signUp ( authInternal , requestWithRecaptcha ) ;
282
302
} else {
283
303
return Promise . reject ( error ) ;
0 commit comments