Wire up the form to call the password generation function

parent 71ea9b9d
Pipeline #746 failed with stages
......@@ -25,18 +25,33 @@
<body>
<h1>Hypha Aspect Setup Spike 1</h1>
<form>
<form id='passwordForm'>
<fieldset>
<label>Choose a password:</label>
<input id='password'>
<button type='submit'>Submit</button>
<button id='submit' type='submit'>Submit</button>
</fieldset>
</form>
<script>
// Generate keys from password
function generateKeysFromPassword(password) {
console.log(`Generate keys from password: ${password}`)
}
// Main
document.addEventListener('DOMContentLoaded', () => {
document.getElementById('password').focus()
document.getElementById('passwordForm').addEventListener('submit', (event) => {
const form = event.target
const password = form.elements.password.value
generateKeysFromPassword(password)
event.preventDefault()
})
})
</script>
</body>
</html>
\ No newline at end of file
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment