chore: allow non-latin characters to project identifier (#3226)

This commit is contained in:
Lakhan Baheti 2023-12-22 14:04:47 +05:30 committed by sriram veeraghanta
parent 6ecaa661a7
commit 816b6abf3b

View File

@ -182,7 +182,7 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
setValue( setValue(
"identifier", "identifier",
e.target.value e.target.value
.replace(/[^a-zA-Z0-9]/g, "") .replace(/[^ÇŞĞIİÖÜA-Za-z0-9]/g, "")
.toUpperCase() .toUpperCase()
.substring(0, 5) .substring(0, 5)
); );
@ -191,7 +191,7 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
const handleIdentifierChange = (onChange: any) => (e: ChangeEvent<HTMLInputElement>) => { const handleIdentifierChange = (onChange: any) => (e: ChangeEvent<HTMLInputElement>) => {
const { value } = e.target; const { value } = e.target;
const alphanumericValue = value.replace(/[^a-zA-Z0-9]/g, ""); const alphanumericValue = value.replace(/[^ÇŞĞIİÖÜA-Za-z0-9]/g, "");
setIsChangeInIdentifierRequired(false); setIsChangeInIdentifierRequired(false);
onChange(alphanumericValue.toUpperCase()); onChange(alphanumericValue.toUpperCase());
}; };
@ -301,8 +301,9 @@ export const CreateProjectModal: FC<Props> = observer((props) => {
name="identifier" name="identifier"
rules={{ rules={{
required: "Identifier is required", required: "Identifier is required",
// allow only alphanumeric & non-latin characters
validate: (value) => validate: (value) =>
/^[A-Z0-9]+$/.test(value.toUpperCase()) || "Identifier must be in uppercase.", /^[ÇŞĞIİÖÜA-Z0-9]+$/.test(value.toUpperCase()) || "Identifier must be in uppercase.",
minLength: { minLength: {
value: 1, value: 1,
message: "Identifier must at least be of 1 character", message: "Identifier must at least be of 1 character",