Skip to content

Commit

Permalink
fix switch case statements in setPreferredMFA (#4145)
Browse files Browse the repository at this point in the history
before this change you are not able to setPreferredMFA to SMS_MFA

Co-authored-by: Sam Martinez <[email protected]>
Co-authored-by: Alex Hinson <[email protected]>
  • Loading branch information
3 people authored Oct 26, 2021
1 parent 3f8c000 commit 5d5083c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/auth/src/Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ export class AuthClass {
*/
public async setPreferredMFA(
user: CognitoUser | any,
mfaMethod: 'TOTP' | 'SMS' | 'NOMFA'
mfaMethod: 'TOTP' | 'SMS' | 'NOMFA' | 'SMS_MFA' | 'SOFTWARE_TOKEN_MFA'
): Promise<string> {
const clientMetadata = this._config.clientMetadata; // TODO: verify behavior if this is override during signIn

Expand All @@ -785,13 +785,15 @@ export class AuthClass {
let totpMfaSettings = null;

switch (mfaMethod) {
case 'TOTP' || 'SOFTWARE_TOKEN_MFA':
case 'TOTP':
case 'SOFTWARE_TOKEN_MFA':
totpMfaSettings = {
PreferredMfa: true,
Enabled: true,
};
break;
case 'SMS' || 'SMS_MFA':
case 'SMS':
case 'SMS_MFA':
smsMfaSettings = {
PreferredMfa: true,
Enabled: true,
Expand Down

0 comments on commit 5d5083c

Please sign in to comment.