This method validates if the user object is valid. A user is valid if
 username and password exist OR oauth integration exists.
1372
def valid_user
      if (self.username.blank? || self.password_digest.blank?) &&
          (self.oauth_provider.blank? || self.oauth_uid.blank?)
        errors.add(:username, " and password OR oauth must be specified")
      end
    end
435522
def valid?
      return false if @id.nil?
      return false if @name.nil?
      authenticator_validator = EnumAttributeValidator.new('String', ["local", "ldap"])
      return false unless authenticator_validator.valid?(@authenticator)
      return true
    end
1139968
def validate_username(username):
    

    # Check username looks ok

    if not username.islower():
        raise UsernameInvalid(six.u('Username must be all lowercase'))
    if len(username) < 2:
        raise UsernameInvalid(six.u('Username must be at least 2 characters'))
    if not username_re.search(username):
        raise UsernameInvalid(settings.USERNAME_VALIDATION_ERROR_MSG)

    return username
256707
void validate() throws ApplicationUnavailableException,
			AuthenticationException {
		V1ConnectionValidator validator = new V1ConnectionValidator(
				applicationPath, username, password, proxySettings);

		for (String key : customHttpHeaders.keySet()) {
			validator.getCustomHttpHeaders().put(key,
					customHttpHeaders.get(key));
		}

		try {
			validator.checkConnection();
		} catch (ConnectionException e) {
			throw new ApplicationUnavailableException(
					"Unable to connect to VersionOne.", e);
		}

		try {
			validator.checkAuthentication();
		} catch (ConnectionException e) {
			throw new AuthenticationException("Invalid username or password.",
					e);
		}
	}
629629
def _check_users(users):

    ''''''

    messg = ''
    valid = True

    for user, user_details in six.iteritems(users):
        if not user_details:
            valid = False
            messg += 'Please provide details for username {user}.\n'.format(user=user)
            continue
        if not (isinstance(user_details.get('level'), int) or 0 <= user_details.get('level') <= 15):
            # warn!
            messg += 'Level must be a integer between 0 and 15 for username {user}. Will assume 0.\n'.format(user=user)

    return valid, messg
548219
private boolean validateCredentials() {
        LOGGER.debug("Validating credentials for: " + username);
        final LdapConnectionWrapper ldap = new LdapConnectionWrapper();
        DirContext dirContext = null;
        LdapContext ldapContext = null;
        try (AlpineQueryManager qm = new AlpineQueryManager()) {
            final LdapUser ldapUser = qm.getLdapUser(username);
            if (ldapUser != null && ldapUser.getDN() != null && ldapUser.getDN().contains("=")) {
                ldapContext = ldap.createLdapContext(ldapUser.getDN(), password);
                LOGGER.debug("The supplied credentials are valid for: " + username);
                return true;
            } else {
                dirContext = ldap.createDirContext();
                final SearchResult result = ldap.searchForSingleUsername(dirContext, username);
                if (result != null ) {
                    ldapContext = ldap.createLdapContext(result.getNameInNamespace(), password);
                    LOGGER.debug("The supplied credentials are invalid for: " + username);
                    return true;
                }
            }
        } catch (NamingException e) {
            LOGGER.debug("An error occurred while attempting to validate credentials", e);
        } finally {
            ldap.closeQuietly(ldapContext);
            ldap.closeQuietly(dirContext);
        }
        return false;
    }
1301888
def valid?
      status_validator = EnumAttributeValidator.new('String', ["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"])
      return false unless status_validator.valid?(@status)
      entry_method_validator = EnumAttributeValidator.new('String', ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"])
      return false unless entry_method_validator.valid?(@entry_method)
      return true
    end
1197601
protected function validateUser()
    {
        $id = $this->getUpdatingId();

        if ($id === false) {
            return null;
        }

        $data = $this->user->get($id);

        if (empty($data)) {
            $this->setErrorUnavailable('update', $this->translation->text('User'));
            return false;
        }

        $this->setUpdating($data);
        return true;
    }
368975
def is_user(value, min=None, max=None):
    

    if type(value) == str:
        try:
            entry = pwd.getpwnam(value)
            value = entry.pw_uid
        except KeyError:
            err_message = ('{0}: No such user.'.format(value))
            raise validate.VdtValueError(err_message)

        return value

    elif type(value) == int:
        try:
            pwd.getpwuid(value)
        except KeyError:
            err_message = ('{0}: No such user.'.format(value))
            raise validate.VdtValueError(err_message)

        return value

    else:
        err_message = ('Please, use str or int to "user" parameter.')
        raise validate.VdtTypeError(err_message)
47226
def user_exists?(username)
      begin
        url = url_for_path(user_path(username))
        client.get(url) { |response| response.code == 200 }
      rescue
        raise 'Error: Could not test user existence!'
      end
    end
1153053
function(username, password, callback) {

            var args = Array.prototype.slice.call(arguments);

            if (args.length === 1) {
                callback = arguments[0];
            } else {
                this.set({
                    username: username,
                    password: password
                });
            }

            this.validateAndSave(null, function(err, session) {
                if (!err && session) {
                    session.set("password", null);

                    session.fetch({
                        fetchSubModels: ["user"]
                    }, callback);
                } else {
                    callback(err);
                }
            });
        }
590761
def user_exists(self, username):
        

        response = self._get(self.rest_url + "/user",
                             params={"username": username})

        if not response.ok:
            return None

        return True
490743
def valid_username(user):
    '''
    
    '''
    if not isinstance(user, six.string_types):
        return False

    if len(user) > 32:
        return False

    return VALID_USERNAME.match(user) is not None
1181628
def login_oauth2_user(valid, oauth):
    """"""
    if valid:
        oauth.user.login_via_oauth2 = True
        _request_ctx_stack.top.user = oauth.user
        identity_changed.send(current_app._get_current_object(),
                              identity=Identity(oauth.user.id))
    return valid, oauth
1037659
private boolean isValid()
    {
        StringBuilder builder = new StringBuilder();
        for (Match match : matches)
        {
            builder.append(match.getToken());
        }

        return password.equals(builder.toString());
    }
780531
def validate_username(username):
        
        try:
            validate_slug(username)
        except ValidationError:
            username = slugify(username)

        user_model_cls = get_user_model()
        _username = username
        while user_model_cls.objects.filter(username=_username).exists():
            _username = '{}{}'.format(username, random.randint(1, 100))

        return _username
1112587
public function validate( $identifier, $password ) 
	{
		$user = null;
		$user_model = $this->config->user_model;

		foreach( $this->config->identifiers as $property ) 
		{
			if ( $user = $user_model::find( $property, $identifier ) ) 
			{
				break;
			} 
		}

		// when could not find a user matching the identifiers return false
		if ( !$user ) 
		{
			return false;
		}

		// in case the user has no password set always return false
		// you might implement a oauth login so you dont need to set a 
		// password but this makes sure that validating fails the password fails
		if ( empty( $user->password ) )
		{
			return false;
		}

		// when the passwords match return the user object
		if ( \CCStr::verify_hash( $password, $user->password )) 
		{
			return $user;
		}

		// otherwise return false
		return false;
	}