mirror of
https://codeberg.org/valpackett/tiddlypwa.git
synced 2025-12-06 02:30:48 -08:00
Plugin: handle salt input more carefully, fixes #16
This commit is contained in:
parent
777aa2d54f
commit
bd0aefea34
1 changed files with 13 additions and 4 deletions
|
|
@ -608,12 +608,21 @@ Formatted with `deno fmt`.
|
|||
}
|
||||
if (askSalt) {
|
||||
this.modal.addSaltInput((e) => {
|
||||
try {
|
||||
this.salt = b64dec(e.target.value.trim());
|
||||
const saltText = e.target.value.trim();
|
||||
if (saltText.length == 0) {
|
||||
this.salt = null;
|
||||
this.modal.setFeedback('');
|
||||
} else if (saltText.length < 16) {
|
||||
this.salt = null;
|
||||
this.modal.setFeedback('<p class=tiddlypwa-form-error>The salt is too short</p>');
|
||||
} else {
|
||||
try {
|
||||
this.salt = b64dec(saltText);
|
||||
} catch (_e) {
|
||||
this.salt = null;
|
||||
this.modal.setFeedback('<p class=tiddlypwa-form-error>Could not decode the salt</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
this.modal.showForm();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue