File tree Expand file tree Collapse file tree
packages/functional-tests/lib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -256,27 +256,24 @@ export class TestAccountTracker {
256256 const verifyIfNeeded = async ( ) => {
257257 try {
258258 await this . target . authClient . sessionResendVerifyCode ( sessionToken ) ;
259- // Prefer short (signup) code to confirm account when unverified
260- try {
261- const shortCode =
262- await this . target . emailClient . getVerifyShortCode ( account . email ) ;
263- await this . target . authClient . sessionVerifyCode (
264- sessionToken ,
265- shortCode
266- ) ;
267- return ;
268- } catch ( _ ) {
269- // Fallback to login verification code for unverified session
270- }
271- const loginCode = await this . target . emailClient . getVerifyLoginCode (
272- account . email
273- ) ;
274- await this . target . authClient . sessionVerifyCode (
275- sessionToken ,
276- loginCode
259+
260+ // Start checking for codes in parallel, whichever is available first will be used
261+ const [ shortCodePromise , loginCodePromise ] = [
262+ this . target . emailClient . getVerifyShortCode ( account . email ) ,
263+ this . target . emailClient . getVerifyLoginCode ( account . email ) ,
264+ ] ;
265+ const code = await Promise . any ( [
266+ shortCodePromise ,
267+ loginCodePromise ,
268+ ] ) ;
269+ await this . target . authClient . sessionVerifyCode ( sessionToken , code ) ;
270+ } catch ( err ) {
271+ // allow console.error so we can capture this message in the trace.
272+ // eslint-disable-next-line no-console
273+ console . error (
274+ `Session verification skipped (might already be verified):` ,
275+ err
277276 ) ;
278- } catch {
279- // Ignore verification errors - account/session might already be verified
280277 }
281278 } ;
282279
You can’t perform that action at this time.
0 commit comments