Validate the uniqueness of the given username

@api private
@param {String} value - The username to check for uniqueness
@param {Function} respond - The callback function
8901
function validateUniqueName(value, respond) {
  // jshint validthis: true
  var self = this;

  // check for uniqueness of user name
  this.constructor.findOne({name: value}, function (err, user) {
    if (err) {
      throw err;
    }

    if (user) {
      // the searched name is my name or a duplicate
      return respond(self.id === user.id);
    }

    respond(true);
  });
}
209983
function tokenExists(username, token, done) {
  return getTokenHashes(username, function(getTokensErr, hashes) {
    if (getTokensErr) {
      return done(getTokensErr);
    }

    if (!hashes || !hashes.length) {
      return done(null, false);
    }

    let index = 0;
    let found = false;

    async.until(() => found || (index >= hashes.length), function(next) {
      bcrypt.compare(token, hashes[index++].uuid, function(err, match) {
        found = match;
        return next(err);
      });
    }, (err) => done(err, found ? hashes[index - 1] : undefined));
  });
}
1155517
function standardize(value) {
  var isString = _.isString(value);
  value = utils.standardizeInput(value);
  return (isString && value === null) ? "" : value;
}
534548
def validate_unique_items(value, **kwargs):
    
    # we can't just look at the items themselves since 0 and False are treated
    # the same as dictionary keys, and objects aren't hashable.

    counter = collections.Counter((
        json.dumps(v, sort_keys=True) for v in value
    ))
    dupes = [json.loads(v) for v, count in counter.items() if count > 1]
    if dupes:
        raise ValidationError(
            MESSAGES['unique_items']['invalid'].format(
                repr(dupes),
            ),
        )
677245
function( name, value ) {
					if ( completed == null ) {
						name = requestHeadersNames[ name.toLowerCase() ] =
							requestHeadersNames[ name.toLowerCase() ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				}
143063
function(i,value){
           if(!value) return;
           var i = i || 1,message = "";
           while(true){
            message += value;
            if((--i) <= 0) break;
          }

          return message;
    }
10034
def validate_username_for_new_account(person, username):
    

    # This is much the same as validate_username_for_new_person, except
    # we don't care if the username is used by the person owning the account

    # is the username valid?

    validate_username(username)

    # Check for existing people

    query = Person.objects.filter(username__exact=username)
    count = query.exclude(pk=person.pk).count()
    if count >= 1:
        raise UsernameTaken(six.u(
            'The username is already taken. Please choose another. '
            'If this was the name of your old account please email %s')
            % settings.ACCOUNTS_EMAIL)

    # Check for existing accounts not belonging to this person

    query = Account.objects.filter(username__exact=username)
    count = query.exclude(person__pk=person.pk).count()
    if count >= 1:
        raise UsernameTaken(six.u(
            'The username is already taken. Please choose another. '
            'If this was the name of your old account please email %s')
            % settings.ACCOUNTS_EMAIL)

    # Check datastore, in case username created outside Karaage.
    # Make sure we don't count the entry for person.

    query = Person.objects.filter(username__exact=username)
    count = query.filter(pk=person.pk).count()
    if count == 0 and account_exists(username):
        raise UsernameTaken(
            six.u('Username is already in external personal datastore.'))
802031
def username(self, value):
        """"""
        if isinstance(value, str):
            self._username = value
            self._handler = None
821707
def username(self, value):
        
        self._username = value
        self._connectionXML.set('username', value)
203117
function(name, value){
			var voc = this.getVocabulary('user') || {};
			if (!('variables' in voc))
				voc.variables = {};

			voc.variables[name] = value;
			this.setVocabulary(voc, 'user');
		}
646935
private String validateAuthn(String value) {
        // for now, if we got here we're validating an authnToken
        String result = null;
        String valueLower = value.toLowerCase();
        do {
            if (valueLower.equals("saml")) {
                result = JAXRSClientConstants.SAML_HANDLER;
                break;
            }
            if (valueLower.equals("oauth")) {
                result = JAXRSClientConstants.OAUTH_HANDLER;
                break;
            }
            if (valueLower.equals("ltpa")) {
                result = JAXRSClientConstants.LTPA_HANDLER;
            }
        } while (false);
        if (result == null) {
            Tr.warning(tc, "warn.invalid.authorization.token.type", value); // CWWKW0061W
        }
        return result;
    }
487378
public final void setUserid(String value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setUserid", value);
        getApi().setField(JsApiAccess.USERID, value);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setUserid");
    }
253422
def validate_value(self, value):
        
        super(UserGroupField, self).validate_value(value)

        if value is not None:
            # Ignore validation if all users + groups are allowed
            if self._show_all_groups and self._show_all_users:
                return

            # Try to directly check allowed ids against user/group id first to avoid having to resolve generic
            # UserGroup with an additional request
            if value.id in self._allowed_user_ids | self._allowed_group_ids:
                return

            # Resolve to check Users vs Groups separately
            value = value.resolve()

            if isinstance(value, User):
                self._validate_user(value)
            else:
                self._validate_group(value)
245269
function(value) 
	{
		if (value == undefined) return conbo.identity;
		if (conbo.isFunction(value)) return value;
		return conbo.property(value);
	}
131239
def unique(self, e, **kwargs):
        
        if not isinstance(e, claripy.ast.Base):
            return True

        # if we don't want to do symbolic checks, assume symbolic variables are multivalued
        if o.SYMBOLIC not in self.state.options and self.symbolic(e):
            return False

        r = self.eval_upto(e, 2, **kwargs)
        if len(r) == 1:
            self.add(e == r[0])
            return True
        elif len(r) == 0:
            raise SimValueError("unsatness during uniqueness check(ness)")
        else:
            return False
668789
def name(self, value):
        
        if not isinstance(value, six.string_types):
            raise ValueError("Pass a string")
        self._properties["id"] = value
931418
function username(value, fromIndex) {
  var index = fromIndex
  var length = value.length
  var size

  /* First character of username cannot be a dash. */
  if (value.charCodeAt(index) === CC_DASH) {
    return -1
  }

  while (index < length) {
    if (!usernameCharacter(value.charCodeAt(index))) {
      break
    }

    index++
  }

  size = index - fromIndex

  /* Last character of username can no longer be a dash, but could be (GH-13). */
  if (!size || size > MAX_USER_LENGTH) {
    return -1
  }

  return index
}