mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: add confirm dialog for disable password login setting
This commit is contained in:
@ -9,6 +9,7 @@ import { WorkspaceSettingPrefix } from "@/store/v1";
|
|||||||
import { WorkspaceGeneralSetting } from "@/types/proto/api/v2/workspace_setting_service";
|
import { WorkspaceGeneralSetting } from "@/types/proto/api/v2/workspace_setting_service";
|
||||||
import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
|
import { WorkspaceSettingKey } from "@/types/proto/store/workspace_setting";
|
||||||
import { useTranslate } from "@/utils/i18n";
|
import { useTranslate } from "@/utils/i18n";
|
||||||
|
import { showCommonDialog } from "../Dialog/CommonDialog";
|
||||||
import Icon from "../Icon";
|
import Icon from "../Icon";
|
||||||
import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";
|
import showUpdateCustomizedProfileDialog from "../UpdateCustomizedProfileDialog";
|
||||||
|
|
||||||
@ -72,14 +73,29 @@ const SystemSection = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleDisablePasswordLoginChanged = async (value: boolean) => {
|
const handleDisablePasswordLoginChanged = async (value: boolean) => {
|
||||||
const setting = { ...workspaceGeneralSetting, disallowPasswordLogin: value };
|
const updateSetting = async () => {
|
||||||
await workspaceSettingServiceClient.setWorkspaceSetting({
|
const setting = { ...workspaceGeneralSetting, disallowPasswordLogin: value };
|
||||||
setting: {
|
await workspaceSettingServiceClient.setWorkspaceSetting({
|
||||||
name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`,
|
setting: {
|
||||||
generalSetting: setting,
|
name: `${WorkspaceSettingPrefix}${WorkspaceSettingKey.WORKSPACE_SETTING_GENERAL}`,
|
||||||
},
|
generalSetting: setting,
|
||||||
});
|
},
|
||||||
setWorkspaceGeneralSetting(setting);
|
});
|
||||||
|
setWorkspaceGeneralSetting(setting);
|
||||||
|
};
|
||||||
|
if (value) {
|
||||||
|
showCommonDialog({
|
||||||
|
title: "Confirm",
|
||||||
|
content: "Are you sure to disable password login?",
|
||||||
|
style: "danger",
|
||||||
|
dialogName: "disable-password-login-dialog",
|
||||||
|
onConfirm: async () => {
|
||||||
|
await updateSetting();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
await updateSetting();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUpdateCustomizedProfileButtonClick = () => {
|
const handleUpdateCustomizedProfileButtonClick = () => {
|
||||||
|
Reference in New Issue
Block a user