prevent firefox from autocompleting the current password in the form/fields for changing password

This commit is contained in:
Mechiel Lukkien 2024-01-05 12:15:55 +01:00
parent 9796c4539d
commit c348834ce9
No known key found for this signature in database
8 changed files with 12 additions and 6 deletions

1
lib.ts
View file

@ -213,6 +213,7 @@ const attr = {
max: (s: string) => _attr('max', s), max: (s: string) => _attr('max', s),
action: (s: string) => _attr('action', s), action: (s: string) => _attr('action', s),
method: (s: string) => _attr('method', s), method: (s: string) => _attr('method', s),
autocomplete: (s: string) => _attr('autocomplete', s),
} }
const style = (x: {[k: string]: string | number}) => { return {_styles: x}} const style = (x: {[k: string]: string | number}) => { return {_styles: x}}
const prop = (x: {[k: string]: any}) => { return {_props: x}} const prop = (x: {[k: string]: any}) => { return {_props: x}}

View file

@ -217,6 +217,7 @@ const [dom, style, attr, prop] = (function () {
max: (s) => _attr('max', s), max: (s) => _attr('max', s),
action: (s) => _attr('action', s), action: (s) => _attr('action', s),
method: (s) => _attr('method', s), method: (s) => _attr('method', s),
autocomplete: (s) => _attr('autocomplete', s),
}; };
const style = (x) => { return { _styles: x }; }; const style = (x) => { return { _styles: x }; };
const prop = (x) => { return { _props: x }; }; const prop = (x) => { return { _props: x }; };
@ -913,9 +914,9 @@ const index = async () => {
finally { finally {
fullNameFieldset.disabled = false; fullNameFieldset.disabled = false;
} }
}), dom.br(), dom.h2('Addresses'), dom.ul(Object.entries(destinations).sort().map(t => dom.li(dom.a(t[0], attr.href('#destinations/' + t[0])), t[0].startsWith('@') ? ' (catchall)' : []))), dom.br(), dom.h2('Change password'), passwordForm = dom.form(passwordFieldset = dom.fieldset(dom.label(style({ display: 'inline-block' }), 'New password', dom.br(), password1 = dom.input(attr.type('password'), attr.required(''), function focus() { }), dom.br(), dom.h2('Addresses'), dom.ul(Object.entries(destinations).sort().map(t => dom.li(dom.a(t[0], attr.href('#destinations/' + t[0])), t[0].startsWith('@') ? ' (catchall)' : []))), dom.br(), dom.h2('Change password'), passwordForm = dom.form(passwordFieldset = dom.fieldset(dom.label(style({ display: 'inline-block' }), 'New password', dom.br(), password1 = dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required(''), function focus() {
passwordHint.style.display = ''; passwordHint.style.display = '';
})), ' ', dom.label(style({ display: 'inline-block' }), 'New password repeat', dom.br(), password2 = dom.input(attr.type('password'), attr.required(''))), ' ', dom.submitbutton('Change password')), passwordHint = dom.div(style({ display: 'none', marginTop: '.5ex' }), dom.clickbutton('Generate random password', function click(e) { })), ' ', dom.label(style({ display: 'inline-block' }), 'New password repeat', dom.br(), password2 = dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required(''))), ' ', dom.submitbutton('Change password')), passwordHint = dom.div(style({ display: 'none', marginTop: '.5ex' }), dom.clickbutton('Generate random password', function click(e) {
e.preventDefault(); e.preventDefault();
let b = new Uint8Array(1); let b = new Uint8Array(1);
let s = ''; let s = '';

View file

@ -348,7 +348,7 @@ const index = async () => {
style({display: 'inline-block'}), style({display: 'inline-block'}),
'New password', 'New password',
dom.br(), dom.br(),
password1=dom.input(attr.type('password'), attr.required(''), function focus() { password1=dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required(''), function focus() {
passwordHint.style.display = '' passwordHint.style.display = ''
}), }),
), ),
@ -357,7 +357,7 @@ const index = async () => {
style({display: 'inline-block'}), style({display: 'inline-block'}),
'New password repeat', 'New password repeat',
dom.br(), dom.br(),
password2=dom.input(attr.type('password'), attr.required('')), password2=dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required('')),
), ),
' ', ' ',
dom.submitbutton('Change password'), dom.submitbutton('Change password'),

View file

@ -217,6 +217,7 @@ const [dom, style, attr, prop] = (function () {
max: (s) => _attr('max', s), max: (s) => _attr('max', s),
action: (s) => _attr('action', s), action: (s) => _attr('action', s),
method: (s) => _attr('method', s), method: (s) => _attr('method', s),
autocomplete: (s) => _attr('autocomplete', s),
}; };
const style = (x) => { return { _styles: x }; }; const style = (x) => { return { _styles: x }; };
const prop = (x) => { return { _props: x }; }; const prop = (x) => { return { _props: x }; };
@ -1850,7 +1851,7 @@ const account = async (name) => {
finally { finally {
fieldsetLimits.disabled = false; fieldsetLimits.disabled = false;
} }
}), dom.br(), dom.h2('Set new password'), formPassword = dom.form(fieldsetPassword = dom.fieldset(dom.label(style({ display: 'inline-block' }), 'New password', dom.br(), password = dom.input(attr.type('password'), attr.required(''), function focus() { }), dom.br(), dom.h2('Set new password'), formPassword = dom.form(fieldsetPassword = dom.fieldset(dom.label(style({ display: 'inline-block' }), 'New password', dom.br(), password = dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required(''), function focus() {
passwordHint.style.display = ''; passwordHint.style.display = '';
})), ' ', dom.submitbutton('Change password')), passwordHint = dom.div(style({ display: 'none', marginTop: '.5ex' }), dom.clickbutton('Generate random password', function click(e) { })), ' ', dom.submitbutton('Change password')), passwordHint = dom.div(style({ display: 'none', marginTop: '.5ex' }), dom.clickbutton('Generate random password', function click(e) {
e.preventDefault(); e.preventDefault();

View file

@ -757,7 +757,7 @@ const account = async (name: string) => {
style({display: 'inline-block'}), style({display: 'inline-block'}),
'New password', 'New password',
dom.br(), dom.br(),
password=dom.input(attr.type('password'), attr.required(''), function focus() { password=dom.input(attr.type('password'), attr.autocomplete('new-password'), attr.required(''), function focus() {
passwordHint.style.display = '' passwordHint.style.display = ''
}), }),
), ),

View file

@ -217,6 +217,7 @@ const [dom, style, attr, prop] = (function () {
max: (s) => _attr('max', s), max: (s) => _attr('max', s),
action: (s) => _attr('action', s), action: (s) => _attr('action', s),
method: (s) => _attr('method', s), method: (s) => _attr('method', s),
autocomplete: (s) => _attr('autocomplete', s),
}; };
const style = (x) => { return { _styles: x }; }; const style = (x) => { return { _styles: x }; };
const prop = (x) => { return { _props: x }; }; const prop = (x) => { return { _props: x }; };

View file

@ -217,6 +217,7 @@ const [dom, style, attr, prop] = (function () {
max: (s) => _attr('max', s), max: (s) => _attr('max', s),
action: (s) => _attr('action', s), action: (s) => _attr('action', s),
method: (s) => _attr('method', s), method: (s) => _attr('method', s),
autocomplete: (s) => _attr('autocomplete', s),
}; };
const style = (x) => { return { _styles: x }; }; const style = (x) => { return { _styles: x }; };
const prop = (x) => { return { _props: x }; }; const prop = (x) => { return { _props: x }; };

View file

@ -217,6 +217,7 @@ const [dom, style, attr, prop] = (function () {
max: (s) => _attr('max', s), max: (s) => _attr('max', s),
action: (s) => _attr('action', s), action: (s) => _attr('action', s),
method: (s) => _attr('method', s), method: (s) => _attr('method', s),
autocomplete: (s) => _attr('autocomplete', s),
}; };
const style = (x) => { return { _styles: x }; }; const style = (x) => { return { _styles: x }; };
const prop = (x) => { return { _props: x }; }; const prop = (x) => { return { _props: x }; };