Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(ui): solve the problem of irregular use of input type

robin8faafda08615
diff --git a/ui/src/pages/Admin/General/index.tsx b/ui/src/pages/Admin/General/index.tsx
index fd41842a..d7a96054 100644
--- a/ui/src/pages/Admin/General/index.tsx
+++ b/ui/src/pages/Admin/General/index.tsx
@@ -53,6 +53,7 @@ const General: FC = () => {
const uiSchema: UISchema = {
site_url: {
'ui:options': {
+ type: 'url',
validator: (value) => {
let url: URL | undefined;
try {
@@ -76,6 +77,7 @@ const General: FC = () => {
},
contact_email: {
'ui:options': {
+ type: 'email',
validator: (value) => {
if (!Pattern.email.test(value)) {
return t('contact_email.validate');
diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsx
index adfaff9b..fcb81009 100644
--- a/ui/src/pages/Admin/Smtp/index.tsx
+++ b/ui/src/pages/Admin/Smtp/index.tsx
@@ -67,6 +67,11 @@ const Smtp: FC = () => {
},
};
const uiSchema: UISchema = {
+ from_email: {
+ 'ui:options': {
+ type: 'email',
+ },
+ },
encryption: {
'ui:widget': 'select',
},
@@ -100,6 +105,7 @@ const Smtp: FC = () => {
},
smtp_port: {
'ui:options': {
+ type: 'number',
validator: (value) => {
if (!/^[1-9][0-9]*$/.test(value) || Number(value) > 65535) {
return t('smtp_port.msg');
@@ -110,6 +116,7 @@ const Smtp: FC = () => {
},
test_email_recipient: {
'ui:options': {
+ type: 'email',
validator: (value) => {
if (value && !pattern.email.test(value)) {
return t('test_email_recipient.msg');