Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add user emails to 2FA required warn message (#5470)
boojack9026c7ddb565
diff --git a/backend/api/v1/auth_service.go b/backend/api/v1/auth_service.goindex 693a3140ed..7be819a775 100644--- a/backend/api/v1/auth_service.go+++ b/backend/api/v1/auth_service.go@@ -286,6 +286,13 @@ func (s *AuthService) UpdateUser(ctx context.Context, request *v1pb.UpdateUserReRecoveryCodes: user.MFAConfig.TempRecoveryCodes,}} else {+ setting, err := s.store.GetWorkspaceGeneralSetting(ctx)+ if err != nil {+ return nil, status.Errorf(codes.Internal, "failed to find workspace setting, error: %v", err)+ }+ if setting.Require_2Fa {+ return nil, status.Errorf(codes.InvalidArgument, "2FA is required and cannot be disabled")+ }patch.MFAConfig = &storepb.MFAConfig{}}}diff --git a/frontend/src/components/GeneralSetting/SecuritySetting.vue b/frontend/src/components/GeneralSetting/SecuritySetting.vueindex 6beed0b5fc..2bc4049eb4 100644--- a/frontend/src/components/GeneralSetting/SecuritySetting.vue+++ b/frontend/src/components/GeneralSetting/SecuritySetting.vue@@ -113,6 +113,7 @@ import { hasWorkspacePermission } from "@/utils";import { useI18n } from "vue-i18n";import { FeatureType } from "@/types";import { UserType } from "@/types/proto/v1/auth_service";+import { State } from "@/types/proto/v1/common";interface LocalState {featureNameForModal?: FeatureType;@@ -165,14 +166,20 @@ const handleRequire2FAToggle = async (on: boolean) => {if (on) {// Only allow to enable this when all users have enabled 2FA.const userList = userStore.userList- .filter((user) => user.userType === UserType.USER)+ .filter(+ (user) => user.userType === UserType.USER && user.state === State.ACTIVE+ ).filter((user) => !user.mfaEnabled);if (userList.length > 0) {pushNotification({module: "bytebase",style: "WARN",title: t(- "settings.general.workspace.require-2fa.need-all-user-2fa-enabled"+ "settings.general.workspace.require-2fa.need-all-user-2fa-enabled",+ {+ count: userList.length,+ users: userList.map((user) => user.email).join(", "),+ }),});return;diff --git a/frontend/src/components/MemberTable.vue b/frontend/src/components/MemberTable.vueindex 3b07bf7cbd..11bf14d309 100644--- a/frontend/src/components/MemberTable.vue+++ b/frontend/src/components/MemberTable.vue@@ -114,21 +114,13 @@</div></BBTableCell><BBTableCell class="whitespace-nowrap tooltip-wrapper w-auto">- <!-- Only show 2FA flag for users -->- <div- v-if="member.principal.type === 'END_USER'"- class="flex flex-row items-center"+ <span+ v-if="is2FAEnabled(member)"+ class="text-xs p-1 px-2 rounded-lg bg-green-600 text-white"+ :class="is2FAEnabled(member)">- 2FA- <heroicons-solid:check- v-if="is2FAEnabled(member)"- class="ml-1 w-4 h-auto inline-block text-green-600"- />- <heroicons-solid:x-mark- v-else- class="ml-1 w-4 h-auto inline-block text-gray-500"- />- </div>+ {{ $t("two-factor.enabled") }}+ </span></BBTableCell><BBTableCell class="whitespace-nowrap tooltip-wrapper w-36"><span v-if="changeRoleTooltip(member)" class="tooltip">{{diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 5f453a309b..834239a6b8 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -492,7 +492,7 @@"require-2fa": {"enable": "Require two-factor authentication for all users","description": "When enabled, users who do not have two-factor authentication enabled for their personal accounts will be forced to configure.",- "need-all-user-2fa-enabled": "Requires all users to enable 2FA first"+ "need-all-user-2fa-enabled": "Requires all users to enable 2FA first. There are still {count} users who have not enabled 2FA: {users}"},"network": "Network","external-url": {@@ -2039,6 +2039,7 @@"two-factor": {"self": "Two-factor authentication","description": "Two-factor authentication provides an extra layer of security for member accounts. When signing in, you will be required to enter the security code generated by your Authenticator App.",+ "enabled": "2FA Enabled","setup-steps": {"setup-auth-app": {"self": "Setup authenticator app",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 14b8b8fce4..c42cc00242 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -490,7 +490,7 @@"require-2fa": {"enable": "要求所有用户配置双重认证","description": "启用之后,没有配置双重认证的用户将被强制要求进行配置操作。",- "need-all-user-2fa-enabled": "需要所有用户都配置 2FA 后才能开启此项"+ "need-all-user-2fa-enabled": "需要所有用户都配置 2FA 后才能开启此项。还有 {count} 个用户没有配置 2FA:{users}"},"network": "网络","external-url": {@@ -2038,6 +2038,7 @@"two-factor": {"self": "双重认证","description": "双重认证为系统成员提供了一个额外的安全层。在登录时,用户需要输入由认证器应用程序生成的安全代码。",+ "enabled": "2FA 已开启","setup-steps": {"setup-auth-app": {"self": "设置认证器应用程序",diff --git a/frontend/src/views/TwoFactorSetup.vue b/frontend/src/views/TwoFactorSetup.vueindex c398d53a38..99a4874e48 100644--- a/frontend/src/views/TwoFactorSetup.vue+++ b/frontend/src/views/TwoFactorSetup.vue@@ -103,12 +103,9 @@ interface LocalState {recoveryCodesDownloaded: boolean;}-const props = withDefaults(- defineProps<{- cancelAction?: () => void;- }>(),- {}-);+const props = defineProps<{+ cancelAction?: () => void;+}>();const { t } = useI18n();const router = useRouter();