Run some sanity checks/validations on the private key input. Cannot save it unless the field is valid.

This commit is contained in:
Ryan Breen
2023-02-06 00:06:27 -05:00
parent 843278faef
commit 2aabd443e1
4 changed files with 22 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import {
setPermission,
KINDS,
humanPermission,
validateKey,
} from './utils';
const log = console.log;
@@ -258,6 +259,16 @@ Alpine.data('options', () => ({
this.profileName !== this.pristineProfileName
);
},
get validKey() {
return validateKey(this.privKey);
},
get validKeyClass() {
return this.validKey
? ''
: 'ring-2 ring-rose-500 focus:ring-2 focus:ring-rose-500 border-transparent focus:border-transparent';
},
}));
Alpine.start();