fix(server): captcha guard (#4673)

This commit is contained in:
DarkSky 2023-10-20 03:54:08 -05:00 committed by GitHub
parent 817463c40e
commit 779ac39b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -151,7 +151,9 @@ export class NextAuthController {
if (
this.config.auth.captcha.enable &&
req.method === 'POST' &&
action === 'signin'
action === 'signin' &&
// TODO: add credentials support in frontend
['email'].includes(providerId)
) {
const isVerified = await this.verifyChallenge(req, res);
if (!isVerified) return;
@ -382,11 +384,9 @@ export class NextAuthController {
rejectResponse(res: Response, error: string, status = 400) {
res.status(status);
res.json({
url: `https://${this.config.baseUrl}/api/auth/error?${new URLSearchParams(
{
error,
}
).toString()}`,
url: `${this.config.baseUrl}/api/auth/error?${new URLSearchParams({
error,
}).toString()}`,
error,
});
}