fix: avoid 400 error on invite code requirement check
This commit is contained in:
@@ -13,6 +13,12 @@ if (!REQUIRE_INVITE_CODE) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$input = json_decode(file_get_contents('php://input'), true);
|
$input = json_decode(file_get_contents('php://input'), true);
|
||||||
|
|
||||||
|
if (!empty($input['check'])) {
|
||||||
|
echo json_encode(['valid' => false, 'required' => true]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$code = trim($input['code'] ?? '');
|
$code = trim($input['code'] ?? '');
|
||||||
|
|
||||||
if (!$code) {
|
if (!$code) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class AuthModal extends HTMLElement {
|
|||||||
const res = await fetch(`${POW_SERVER}/invite/validate`, {
|
const res = await fetch(`${POW_SERVER}/invite/validate`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({ code: '' })
|
body: JSON.stringify({ check: true })
|
||||||
})
|
})
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
this.requireInviteCode = !data.valid
|
this.requireInviteCode = !data.valid
|
||||||
|
|||||||
Reference in New Issue
Block a user