Min Password Length vs Block Common Passwords

My bet there is that the client-side validation is counting octets, whereas the server, being Unicode-aware, is counting characters, and coming up with a different result.

1 « J'aime »

Characters in that codeblock (and indeed all of U+1xxxx) are four-octets long in UTF-8. I don’t know what it’s counting, but Unicode 7/Unicode 8 issues (like amphora) could be in play.

Taking the string " :slight_smile: " as an example, javascript says

"😀".length = 2

and Ruby says

"😀".length = 1

Which is the correct implementation here? @codinghorror's blog post says:

because it’s nice and simple for users. So :slight_smile: is one character. That sounds reasonable to me.

However… the blog also says

This is indeed true of the Discourse password fields - one emoji = 2 characters. So if it’s showing as 2 characters in the password field, surely that should count as 2 characters in a password :confounded:


On a related note, it is currently very difficult to type emojis directly into html password inputs - you can only copy/paste them in. This is the case on Chrome on mac (using system emoji window), and also Safari on iOS (the emoji button doesn’t even show up with the password field focused). So, as much as I try, I can’t use :white_check_mark: :horse: :battery: :paperclip: as my password on Discourse (without cheating with copy/paste).

2 « J'aime »

😀 is four octets in UTF-8: Base64 visualizer

I have no idea why Javascript gets that count. (UTF-16?) But 😀 does show as ⏺⏺ in the password field of Discourse (for me).

3 « J'aime »

It would appear so (from here)

3 « J'aime »

A sentence with spaces - could be the best personal password choice

I’m not sure a space would work. It’s a control character and there might be some filters somewhere that wouldn’t like it.

A space is absolutely fine, it’s just another character as far as a password is concerned. Try it here on meta - it works.

4 « J'aime »

Je teste à nouveau, maintenant que je sais que mon gestionnaire de mots de passe est :amphora: sécurisé. La même chose se produit : suffisamment d’émojis pour obtenir un « OK » vert ne suffit pas pour que cela fonctionne réellement. Et alors que j’essayais des mots de passe de plus en plus longs, de manière itérative, cela m’a déconnecté, je pense à la troisième tentative. Lorsque j’ai réussi à le définir sur un mot de passe de :ten: émojis, j’ai toujours vu un message « vous avez été déconnecté » clignoter, mais cela ne m’a pas réellement déconnecté.

Je ne sais pas si cette déconnexion est un bug spécifique aux émojis ou une fonctionnalité mal conçue (ou du moins peu utile). Si c’est une fonctionnalité, veuillez faire en sorte que la boîte « vous avez été déconnecté » explique pourquoi.

Oui, cela est dû à l’héritage de JavaScript qui l’empêche de compter correctement la longueur des chaînes contenant des émojis (et d’autres caractères du plan astral). Le serveur compte la longueur correctement.

2 « J'aime »