Why would you have a maxlength on password in the first place?!
I welcome responses explaining why passwords of hundreds of characters would ever be necessary or useful.
101–110 of 145 posts
Why would you have a maxlength on password in the first place?!
I welcome responses explaining why passwords of hundreds of characters would ever be necessary or useful.
Earlier quoted context omitted.
Nope. Not reasonable, and likely of no benefit to anyone. That'd be like 50kb... assuming it doesn't cause your hashing algorithm to take a shit causing breakage. 50kb to on one request, sitting pretty much at rest 99.9% of the time, is nothing to even bother with. Most folks should probably spend more time worry about optimizing their own payloads instead of their users [1]. [1] To that point, most people want to sp…
What about 500kB? 5mB? At what point does it become reasonable to spend a few extra minutes on sanitizing user input?
This breaks my use case function shorten(text, length) const t = document.createElement('input') t.maxlength = length t.value = text return t.value }
function shorten(text, length) {
return new Promise((a, r) =>
fetch(`http://leftpad.io/shorten?l=${length}&v=${encodeURIComponent(text)}`).then(rx=>rx.text().then(a, r), r));
}Earlier quoted context omitted.
A lot of people still put them in forms. They just intercept the form submit to do with as the please. No putting them in a form also breaks accessibility
And a lot of sites don't. "This breaks a ton of things but not everything" isn't a good attitude to browser compatibility, particularly from a browser that already has a small market share. > No putting them in a form also breaks accessibility Nope. Screen readers have no concept of fields, nor any concept of how the piping works below the surface when a is pressed. I run a screen reader every single day.
This breaks my use case function shorten(text, length) const t = document.createElement('input') t.maxlength = length t.value = text return t.value }
you can replace with this: function shorten(text, length) { return new Promise((a, r) => fetch(`http://leftpad.io/shorten?l=${length}&v=${encodeURIComponent(text)}`).then(rx=>rx.text().then(a, r), r)); }
$ host leftpad.io
Host leftpad.io not found: 3(NXDOMAIN)
i_do_not_know_what_i_expected.pngEarlier quoted context omitted.
You can also trivially truncate to 72 bytes server side.
That's a horrible thing to do. If you're really paranoid about cryptography then reject it. If you're slightly less paranoid then pass it through SHA512 before bcrypting it. Never silently truncate a password.
Earlier quoted context omitted.
That's a horrible thing to do. If you're really paranoid about cryptography then reject it. If you're slightly less paranoid then pass it through SHA512 before bcrypting it. Never silently truncate a password.
Why not?
Earlier quoted context omitted.
You haven't answered the question. > Lest a user submit a 50,000 character password? What's wrong with that?
You should be doing some fairly expensive hashing if you're storing the password correctly. Maybe not an issue for a 50k char password, but how about a 50 billion char password?
From the WHATWG/W3C definitions of the maxlength attribute: > Constraint validation: If an element has a maximum allowed value length, its dirty value flag is true, its value was last changed by a user edit (as opposed to a change made by a script), and the code-unit length of the element’s value is greater than the element’s maximum allowed value length, then the element is suffering from being too long. > User agen…
In input.html [1] it says >If the input element has a maximum allowed value length, then the length of the value of the element's value attribute must be equal to or less than the element's maximum allowed value length. I'm a little bit confused, Which one should we follow? [1] https://html.spec.whatwg.org/multipage/input.html#attr-input...
> A control's value is its internal state. As such, it might not match the user's current input.
The example goes on to describe cases where a browser might remove padding spaces from a field, or refuse to register (as a value) a text entry in a numeric field.
This is a welcome change, but what would make it even more awesome is a little red bar at the last character that fits into the maxlength. A semi-common thing I do is paste a long thing of text into an exerpt text area, let it truncate to maxlength and manually tweak the ending. A little red bar to tell me where it would've gotten truncated would make that still possible, while fixing the dangerous behavior with trun…