Made the 'show password' button work

This commit is contained in:
firefuture 2024-09-29 20:11:18 -05:00
parent 91543c8a79
commit 8a9a6b6aae
2 changed files with 19 additions and 3 deletions

View file

@ -13,15 +13,15 @@
<form method = "post"> <form method = "post">
<div class="mb-3"> <div class="mb-3">
<label for="exampleInputEmail1" class="form-label">Email address</label> <label for="exampleInputEmail1" class="form-label">Email address</label>
<input type="email" name="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp"> <input type="email" name="email" class="form-control" id="email" aria-describedby="emailHelp">
<div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div> <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="exampleInputPassword1" class="form-label">Password</label> <label for="exampleInputPassword1" class="form-label">Password</label>
<input type="password" name="password" class="form-control" id="exampleInputPassword1"> <input type="password" name="password" class="form-control" id="password">
</div> </div>
<div class="mb-3 form-check"> <div class="mb-3 form-check">
<input type="checkbox" class="form-check-input" id="exampleCheck1"> <input type="checkbox" class="form-check-input" id="exampleCheck1" onclick="showPass()">
<label class="form-check-label" for="exampleCheck1">Show Password</label> <label class="form-check-label" for="exampleCheck1">Show Password</label>
</div> </div>
<input type="submit" class="btn btn-primary" value="Submit"> <input type="submit" class="btn btn-primary" value="Submit">
@ -30,5 +30,6 @@
</div> </div>
</form> </form>
</div> </div>
<script src="login.js"></script>
</body> </body>
</html> </html>

15
static/login.js Normal file
View file

@ -0,0 +1,15 @@
const email = document.getElementById("email");
const emailHelp = document.getElementById("emailHelp");
const emailRegex = /^[^\s@]+@my\.utsa\.edu$/;
const password = document.getElementById("password");
const passwordHelp = document.getElementById("passwordHelp");
const passwordRegex = /^.{8,}$/;
function showPass(){
if(password.type === "password"){
password.type = "text";
}
else{
password.type = "password";
}
}