api name length check

main
alex 2023-10-14 20:46:24 +02:00
parent 28c823bc41
commit e48ab6ca45
2 changed files with 10 additions and 0 deletions

View File

@ -484,8 +484,16 @@ export default function UserProfile() {
placeholder="Name"
value={newApiKeyName}
onChange={(e) => setNewApikeyName(e.target.value)}
maxLength={Constants.GLOBALS.MAX_USER_API_KEY_NAME_LENGTH}
/>
}
okButtonProps={{
disabled:
newApiKeyName.length <
Constants.GLOBALS.MIN_USER_API_KEY_NAME_LENGTH ||
newApiKeyName.length >
Constants.GLOBALS.MAX_USER_API_KEY_NAME_LENGTH,
}}
okText={t("userProfile.button.createApiKey.popconfirm.okText")}
cancelText={t("common.button.cancel")}
onConfirm={() => onCreateNewApiKeyConfirm()}

View File

@ -104,6 +104,8 @@ export const Constants = {
MAX_LOG_MANAGER_ADDRESS_LENGTH: 100,
MIN_ROBOTICS_ROBOT_NAME_LENGTH: 2,
MAX_ROBOTICS_ROBOT_NAME_LENGTH: 30,
MIN_USER_API_KEY_NAME_LENGTH: 2,
MAX_USER_API_KEY_NAME_LENGTH: 30,
},
MAX_AVATAR_SIZE: 5 * 1024 * 1024,
ACCEPTED_AVATAR_FILE_TYPES: [