Skip to content

Commit f0b69a3

Browse files
committed
chore: dart format
1 parent 4725074 commit f0b69a3

File tree

1 file changed

+45
-46
lines changed

1 file changed

+45
-46
lines changed

packages/auth/amplify_auth_cognito_dart/lib/src/state/machines/sign_in_state_machine.dart

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -330,56 +330,55 @@ final class SignInStateMachine
330330
createEmailMfaRequest(event),
331331
ChallengeNameType.selectMfaType when hasUserResponse =>
332332
createSelectMfaRequest(event),
333-
ChallengeNameType.mfaSetup =>
334-
(() async {
335-
final allowedMfaTypes = _allowedMfaTypes;
336-
if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) {
337-
throw const InvalidUserPoolConfigurationException(
338-
'No MFA types are allowed for setup.',
339-
recoverySuggestion: 'Check your user pool MFA configuration.',
340-
);
341-
}
342-
// Exclude MfaType.sms from consideration
343-
final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms});
344-
if (mfaTypesForSetup.isEmpty) {
345-
throw const InvalidUserPoolConfigurationException(
346-
'No eligible MFA types are available for setup.',
347-
recoverySuggestion: 'Check your user pool MFA configuration.',
348-
);
349-
}
350-
if (mfaTypesForSetup.length == 1) {
351-
final mfaType = mfaTypesForSetup.first;
352-
if (mfaType == MfaType.totp) {
353-
_enableMfaType = MfaType.totp;
354-
_totpSetupResult ??= await associateSoftwareToken();
355-
if (hasUserResponse) {
356-
return createMfaSetupRequest(event);
357-
} else {
358-
// Need to prompt user for the TOTP code
359-
return null;
360-
}
361-
} else if (mfaType == MfaType.email) {
362-
_enableMfaType = MfaType.email;
363-
if (hasUserResponse) {
364-
return createEmailMfaSetupRequest(event);
333+
ChallengeNameType.mfaSetup => (() async {
334+
final allowedMfaTypes = _allowedMfaTypes;
335+
if (allowedMfaTypes == null || allowedMfaTypes.isEmpty) {
336+
throw const InvalidUserPoolConfigurationException(
337+
'No MFA types are allowed for setup.',
338+
recoverySuggestion: 'Check your user pool MFA configuration.',
339+
);
340+
}
341+
// Exclude MfaType.sms from consideration
342+
final mfaTypesForSetup = allowedMfaTypes.difference({MfaType.sms});
343+
if (mfaTypesForSetup.isEmpty) {
344+
throw const InvalidUserPoolConfigurationException(
345+
'No eligible MFA types are available for setup.',
346+
recoverySuggestion: 'Check your user pool MFA configuration.',
347+
);
348+
}
349+
if (mfaTypesForSetup.length == 1) {
350+
final mfaType = mfaTypesForSetup.first;
351+
if (mfaType == MfaType.totp) {
352+
_enableMfaType = MfaType.totp;
353+
_totpSetupResult ??= await associateSoftwareToken();
354+
if (hasUserResponse) {
355+
return createMfaSetupRequest(event);
356+
} else {
357+
// Need to prompt user for the TOTP code
358+
return null;
359+
}
360+
} else if (mfaType == MfaType.email) {
361+
_enableMfaType = MfaType.email;
362+
if (hasUserResponse) {
363+
return createEmailMfaSetupRequest(event);
364+
} else {
365+
// Need to prompt user for the email verification code
366+
return null;
367+
}
365368
} else {
366-
// Need to prompt user for the email verification code
367-
return null;
369+
throw InvalidUserPoolConfigurationException(
370+
'Unsupported MFA type: ${mfaType.name}',
371+
recoverySuggestion: 'Check your user pool MFA configuration.',
372+
);
368373
}
374+
} else if (hasUserResponse) {
375+
// Handle user's selection
376+
return createMfaSetupRequest(event);
369377
} else {
370-
throw InvalidUserPoolConfigurationException(
371-
'Unsupported MFA type: ${mfaType.name}',
372-
recoverySuggestion: 'Check your user pool MFA configuration.',
373-
);
378+
// Need to prompt user to select an MFA type
379+
return null;
374380
}
375-
} else if (hasUserResponse) {
376-
// Handle user's selection
377-
return createMfaSetupRequest(event);
378-
} else {
379-
// Need to prompt user to select an MFA type
380-
return null;
381-
}
382-
})(),
381+
})(),
383382
ChallengeNameType.newPasswordRequired when hasUserResponse =>
384383
createNewPasswordRequest(event),
385384
_ => null,

0 commit comments

Comments
 (0)