captcha: fix for custom invite form subpath

This commit is contained in:
Harvey Tindall
2025-05-14 22:58:37 +01:00
parent 471021623b
commit eab33d9f6d
+3 -1
View File
@@ -1,5 +1,7 @@
import { _get, _post } from "./common.js";
declare var window: GlobalWindow;
export class Captcha {
isPWR = false;
enabled = true;
@@ -51,7 +53,7 @@ export class Captcha {
this.captchaID = this.isPWR ? this.code : req.response["id"];
// the Math.random() appearance below is used for PWRs, since they don't have a unique captchaID. The parameter is ignored by the server, but tells the browser to reload the image.
document.getElementById("captcha-img").innerHTML = `
<img class="w-full" src="${window.location.toString().substring(0, window.location.toString().lastIndexOf("/invite"))}/captcha/img/${this.code}/${this.isPWR ? Math.random() : this.captchaID}${this.isPWR ? "?pwr=true" : ""}"></img>
<img class="w-full" src="${window.location.toString().substring(0, window.location.toString().lastIndexOf(window.pages.Form))}/captcha/img/${this.code}/${this.isPWR ? Math.random() : this.captchaID}${this.isPWR ? "?pwr=true" : ""}"></img>
`;
this.input.value = "";
}