Disable secret creation when secret is empty

fixes #86

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2023-06-09 22:21:40 +02:00
parent 413ad347e4
commit 3bc73a617d
No known key found for this signature in database
GPG Key ID: D91C3E91E4CAD6F5

View File

@ -90,6 +90,7 @@
/>
</b-form-group>
<b-button
:disabled="secret.trim().length < 1"
variant="success"
@click="createSecret"
>
@ -215,6 +216,10 @@ export default {
methods: {
// createSecret executes the secret creation after encrypting the secret
createSecret() {
if (this.secret.trim().length < 1) {
return false
}
this.securePassword = [...window.crypto.getRandomValues(new Uint8Array(passwordLength))]
.map(n => passwordCharset[n % passwordCharset.length])
.join('')