Skip to content

Commit 57f000f

Browse files
committed
fix: review fixes
1 parent a89bb4b commit 57f000f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Auth.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,15 @@ const findUsersWithAuthData = async (config, authData, beforeFind) => {
443443
};
444444

445445
const hasMutatedAuthData = (authData, userAuthData) => {
446-
if (!userAuthData) { return { hasMutatedAuthData: true, mutatedAuthData: authData }; }
446+
if (!userAuthData) {
447+
return { hasMutatedAuthData: true, mutatedAuthData: authData };
448+
}
447449
const mutatedAuthData = {};
448450
Object.keys(authData).forEach(provider => {
449451
// Anonymous provider is not handled this way
450-
if (provider === 'anonymous') { return; }
452+
if (provider === 'anonymous') {
453+
return;
454+
}
451455
const providerData = authData[provider];
452456
const userProviderAuthData = userAuthData[provider];
453457
if (!isDeepStrictEqual(providerData, userProviderAuthData)) {
@@ -505,13 +509,11 @@ const checkIfUserHasProvidedConfiguredProvidersForLogin = (
505509
return;
506510
}
507511

508-
let errorMsg = `Missing additional authData ${additionProvidersNotFound.join(',')}`
509-
if(additionProvidersNotFound.length>0){
512+
let errorMsg = `Missing additional authData ${additionProvidersNotFound.join(',')}`;
513+
if (additionProvidersNotFound.length > 0) {
510514
const mfaData = userAuthData.mfa || {};
511-
const needsToken = !mfaData.secret && (mfaData.email || mfaData.mobile);
512-
const additionalInfo = needsToken
513-
? " (include 'request' as token to receive a verification code)"
514-
: "";
515+
const needsToken = !mfaData.secret;
516+
const additionalInfo = needsToken ? ' Send request for additional auth data' : '';
515517

516518
errorMsg += additionalInfo;
517519
}

0 commit comments

Comments
 (0)