do not use input type=email for email addresses

despite the name, it doesn't actually check for valid email addresses:
it doesn't allow non-ascii localparts, accepts various invalid localparts, and
rejects various valid localparts. no point in using it.
This commit is contained in:
Mechiel Lukkien 2024-04-11 23:45:47 +02:00
parent 606b915447
commit ad8c5616b1
No known key found for this signature in database
2 changed files with 9 additions and 2 deletions

View file

@ -1779,7 +1779,11 @@ const accounts = async () => {
e.stopPropagation();
await check(fieldset, client.AccountAdd(account.value, email.value));
window.location.hash = '#accounts/' + account.value;
}, fieldset = dom.fieldset(dom.label(style({ display: 'inline-block' }), dom.span('Email address', attr.title('The initial email address for the new account. More addresses can be added after the account has been created.')), dom.br(), email = dom.input(attr.type('email'), attr.required(''), function keyup() {
}, fieldset = dom.fieldset(dom.label(style({ display: 'inline-block' }), dom.span('Email address', attr.title('The initial email address for the new account. More addresses can be added after the account has been created.')), dom.br(),
// Cannot use type=email, it doesn't actually check for valid email addresses,
// rejecting any non-ascii localpart, accepting some invalid addresses, and
// rejecting other valid addresses. https://github.com/whatwg/html/issues/4562
email = dom.input(attr.required(''), function keyup() {
if (!accountModified) {
account.value = email.value.split('@')[0];
}

View file

@ -540,7 +540,10 @@ const accounts = async () => {
style({display: 'inline-block'}),
dom.span('Email address', attr.title('The initial email address for the new account. More addresses can be added after the account has been created.')),
dom.br(),
email=dom.input(attr.type('email'), attr.required(''), function keyup() {
// Cannot use type=email, it doesn't actually check for valid email addresses,
// rejecting any non-ascii localpart, accepting some invalid addresses, and
// rejecting other valid addresses. https://github.com/whatwg/html/issues/4562
email=dom.input(attr.required(''), function keyup() {
if (!accountModified) {
account.value = email.value.split('@')[0]
}