mirror of
https://github.com/quantum5/correcthorsebatterystaple.git
synced 2025-07-26 19:44:12 -04:00
Generate a password on load
This commit is contained in:
parent
8a3d1f1d85
commit
ab7e4d0138
13
src/ui.js
13
src/ui.js
|
@ -55,15 +55,17 @@ $(() => {
|
||||||
updateBitMeter()
|
updateBitMeter()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.crypto && window.crypto.getRandomValues) {
|
function generatePassword () {
|
||||||
$('#too-old').hide()
|
|
||||||
|
|
||||||
$('#run-generator').click(() => {
|
|
||||||
const options = $options.serializeObject()
|
const options = $options.serializeObject()
|
||||||
$output.text(generate(options)).removeClass('placeholder')
|
$output.text(generate(options)).removeClass('placeholder')
|
||||||
$('#copy-password').prop('disabled', false)
|
$('#copy-password').prop('disabled', false)
|
||||||
return false
|
return false
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if (window.crypto && window.crypto.getRandomValues) {
|
||||||
|
$('#too-old').hide()
|
||||||
|
|
||||||
|
$('#run-generator').click(generatePassword)
|
||||||
|
|
||||||
$('#save-settings').click(() => {
|
$('#save-settings').click(() => {
|
||||||
const options = $options.serializeObject()
|
const options = $options.serializeObject()
|
||||||
|
@ -80,6 +82,7 @@ $(() => {
|
||||||
$options.find('select, input').change(updateBitMeter)
|
$options.find('select, input').change(updateBitMeter)
|
||||||
$options.find('input[type=number]').on('input', updateBitMeter)
|
$options.find('input[type=number]').on('input', updateBitMeter)
|
||||||
updateBitMeter()
|
updateBitMeter()
|
||||||
|
generatePassword()
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = window.localStorage.getItem('settings')
|
const settings = window.localStorage.getItem('settings')
|
||||||
|
|
Loading…
Reference in a new issue