mirror of https://gitee.com/answerdev/answer.git
feat(ui): show smtp username and password fields when Authentication is on
This commit is contained in:
parent
1a317d6dce
commit
665332d5d7
|
@ -169,18 +169,17 @@ const Smtp: FC = () => {
|
|||
if (!setting) {
|
||||
return;
|
||||
}
|
||||
const formState = {};
|
||||
Object.keys(formData).forEach((k) => {
|
||||
let v = setting[k];
|
||||
if (v === null || v === undefined) {
|
||||
v = '';
|
||||
}
|
||||
formState[k] = { ...formData[k], value: v };
|
||||
const formMeta = {};
|
||||
Object.keys(setting).forEach((k) => {
|
||||
formMeta[k] = { ...formData[k], value: setting[k] };
|
||||
});
|
||||
setFormData(formState);
|
||||
setFormData({ ...formData, ...formMeta });
|
||||
}, [setting]);
|
||||
|
||||
useEffect(() => {
|
||||
if (formData.smtp_authentication.value === '') {
|
||||
return;
|
||||
}
|
||||
if (formData.smtp_authentication.value) {
|
||||
setFormData({
|
||||
...formData,
|
||||
|
@ -194,7 +193,7 @@ const Smtp: FC = () => {
|
|||
smtp_password: { ...formData.smtp_password, hidden: true },
|
||||
});
|
||||
}
|
||||
}, [formData.smtp_authentication]);
|
||||
}, [formData.smtp_authentication.value]);
|
||||
|
||||
const handleOnChange = (data) => {
|
||||
setFormData(data);
|
||||
|
|
Loading…
Reference in New Issue