Plugin: add password manager hints to the form

This commit is contained in:
Val Packett 2023-07-29 03:02:41 -03:00
parent bd0aefea34
commit a910fb43ba
2 changed files with 9 additions and 3 deletions

View file

@ -62,7 +62,7 @@ Formatted with `deno fmt`.
form = dm('form', { class: 'tiddlypwa-form' });
passLbl = dm('label', { innerHTML: 'Password' });
passInput = dm('input', { attributes: { type: 'password' } });
passInput = dm('input', { attributes: { type: 'password', name: 'password', autocomplete: 'current-password' } });
submit = dm('button', { attributes: { type: 'submit' }, text: 'Log in' });
feedback = dm('div', {});
@ -70,6 +70,10 @@ Formatted with `deno fmt`.
this.feedback.innerHTML = html;
}
setFresh() {
this.passInput.setAttribute('autocomplete', 'new-password');
}
showForm(empty) {
if (this.formShown) return;
this.formShown = true;
@ -107,7 +111,7 @@ Formatted with `deno fmt`.
addTokenInput(handlerFunction) {
const tokLbl = dm('label', { text: 'Sync token' });
tokLbl.appendChild(dm('input', {
attributes: { type: 'password' },
attributes: { type: 'text', name: 'username', autocomplete: 'username' },
eventListeners: [{ name: 'change', handlerFunction }],
}));
this.form.appendChild(tokLbl);
@ -123,7 +127,7 @@ Formatted with `deno fmt`.
});
const saltLbl = dm('label', { text: 'Salt' });
saltLbl.appendChild(dm('input', {
attributes: { type: 'text' },
attributes: { type: 'text', name: 'salt', autocomplete: 'off' },
eventListeners: [{ name: 'change', handlerFunction }],
}));
saltDtl.appendChild(saltLbl);

View file

@ -580,6 +580,7 @@ Formatted with `deno fmt`.
<p><strong>Make up a strong password</strong> to protect the content of the wiki.</p>
`);
askToken = false;
this.modal.setFresh();
} else if (state === 'fresh') {
this.modal.setBody(`
<p>Welcome to your new synchronized wiki!</p>
@ -587,6 +588,7 @@ Formatted with `deno fmt`.
<p>The password will be used to encrypt your data, hiding the content from the server and, if you choose not to use the "remember password" option, against unauthorized users of this device.</p>
<p>You will have to use that password to open this wiki on all synchronized devices/browsers.</p>
`);
this.modal.setFresh();
} else if (state === 'existing') {
this.modal.setBody(`
<p>Welcome back to your synchronized wiki!</p>