Skip to content
This repository was archived by the owner on Jun 25, 2024. It is now read-only.
This repository was archived by the owner on Jun 25, 2024. It is now read-only.

Make username validation compatible with fbgive #64

Description

@deckar01
var validLength = value.length >= 3 && value.length <= 255;
var validEmail  = validator.isEmail(value);

https://github.com/stellar/stellar-wallet/blob/master/lib/util/validate.js#L92

  • This does not properly validate that use username is at least 3 characters, because the "@stellar.org" has already been added.
  • The max length should certainly not be 255, because this allows usernames that are valid addresses.

I think we should stick with the validation in ix. I don't see any reason that the username should have to pass the RFC spec for email addresses. The rules are too arbitrary given our restrictions and too hard to explain to users when they are violated.

/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))$/i

https://github.com/chriso/validator.js/blob/master/validator.js#L38

  1. A username is composed of both a user and domain parts, separated by an "@"
  2. Each part of a username must be between 3-20 characters, and validate against the regex: "/^[a-zA-Z0-9]+([._-]+[a-zA-Z0-9]+)*$/"

https://github.com/stellar/ix/issues/410#issuecomment-65481036

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions