fix undisabling elements

pull/83/head
Aevann 2023-01-01 04:17:46 +02:00
parent 1f0ebdad0b
commit 0c6866ed84
4 changed files with 8 additions and 8 deletions

View File

@ -81,11 +81,11 @@ for (const element of change_submit) {
element.onchange = () => {element.form.submit()};
}
const undisableelement = document.querySelectorAll('[undisableelement]');
for (const element of undisableelement) {
const undisable_element = document.querySelectorAll('[data-undisable_element]');
for (const element of undisable_element) {
if (element.dataset.nonce != nonce) continue
element.oninput = () => {
document.getElementById(element.dataset.undisableelement).disabled = false;
document.getElementById(element.dataset.undisable_element).disabled = false;
};
}

View File

@ -32,7 +32,7 @@
<form action="/admin/ban_domain" method="post">
<input type="hidden" name="formkey" value="{{v|formkey}}">
<input autocomplete="off" name="domain" placeholder="Enter domain here.." class="form-control" required>
<input autocomplete="off" name="reason" placeholder="Enter ban reason here.." data-nonce="{{g.nonce}}" data-undisableelement="ban-submit" class="form-control mt-2">
<input autocomplete="off" name="reason" placeholder="Enter ban reason here.." data-nonce="{{g.nonce}}" data-undisable_element="ban-submit" class="form-control mt-2">
<input autocomplete="off" id="ban-submit" type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" class="btn btn-primary mt-2" value="Ban domain" disabled>
</form>
</div>

View File

@ -213,7 +213,7 @@
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_token" placeholder="# # # # # #" required>
<label for="2fa_input_password">Password</label>
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" data-nonce="{{g.nonce}}" data-undisablelement="toggle2faButton" required>
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" data-nonce="{{g.nonce}}" data-undisable_element="toggle2faButton" required>
{% set action = "Enable" %}
{% else %}
<div class="alert alert-warning" role="alert">
@ -225,7 +225,7 @@
<input autocomplete="off" type="password" class="form-control mb-2" id="2fa_input_password" name="password" required>
<label for="2fa_input">6-digit code</label>
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_remove" placeholder="# # # # # #" data-nonce="{{g.nonce}}" data-undisablelement="toggle2faButton" required>
<input autocomplete="off" type="text" class="form-control mb-2" id="2fa_input" name="2fa_remove" placeholder="# # # # # #" data-nonce="{{g.nonce}}" data-undisable_element="toggle2faButton" required>
{% set action = "Disable" %}
{% endif %}
</div>

View File

@ -46,7 +46,7 @@
<form id="ban-{{deviceType}}" class="my-3 {% if u.is_suspended %}d-none{% endif %}" action="/ban_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<input type="hidden" name="formkey" value="{{v|formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisablelement="user-ban-submit-{{deviceType}}" required>
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-ban-submit-{{deviceType}}" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="alts-2-{{deviceType}}" class="custom-control-input" name="alts" value="1">
@ -60,7 +60,7 @@
<form id="shadowban-{{deviceType}}" class="my-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
<input type="hidden" name="formkey" value="{{v|formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" data-nonce="{{g.nonce}}" data-undisablelement="user-shadowban-submit-{{deviceType}}" required>
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Shadowban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-shadowban-submit-{{deviceType}}" required>
<input autocomplete="off" id="user-shadowban-submit-{{deviceType}}" type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" class="btn btn-danger" value="Shadowban user" disabled>
</form>
{% endif %}