Load Turnstile site key at runtime
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 54s
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const express = require('express');
|
||||
const { login } = require('../auth');
|
||||
const { TURNSTILE_SECRET } = require('../config');
|
||||
const { TURNSTILE_SECRET, TURNSTILE_SITE_KEY } = require('../config');
|
||||
|
||||
const router = express.Router();
|
||||
const TURNSTILE_VERIFY_URL = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
|
||||
@@ -34,6 +34,13 @@ const verifyCaptcha = async (captchaToken, remoteIp) => {
|
||||
}
|
||||
};
|
||||
|
||||
router.get('/login/config', (req, res) => {
|
||||
res.json({
|
||||
captchaRequired: Boolean(TURNSTILE_SECRET),
|
||||
turnstileSiteKey: TURNSTILE_SITE_KEY
|
||||
});
|
||||
});
|
||||
|
||||
router.post('/login', async (req, res, next) => {
|
||||
const { email, password, captchaToken } = req.body;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user