21 lines
733 B
JavaScript
21 lines
733 B
JavaScript
import { sendFormAsync } from "./shared.js";
|
|
|
|
function togglePassword() {
|
|
const passwordInput = document.getElementById('password');
|
|
const newInputType = passwordInput.type === 'password' ? 'text' : 'password';
|
|
passwordInput.type = newInputType;
|
|
}
|
|
|
|
async function submitLoginForm(){
|
|
const form = document.getElementById('loginForm');
|
|
await sendFormAsync(form);
|
|
}
|
|
|
|
|
|
const togglePasswordButton = document.getElementById('togglePassword');
|
|
togglePasswordButton.addEventListener('click', togglePassword);
|
|
const loginForm = document.getElementById('loginForm');
|
|
loginForm.addEventListener('submit', async (event) => {
|
|
event.preventDefault(); // Prevent the default form submission
|
|
await submitLoginForm();
|
|
}); |