adds user accounts, service requests, dashboard, admin panel, better layout, db+altcha+auth support
This commit is contained in:
parent
dfbc3cade9
commit
0043a5bf3c
40 changed files with 3981 additions and 188 deletions
22
util/captcha.ts
Normal file
22
util/captcha.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { verifySolution } from "altcha-lib";
|
||||
|
||||
export async function verifyCaptcha(token: string): Promise<boolean> {
|
||||
const hmacKey = process.env.ALTCHA_SECRET;
|
||||
|
||||
if (!hmacKey) {
|
||||
console.error("ALTCHA_SECRET is not set");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!token) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
const isValid = await verifySolution(token, hmacKey);
|
||||
return isValid;
|
||||
} catch (error) {
|
||||
console.error("[ALTCHA] Error:", error);
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue