I want to have a condition where when a user clicks a link to download a file it will ask for a password after which the file can be downloaded(if it is right). I am pretty basic in JS and I want to try this for my Flask app deployed at Heroku. I just don't know how to implement it.
So this is what I have come up with so far:
<main class="page projects-page">
<section class="portfolio-block projects-cards">
<div class="container">
<div class="heading">
<h2>Test download</h2>
</div>
<div class="row">
<div class="col-md-6 col-lg-4">
<div class="card border-0"></div>
</div>
<div class="col-md-6 col-lg-4">
<div class="card border-0"><a href="#"></a>
<div class="card-body">
<h6><a href="#">To download the file enter the SECRET_KEY</a></h6><input type="password"></div>
</div><button class="btn btn-primary d-block float-none" type="submit" style="width: 349.984px;">DOWNLOAD </button></div>
<div class="col-md-6 col-lg-4">
<div class="card border-0"></div>
</div>
<div class="col-md-6 col-lg-4">
<div class="card border-0"><a href="#"></a>
<div class="card-body"></div>
</div>
</div>
</div>
</div>
</section>
</main>
This is the part of the code where the user types the password and if correct the file should be downloaded. Can this be done with a simple JS function where the password field and button are enclosed in a form element and compared or should I use another method?