25 lines
929 B
JavaScript
25 lines
929 B
JavaScript
import { sendFormAsync } from "./shared.js";
|
|
|
|
async function signupAsync(params) {
|
|
const form = document.getElementById('signupForm');
|
|
await sendFormAsync(form);
|
|
}
|
|
|
|
function togglePassword() {
|
|
const passwordInput = document.getElementById('password');
|
|
const togglePasswordButton = document.getElementById('togglePassword');
|
|
const newInputType = passwordInput.type === 'password' ? 'text' : 'password';
|
|
passwordInput.type = newInputType;
|
|
const isVisible = newInputType === 'text';
|
|
togglePasswordButton.textContent = isVisible ? 'Hide' : 'Show';
|
|
togglePasswordButton.setAttribute('aria-pressed', String(isVisible));
|
|
}
|
|
|
|
document.getElementById('togglePassword')?.addEventListener('click', togglePassword);
|
|
|
|
const signupForm = document.getElementById('signupForm');
|
|
signupForm.addEventListener('submit', async (event) => {
|
|
event.preventDefault(); // Prevent the default form submission
|
|
await signupAsync();
|
|
});
|