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

Make username validation compatible with fbgive #64

Open
deckar01 opened this issue Jan 13, 2015 · 0 comments
Open

Make username validation compatible with fbgive #64

deckar01 opened this issue Jan 13, 2015 · 0 comments
Assignees
Labels

Comments

@deckar01
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants