Add AWS access key validation.

This commit is contained in:
glay 2024-11-13 07:57:51 +08:00 committed by GitHub
parent afb0752d5d
commit bfa433919f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -994,9 +994,14 @@ export function Settings() {
type="text"
placeholder={Locale.Settings.Access.Bedrock.AccessKey.Placeholder}
onChange={(e) => {
accessStore.update(
(access) => (access.awsAccessKey = e.currentTarget.value),
);
accessStore.update((access) => {
const accessKey = e.currentTarget.value;
if (accessKey && accessKey.length !== 20) {
showToast(Locale.Settings.Access.Bedrock.AccessKey.Invalid);
return;
}
access.awsAccessKey = accessKey;
});
}}
maskWhenShow={true}
/>