Bluesky app fork with some witchin' additions 💫

Ensure captcha verification code gets submitted in signup request (#5010)

Co-authored-by: Eric Bailey <git@esb.lol>

authored by hailey.at

Eric Bailey and committed by
GitHub
16d556c3 94d2180a

+9 -13
+1 -2
src/screens/Signup/StepCaptcha/index.tsx
··· 41 41 (code: string) => { 42 42 setCompleted(true) 43 43 logEvent('signup:captchaSuccess', {}) 44 - const submitTask = {code, mutableProcessed: false} 45 44 dispatch({ 46 45 type: 'submit', 47 - task: submitTask, 46 + task: {verificationCode: code, mutableProcessed: false}, 48 47 }) 49 48 }, 50 49 [dispatch],
+4 -2
src/screens/Signup/StepHandle.tsx
··· 65 65 }) 66 66 // phoneVerificationRequired is actually whether a captcha is required 67 67 if (!state.serviceDescription?.phoneVerificationRequired) { 68 - const submitTask = {code: undefined, mutableProcessed: false} 69 - dispatch({type: 'submit', task: submitTask}) 68 + dispatch({ 69 + type: 'submit', 70 + task: {verificationCode: undefined, mutableProcessed: false}, 71 + }) 70 72 return 71 73 } 72 74 dispatch({type: 'next'})
+4 -9
src/screens/Signup/state.ts
··· 27 27 } 28 28 29 29 type SubmitTask = { 30 - code: string | undefined 30 + verificationCode: string | undefined 31 31 mutableProcessed: boolean // OK to mutate assuming it's never read in render. 32 32 } 33 33 ··· 62 62 | {type: 'setDateOfBirth'; value: Date} 63 63 | {type: 'setInviteCode'; value: string} 64 64 | {type: 'setHandle'; value: string} 65 - | {type: 'setVerificationCode'; value: string} 66 65 | {type: 'setError'; value: string} 67 66 | {type: 'setIsLoading'; value: boolean} 68 67 | {type: 'submit'; task: SubmitTask} ··· 189 188 const onboardingDispatch = useOnboardingDispatch() 190 189 191 190 return useCallback( 192 - async ( 193 - state: SignupState, 194 - dispatch: (action: SignupAction) => void, 195 - verificationCode?: string, 196 - ) => { 191 + async (state: SignupState, dispatch: (action: SignupAction) => void) => { 197 192 if (!state.email) { 198 193 dispatch({type: 'setStep', value: SignupStep.INFO}) 199 194 return dispatch({ ··· 224 219 } 225 220 if ( 226 221 state.serviceDescription?.phoneVerificationRequired && 227 - !verificationCode 222 + !state.pendingSubmit?.verificationCode 228 223 ) { 229 224 dispatch({type: 'setStep', value: SignupStep.CAPTCHA}) 230 225 logger.error('Signup Flow Error', { ··· 247 242 password: state.password, 248 243 birthDate: state.dateOfBirth, 249 244 inviteCode: state.inviteCode.trim(), 250 - verificationCode: verificationCode, 245 + verificationCode: state.pendingSubmit?.verificationCode, 251 246 }) 252 247 /* 253 248 * Must happen last so that if the user has multiple tabs open and