add js UX for pass entry

This commit is contained in:
blek 2023-10-27 01:13:46 +10:00 committed by blek! Git
parent c8e7a66398
commit b82e630b65
1 changed files with 27 additions and 2 deletions

View File

@ -9,6 +9,31 @@
{% endblock %} {% endblock %}
{% block scripts %}
{%- if conf.files.upload_pass.is_some() -%}
{#- Script to disable button when password is not entered -#}
{#- -#}<script>
{#- -#} (
{#- -#} ()=>{
{#- -#} const pass_inp=document.getElementById("instancepass");
{#- -#} const submit=document.getElementById("bfile-upload-submit");
{#- -#} submit.setAttribute('disabled',true);
{#- -#}
{#- -#} pass_inp.onchange=()=>{
{#- -#} if(pass_inp.value.length==0)
{#- -#} submit.setAttribute('disabled',true);
{#- -#} else submit.removeAttribute('disabled')
{#- -#} }
{#- -#} }
{#- -#} )()
{#- -#}</script>
{%- endif -%}
{% endblock %}
{% block body %} {% block body %}
<div style="max-width:95vw;width:fit-content;margin:0 auto"> <div style="max-width:95vw;width:fit-content;margin:0 auto">
@ -125,7 +150,7 @@
<p> <p>
<label> <label>
Password: Password:
<input type="password" name="instancepass"> <input type="password" name="instancepass" id="instancepass">
</label> </label>
</p> </p>
</div> </div>
@ -160,7 +185,7 @@
</label> </label>
</p> </p>
<p> <p>
<button class='btn btn-fill'> <button class='btn btn-fill' id="bfile-upload-submit">
Upload! Upload!
</button> </button>
</p> </p>