src/AdminStore.php
private function _add_user_verify_name($addname) {
		$logger = $this->logger;

		# check name, allow multi-byte chars but not whitespace
		if (strlen($addname) > 64) {
			# max 64 chars
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_TOO_LONG;
		}
		foreach([" ", "\n", "\r", "\t"] as $white) {
			# never allow whitespace in the middle
			if (strpos($addname, $white) !== false) {
				$logger->warning(
					"Zapmin: usradd: name invalid: '$addname'.");
				return AdminStoreError::USERNAME_HAS_WHITESPACE;
			}
		}
		if ($addname[0] == '+') {
			# leading '+' is reserved for passwordless accounts
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_LEADING_PLUS;
		}

		return 0;
	}
private function _add_user_verify_name($addname) {
		$logger = $this->logger;

		# check name, allow multi-byte chars but not whitespace
		if (strlen($addname) > 64) {
			# max 64 chars
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_TOO_LONG;
		}
		foreach([" ", "\n", "\r", "\t"] as $white) {
			# never allow whitespace in the middle
			if (strpos($addname, $white) !== false) {
				$logger->warning(
					"Zapmin: usradd: name invalid: '$addname'.");
				return AdminStoreError::USERNAME_HAS_WHITESPACE;
			}
		}
		if ($addname[0] == '+') {
			# leading '+' is reserved for passwordless accounts
			$logger->warning(
				"Zapmin: usradd: name invalid: '$addname'.");
			return AdminStoreError::USERNAME_LEADING_PLUS;
		}

		return 0;
	}
private function _add_user_verify_name ( $ addname ) { $ logger = $ this -> logger ; # check name, allow multi-byte chars but not whitespace if ( strlen ( $ addname ) > 64 ) { # max 64 chars $ logger -> warning ( "Zapmin: usradd: name invalid: '$addname'." ) ; return AdminStoreError :: USERNAME_TOO_LONG ; } foreach ( [ " " , "\n" , "\r" , "\t" ] as $ white ) { # never allow whitespace in the middle if ( strpos ( $ addname , $ white ) !== false ) { $ logger -> warning ( "Zapmin: usradd: name invalid: '$addname'." ) ; return AdminStoreError :: USERNAME_HAS_WHITESPACE ; } } if ( $ addname [ 0 ] == '+' ) { # leading '+' is reserved for passwordless accounts $ logger -> warning ( "Zapmin: usradd: name invalid: '$addname'." ) ; return AdminStoreError :: USERNAME_LEADING_PLUS ; } return 0 ; }
Verify username of new user.
Verify username of new user .