Skip to content

Commit

Permalink
Merge pull request #51 from meili-NG/staging
Browse files Browse the repository at this point in the history
meiliNG v0.9.2 (Hotfix)
  • Loading branch information
Alex4386 authored Sep 8, 2022
2 parents 0a277e9 + 66e5a85 commit e6c2785
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meiling",
"version": "0.9.1",
"version": "0.9.2",
"description": "An Opensource Next Generation \"Gatekeeper\" with oAuth2 Authentication Provider and OpenID Connect Server",
"main": "dist/",
"repository": "https://github.com/meili-NG/meiliNG",
Expand Down
2 changes: 1 addition & 1 deletion src/common/meiling/v1/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export async function setSession(req: FastifyRequest, data?: MeilingSession): Pr
try {
// not async function since we don't need to wait it to complete.
Meiling.Identity.User.updateLastAuthenticated(user.id);
} catch (e) { }
} catch (e) {}
}
}
}
Expand Down
54 changes: 27 additions & 27 deletions src/routes/v1/meiling/signin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export async function signinHandler(req: FastifyRequest, rep: FastifyReply): Pro
const is2FARemembered = await Meiling.V1.Session.is2FARemembered(req, user);
if (user.useTwoFactor) {
if (is2FARemembered) {
markToRemember2FA = true;
} else {
const twoFactorMethods = await Meiling.V1.User.getAvailableExtendedAuthenticationMethods(user, body.type);

if (twoFactorMethods.length > 0) {
Expand All @@ -110,8 +112,6 @@ export async function signinHandler(req: FastifyRequest, rep: FastifyReply): Pro
);
return;
}
} else {
markToRemember2FA = true;
}
}
} else if (
Expand Down Expand Up @@ -311,33 +311,33 @@ export async function signinHandler(req: FastifyRequest, rep: FastifyReply): Pro
webauthn:
signinMethod === ExtendedAuthMethods.WEBAUTHN
? {
allowCredentials: (
await getPrismaClient().authentication.findMany({
where: {
user: {
id: {
in: targetUsers.filter((n) => n !== undefined).map((n) => (n as UserModel).id),
allowCredentials: (
await getPrismaClient().authentication.findMany({
where: {
user: {
id: {
in: targetUsers.filter((n) => n !== undefined).map((n) => (n as UserModel).id),
},
},
method: 'WEBAUTHN',
allowSingleFactor: body.type === SigninType.PASSWORDLESS ? true : undefined,
allowTwoFactor: body.type === SigninType.TWO_FACTOR_AUTH ? true : undefined,
},
method: 'WEBAUTHN',
allowSingleFactor: body.type === SigninType.PASSWORDLESS ? true : undefined,
allowTwoFactor: body.type === SigninType.TWO_FACTOR_AUTH ? true : undefined,
},
})
)
.map((n) => {
const data = n.data as unknown as AuthenticationJSONObject;
if (data.type !== 'WEBAUTHN') {
return;
}

return {
id: data.data.key.id,
type: 'public-key',
};
})
.filter((n) => n !== undefined),
}
})
)
.map((n) => {
const data = n.data as unknown as AuthenticationJSONObject;
if (data.type !== 'WEBAUTHN') {
return;
}

return {
id: data.data.key.id,
type: 'public-key',
};
})
.filter((n) => n !== undefined),
}
: undefined,
};

Expand Down

0 comments on commit e6c2785

Please sign in to comment.