mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
fix(core): error data bug fixing (#6382)
fix(core): error code bug fixing error code bug fixing
This commit is contained in:
parent
ebb6a91de7
commit
0671208d0f
2 changed files with 5 additions and 5 deletions
|
@ -51,7 +51,7 @@ export class PasswordValidator {
|
|||
);
|
||||
|
||||
if (issues.length > 0) {
|
||||
throw new RequestError({ code: 'password.rejected', status: 422 }, { issues });
|
||||
throw new RequestError({ code: 'password.rejected', status: 422 }, issues);
|
||||
}
|
||||
|
||||
if (this.user) {
|
||||
|
|
|
@ -284,15 +284,15 @@ export class Mfa {
|
|||
return;
|
||||
}
|
||||
|
||||
const requiredFactors = factors.filter((factor) => factor !== MfaFactor.BackupCode);
|
||||
const availableFactors = factors.filter((factor) => factor !== MfaFactor.BackupCode);
|
||||
|
||||
const factorsInUser = filterOutEmptyBackupCodes(mfaVerifications).map(({ type }) => type);
|
||||
const factorsInBind = this.bindMfaFactorsArray.map(({ type }) => type);
|
||||
const availableFactors = deduplicate([...factorsInUser, ...factorsInBind]);
|
||||
const linkedFactors = deduplicate([...factorsInUser, ...factorsInBind]);
|
||||
|
||||
// Assert that the user has at least one of the required factors bound
|
||||
assertThat(
|
||||
requiredFactors.some((factor) => availableFactors.includes(factor)),
|
||||
availableFactors.some((factor) => linkedFactors.includes(factor)),
|
||||
new RequestError(
|
||||
{ code: 'user.missing_mfa', status: 422 },
|
||||
policy === MfaPolicy.Mandatory
|
||||
|
@ -303,7 +303,7 @@ export class Mfa {
|
|||
|
||||
// Assert backup code
|
||||
assertThat(
|
||||
!factors.includes(MfaFactor.BackupCode) || availableFactors.includes(MfaFactor.BackupCode),
|
||||
!factors.includes(MfaFactor.BackupCode) || linkedFactors.includes(MfaFactor.BackupCode),
|
||||
new RequestError({
|
||||
code: 'session.mfa.backup_code_required',
|
||||
status: 422,
|
||||
|
|
Loading…
Reference in a new issue