Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(system): add admin UI for creating users (#3034)
MidoriKuragedcc89d4b2df9
diff --git a/frontend/src/i18n/auditActionLocaleDefaults.ts b/frontend/src/i18n/auditActionLocaleDefaults.tsindex 6215efee7..a5cbe04c3 100644--- a/frontend/src/i18n/auditActionLocaleDefaults.ts+++ b/frontend/src/i18n/auditActionLocaleDefaults.ts@@ -30,6 +30,7 @@ const SYSTEM_GLOBAL_AUDIT_ACTION_LABELS_EN: Record<string, string> = {'system.api_key_revoked': 'Platform API key revoked','system.admin_revoked': 'System admin revoked','system.user_password_reset': 'User password reset',+ 'system.user_created': 'User created','system.queue_task_retried': 'Failed task run again','system.queue_task_deleted': 'Failed task record cleared','system.queue_task_run_now': 'Queue task run now',diff --git a/frontend/src/i18n/auditActionRegistry.ts b/frontend/src/i18n/auditActionRegistry.tsindex fa38f8e17..118888d95 100644--- a/frontend/src/i18n/auditActionRegistry.ts+++ b/frontend/src/i18n/auditActionRegistry.ts@@ -37,6 +37,7 @@ export const SYSTEM_GLOBAL_AUDIT_ACTIONS = ['system.api_key_revoked','system.admin_revoked','system.user_password_reset',+ 'system.user_created','system.queue_task_retried','system.queue_task_deleted','system.queue_task_run_now',diff --git a/frontend/src/i18n/locales/en-US.ts b/frontend/src/i18n/locales/en-US.tsindex 6fff6d3a5..d78fb7820 100755--- a/frontend/src/i18n/locales/en-US.ts+++ b/frontend/src/i18n/locales/en-US.ts@@ -4070,6 +4070,49 @@ export default {success: 'Password reset; the user\'s existing sessions were revoked',failed: 'Failed to reset password',},+ createUser: {+ label: 'Create user',+ description: 'Provision a new local user account. If the platform\'s default workspace mode is set to "create personal", the user gets a personal workspace just like a self-registered user would.',+ action: 'Create user',+ dialogTitle: 'Create a new user',+ warning: 'This is a high-risk action. Verify the username and email carefully — they are how the new user will sign in.',+ usernameLabel: 'Username',+ usernamePlaceholder: '2-50 characters',+ emailLabel: 'Email',+ emailPlaceholder: 'Enter a valid email address',+ autoGenerateLabel: 'Auto-generate a random password',+ newPasswordLabel: 'New password',+ newPasswordPlaceholder: '8-32 characters, including letters and numbers',+ confirmPasswordLabel: 'Confirm new password',+ confirmPasswordPlaceholder: 'Enter the new password again',+ confirmBtn: 'Create user',+ success: 'User created',+ successSuppliedPassword: 'Submitted. If this user already existed, no changes were made (including the password).',+ successIdempotent: 'User already existed; no changes made',+ failed: 'Failed to create user',+ validation: {+ usernameRequired: 'Enter a username',+ usernameLength: 'Username must be 2-50 characters',+ emailRequired: 'Enter an email address',+ emailInvalid: 'Enter a valid email address',+ passwordRequired: 'Enter a new password',+ passwordLength: 'Password must be 8-32 characters',+ passwordLetter: 'Password must contain a letter',+ passwordNumber: 'Password must contain a number',+ confirmRequired: 'Enter the new password again',+ passwordMismatch: 'The passwords do not match'+ },+ generated: {+ successTitle: 'User created',+ successBody: 'A random password was generated for this user. It will only be shown once.',+ usernameLabel: 'Username',+ emailLabel: 'Email',+ passwordLabel: 'Generated password',+ copyBtn: 'Copy password',+ copySuccess: 'Password copied to clipboard',+ acknowledgeBtn: 'I have saved the password'+ }+ },bulkApply: {label: 'Apply to all existing workspaces',tooltip: 'Saving the value only affects new workspaces by default; click here to also overwrite every existing workspace.',@@ -4109,6 +4152,7 @@ export default {'system.api_key_revoked': 'Platform API key revoked','system.admin_revoked': 'System admin revoked','system.user_password_reset': 'User password reset',+ 'system.user_created': 'User created','system.queue_task_retried': 'Failed task run again','system.queue_task_deleted': 'Failed task record cleared','system.queue_task_run_now': 'Queue task run now',diff --git a/frontend/src/i18n/locales/ko-KR.ts b/frontend/src/i18n/locales/ko-KR.tsindex 2ef0e0aef..7fbc548e9 100755--- a/frontend/src/i18n/locales/ko-KR.ts+++ b/frontend/src/i18n/locales/ko-KR.ts@@ -2721,6 +2721,7 @@ export default {'system.api_key_revoked': '플랫폼 API 키 폐기','system.admin_revoked': '시스템 관리자 회수','system.user_password_reset': '사용자 비밀번호 재설정',+ 'system.user_created': '사용자 생성','system.queue_task_retried': '실패 작업 다시 실행','system.queue_task_deleted': '실패 작업 기록 삭제','system.queue_task_run_now': '큐 작업 즉시 실행',@@ -2766,6 +2767,49 @@ export default {success: '비밀번호가 재설정되고 기존 세션이 만료되었습니다',failed: '비밀번호 재설정 실패',},+ createUser: {+ label: '사용자 생성',+ description: '새 로컬 사용자 계정을 개설합니다. 플랫폼의 기본 공간 모드가 "개인 공간 자동 생성"으로 설정된 경우, 스스로 가입한 사용자와 마찬가지로 개인 공간도 함께 만들어집니다.',+ action: '사용자 생성',+ dialogTitle: '새 사용자 생성',+ warning: '보안에 민감한 작업입니다. 새 사용자가 로그인할 때 사용할 사용자 이름과 이메일을 신중히 확인하세요.',+ usernameLabel: '사용자 이름',+ usernamePlaceholder: '2~50자',+ emailLabel: '이메일',+ emailPlaceholder: '올바른 이메일 주소를 입력하세요',+ autoGenerateLabel: '무작위 비밀번호 자동 생성',+ newPasswordLabel: '새 비밀번호',+ newPasswordPlaceholder: '8~32자, 문자와 숫자 포함',+ confirmPasswordLabel: '새 비밀번호 확인',+ confirmPasswordPlaceholder: '새 비밀번호를 다시 입력',+ confirmBtn: '사용자 생성',+ success: '사용자가 생성되었습니다',+ successSuppliedPassword: '제출 완료. 이미 존재하는 사용자라면 변경된 내용이 없습니다(비밀번호 포함).',+ successIdempotent: '이미 존재하는 사용자입니다. 변경 사항이 없습니다',+ failed: '사용자 생성 실패',+ validation: {+ usernameRequired: '사용자 이름을 입력하세요',+ usernameLength: '사용자 이름은 2~50자여야 합니다',+ emailRequired: '이메일을 입력하세요',+ emailInvalid: '올바른 이메일 주소를 입력하세요',+ passwordRequired: '새 비밀번호를 입력하세요',+ passwordLength: '비밀번호는 8~32자여야 합니다',+ passwordLetter: '비밀번호에 문자가 포함되어야 합니다',+ passwordNumber: '비밀번호에 숫자가 포함되어야 합니다',+ confirmRequired: '새 비밀번호를 다시 입력하세요',+ passwordMismatch: '비밀번호가 일치하지 않습니다'+ },+ generated: {+ successTitle: '사용자가 생성되었습니다',+ successBody: '이 사용자를 위한 무작위 비밀번호가 생성되었습니다. 이 비밀번호는 한 번만 표시됩니다.',+ usernameLabel: '사용자 이름',+ emailLabel: '이메일',+ passwordLabel: '생성된 비밀번호',+ copyBtn: '비밀번호 복사',+ copySuccess: '비밀번호가 클립보드에 복사되었습니다',+ acknowledgeBtn: '비밀번호를 저장했습니다'+ }+ },admins: {label: '시스템 관리자',description: '플랫폼 수준 권한을 가진 사용자입니다. 오른쪽에 이메일을 입력하고 엔터를 누르면 해당 사용자를 관리자로 승격하고, 태그의 ×를 누르면 권한을 회수합니다. 본인은 관리자이지만 목록에 표시되지 않으며 자신의 권한을 회수할 수 없습니다.',diff --git a/frontend/src/i18n/locales/ru-RU.ts b/frontend/src/i18n/locales/ru-RU.tsindex d29448a56..a4fa6b37d 100755--- a/frontend/src/i18n/locales/ru-RU.ts+++ b/frontend/src/i18n/locales/ru-RU.ts@@ -2721,6 +2721,7 @@ export default {'system.api_key_revoked': 'Отозван платформенный API-ключ','system.admin_revoked': 'Отозван системный администратор','system.user_password_reset': 'Сброшен пароль пользователя',+ 'system.user_created': 'Создан пользователь','system.queue_task_retried': 'Повторно запущена сбойная задача','system.queue_task_deleted': 'Удалена запись о сбойной задаче','system.queue_task_run_now': 'Задача очереди запущена сейчас',@@ -2766,6 +2767,49 @@ export default {success: 'Пароль сброшен, существующие сеансы пользователя завершены',failed: 'Не удалось сбросить пароль',},+ createUser: {+ label: 'Создать пользователя',+ description: 'Завести новый локальный аккаунт. Если режим пространства по умолчанию — «создавать личное пространство», пользователь получит личное пространство так же, как при самостоятельной регистрации.',+ action: 'Создать пользователя',+ dialogTitle: 'Создание нового пользователя',+ warning: 'Это операция повышенного риска. Внимательно проверьте имя пользователя и email — это его единственные учётные данные для входа.',+ usernameLabel: 'Имя пользователя',+ usernamePlaceholder: '2–50 символов',+ emailLabel: 'Email',+ emailPlaceholder: 'Введите корректный email',+ autoGenerateLabel: 'Сгенерировать случайный пароль автоматически',+ newPasswordLabel: 'Новый пароль',+ newPasswordPlaceholder: '8–32 символа, включая буквы и цифры',+ confirmPasswordLabel: 'Подтвердите новый пароль',+ confirmPasswordPlaceholder: 'Введите новый пароль ещё раз',+ confirmBtn: 'Создать пользователя',+ success: 'Пользователь создан',+ successSuppliedPassword: 'Запрос отправлен. Если пользователь уже существовал, изменения не внесены (включая пароль).',+ successIdempotent: 'Пользователь уже существует; изменений нет',+ failed: 'Не удалось создать пользователя',+ validation: {+ usernameRequired: 'Введите имя пользователя',+ usernameLength: 'Имя пользователя должно содержать от 2 до 50 символов',+ emailRequired: 'Введите email',+ emailInvalid: 'Введите корректный email',+ passwordRequired: 'Введите новый пароль',+ passwordLength: 'Пароль должен содержать от 8 до 32 символов',+ passwordLetter: 'Пароль должен содержать букву',+ passwordNumber: 'Пароль должен содержать цифру',+ confirmRequired: 'Введите новый пароль ещё раз',+ passwordMismatch: 'Пароли не совпадают'+ },+ generated: {+ successTitle: 'Пользователь создан',+ successBody: 'Для этого пользователя сгенерирован случайный пароль. Он будет показан только один раз.',+ usernameLabel: 'Имя пользователя',+ emailLabel: 'Email',+ passwordLabel: 'Сгенерированный пароль',+ copyBtn: 'Скопировать пароль',+ copySuccess: 'Пароль скопирован в буфер обмена',+ acknowledgeBtn: 'Я сохранил пароль'+ }+ },admins: {label: 'Системные администраторы',description: 'Пользователи с правами уровня платформы. Введите email и нажмите Enter, чтобы повысить пользователя до администратора; нажмите × на теге, чтобы отозвать права. Вы (текущий пользователь) являетесь администратором и не отображаетесь в списке — отозвать собственные права нельзя.',diff --git a/frontend/src/i18n/locales/zh-CN.ts b/frontend/src/i18n/locales/zh-CN.tsindex 80161c4b5..46f04348e 100755--- a/frontend/src/i18n/locales/zh-CN.ts+++ b/frontend/src/i18n/locales/zh-CN.ts@@ -2723,6 +2723,7 @@ export default {'system.api_key_revoked': '吊销平台 API Key','system.admin_revoked': '回收系统管理员','system.user_password_reset': '重置用户密码',+ 'system.user_created': '创建用户','system.queue_task_retried': '重新执行失败任务','system.queue_task_deleted': '清除失败任务记录','system.queue_task_run_now': '立即执行队列任务',@@ -2768,6 +2769,49 @@ export default {success: '密码已重置,该用户的现有会话已失效',failed: '重置密码失败',},+ createUser: {+ label: '创建用户',+ description: '开通一个新的本地用户账号。如果平台的默认空间模式设置为「自动创建个人空间」,该用户会像自助注册的用户一样,同时获得一个个人空间。',+ action: '创建用户',+ dialogTitle: '创建新用户',+ warning: '这是高风险操作。请仔细核对用户名和邮箱——它们将作为该用户登录的唯一凭据。',+ usernameLabel: '用户名',+ usernamePlaceholder: '2-50 个字符',+ emailLabel: '邮箱',+ emailPlaceholder: '请输入有效的邮箱地址',+ autoGenerateLabel: '自动生成随机密码',+ newPasswordLabel: '新密码',+ newPasswordPlaceholder: '8-32 个字符,包含字母和数字',+ confirmPasswordLabel: '确认新密码',+ confirmPasswordPlaceholder: '再次输入新密码',+ confirmBtn: '创建用户',+ success: '用户已创建',+ successSuppliedPassword: '已提交。若该用户此前已存在,则未对其做任何更改(包括密码)。',+ successIdempotent: '用户已存在,未做任何更改',+ failed: '创建用户失败',+ validation: {+ usernameRequired: '请输入用户名',+ usernameLength: '用户名长度必须为 2-50 个字符',+ emailRequired: '请输入邮箱',+ emailInvalid: '请输入有效的邮箱地址',+ passwordRequired: '请输入新密码',+ passwordLength: '密码长度必须为 8-32 个字符',+ passwordLetter: '密码必须包含字母',+ passwordNumber: '密码必须包含数字',+ confirmRequired: '请再次输入新密码',+ passwordMismatch: '两次输入的密码不一致'+ },+ generated: {+ successTitle: '用户已创建',+ successBody: '已为该用户生成一个随机密码。此密码只会显示一次。',+ usernameLabel: '用户名',+ emailLabel: '邮箱',+ passwordLabel: '生成的密码',+ copyBtn: '复制密码',+ copySuccess: '密码已复制到剪贴板',+ acknowledgeBtn: '我已保存密码'+ }+ },admins: {label: '系统管理员',description: '拥有平台级权限的用户。在右侧输入邮箱并回车即可提升用户为管理员;点击 × 即为撤销其权限。当前你(自己)已是管理员,不在列表中显示,也无法被自己撤销。',diff --git a/frontend/src/views/system/CreateUserDialog.vue b/frontend/src/views/system/CreateUserDialog.vuenew file mode 100644index 000000000..4b28a2390--- /dev/null+++ b/frontend/src/views/system/CreateUserDialog.vue@@ -0,0 +1,360 @@+<!--+ CreateUserDialog: SystemAdmin "Create user" dialog (Access settings row).++ Owns the whole create-user flow: form (username + email + auto-generate+ toggle revealing new/confirm password fields) and, when the server mints a+ one-time password, a reveal view that must be acknowledged before the+ dialog can close (overlay click, Esc, and the close button are disabled+ via `locked`). The idempotent 200 OK path (no generated_password) closes+ with its own success toast instead.++ Visibility is owned by the parent via v-model:visible. Every user-visible+ message is also emitted via `announced` so the parent's sr-only live+ region can relay it. The shared teleported-dialog shell comes from the+ systemAdminDialog.less import in SystemSettings.vue.+-->+<template>+ <t-dialog+ :visible="visible"+ :header="createUserSuccess+ ? t('system.globalSettings.createUser.generated.successTitle')+ : t('system.globalSettings.createUser.dialogTitle')"+ width="440px"+ placement="center"+ dialog-class-name="create-user-dialog"+ :footer="!createUserSuccess"+ :confirm-btn="{+ content: t('system.globalSettings.createUser.confirmBtn'),+ theme: 'primary',+ loading: submitting,+ }"+ :cancel-btn="{+ content: t('system.globalSettings.confirm.cancelBtn'),+ variant: 'outline',+ }"+ :close-on-overlay-click="!locked"+ :close-btn="!locked"+ :close-on-esc-keydown="!locked"+ @update:visible="onVisibleChange"+ @close="resetForm"+ @confirm="submit"+ >+ <template v-if="createUserSuccess">+ <t-alert+ theme="success"+ :message="t('system.globalSettings.createUser.generated.successBody')"+ class="create-user-warning"+ />+ <div class="create-user-reveal">+ <div class="create-user-reveal-row">+ <span class="create-user-reveal-label">+ {{ t('system.globalSettings.createUser.generated.usernameLabel') }}+ </span>+ <span class="create-user-reveal-value">{{ createUserSuccess.username }}</span>+ </div>+ <div class="create-user-reveal-row">+ <span class="create-user-reveal-label">+ {{ t('system.globalSettings.createUser.generated.emailLabel') }}+ </span>+ <span class="create-user-reveal-value">{{ createUserSuccess.email }}</span>+ </div>+ <div class="create-user-reveal-row create-user-reveal-row--password">+ <span class="create-user-reveal-label">+ {{ t('system.globalSettings.createUser.generated.passwordLabel') }}+ </span>+ <div class="create-user-reveal-password">+ <t-input+ v-model="createUserSuccess.generatedPassword"+ readonly+ type="password"+ class="create-user-reveal-password-field"+ />+ <t-button theme="primary" variant="outline" @click="copyGeneratedPassword">+ {{ t('system.globalSettings.createUser.generated.copyBtn') }}+ </t-button>+ </div>+ </div>+ </div>+ <div class="create-user-acknowledge">+ <t-button theme="primary" block @click="acknowledge">+ {{ t('system.globalSettings.createUser.generated.acknowledgeBtn') }}+ </t-button>+ </div>+ </template>+ <template v-else>+ <t-alert+ theme="warning"+ :message="t('system.globalSettings.createUser.warning')"+ class="create-user-warning"+ />+ <t-form+ ref="formRef"+ :data="form"+ :rules="rules"+ label-align="top"+ class="create-user-form"+ >+ <t-form-item :label="t('system.globalSettings.createUser.usernameLabel')" name="username">+ <t-input+ v-model="form.username"+ type="text"+ clearable+ autocomplete="off"+ :disabled="submitting"+ :placeholder="t('system.globalSettings.createUser.usernamePlaceholder')"+ />+ </t-form-item>+ <t-form-item :label="t('system.globalSettings.createUser.emailLabel')" name="email">+ <t-input+ v-model="form.email"+ type="text"+ clearable+ autocomplete="off"+ :disabled="submitting"+ :placeholder="t('system.globalSettings.createUser.emailPlaceholder')"+ />+ </t-form-item>+ <t-form-item name="autoGenerate">+ <t-checkbox v-model="form.autoGenerate" :disabled="submitting">+ {{ t('system.globalSettings.createUser.autoGenerateLabel') }}+ </t-checkbox>+ </t-form-item>+ <template v-if="!form.autoGenerate">+ <t-form-item :label="t('system.globalSettings.createUser.newPasswordLabel')" name="newPassword">+ <t-input+ v-model="form.newPassword"+ type="password"+ autocomplete="new-password"+ :disabled="submitting"+ :placeholder="t('system.globalSettings.createUser.newPasswordPlaceholder')"+ >+ <template #prefix-icon><t-icon name="lock-on" /></template>+ </t-input>+ </t-form-item>+ <t-form-item :label="t('system.globalSettings.createUser.confirmPasswordLabel')" name="confirmPassword">+ <t-input+ v-model="form.confirmPassword"+ type="password"+ autocomplete="new-password"+ :disabled="submitting"+ :placeholder="t('system.globalSettings.createUser.confirmPasswordPlaceholder')"+ @enter="submit"+ >+ <template #prefix-icon><t-icon name="lock-on" /></template>+ </t-input>+ </t-form-item>+ </template>+ </t-form>+ </template>+ </t-dialog>+</template>++<script setup lang="ts">+import { computed, nextTick, reactive, ref, watch } from 'vue'+import { MessagePlugin } from 'tdesign-vue-next'+import type { FormInstanceFunctions, FormRule } from 'tdesign-vue-next'+import { useI18n } from 'vue-i18n'+import { createSystemUser, type CreateSystemUserRequest } from '@/api/system'+import { getAuthConfig } from '@/api/auth'+import { copyWithToast } from '@/utils/clipboard'+import { newPasswordRules } from '@/utils/passwordPolicy'++const props = defineProps<{ visible: boolean }>()+const emit = defineEmits<{+ 'update:visible': [boolean]+ announced: [string]+}>()++const { t } = useI18n()++const submitting = ref(false)+const formRef = ref<FormInstanceFunctions>()+const form = reactive({+ username: '',+ email: '',+ autoGenerate: true,+ newPassword: '',+ confirmPassword: '',+})+// Non-null switches the dialog to the reveal view; cleared on close so+// the success view survives the close animation.+const createUserSuccess = ref<{ username: string; email: string; generatedPassword: string } | null>(null)+// While submitting or showing the reveal view, the dialog can only be+// dismissed through its footer / acknowledge actions.+const locked = computed(() => submitting.value || createUserSuccess.value !== null)+// Mirror SystemSettings.vue: the backend's password policy strictness is+// toggled by the complex_password setting, fetched from the auth config.+const complexPasswordEnabled = ref(false)+const loadAuthConfig = async () => {+ try {+ const resp = await getAuthConfig()+ complexPasswordEnabled.value = !!resp.complex_password_enabled+ } catch {+ complexPasswordEnabled.value = false+ }+}+// autoGenerate hides the password fields (v-if), so they are never+// registered with the form and need no skip-guard in their rules.+const rules = computed<Record<string, FormRule[]>>(() => ({+ username: [+ { required: true, message: t('system.globalSettings.createUser.validation.usernameRequired'), trigger: 'blur' },+ { min: 2, max: 50, message: t('system.globalSettings.createUser.validation.usernameLength'), trigger: 'blur' },+ ],+ email: [+ { required: true, message: t('system.globalSettings.createUser.validation.emailRequired'), trigger: 'blur' },+ { email: true, message: t('system.globalSettings.createUser.validation.emailInvalid'), trigger: 'blur' },+ ],+ newPassword: newPasswordRules(t, complexPasswordEnabled.value),+ confirmPassword: [+ { required: true, message: t('system.globalSettings.createUser.validation.confirmRequired'), trigger: 'blur' },+ {+ validator: (value: string) => value === form.newPassword,+ message: t('auth.passwordMismatch'),+ trigger: 'blur',+ },+ ],+}))++watch(() => props.visible, (visible) => {+ if (visible) {+ resetForm()+ loadAuthConfig()+ nextTick(() => formRef.value?.clearValidate?.())+ }+})++function onVisibleChange(visible: boolean) {+ emit('update:visible', visible)+}++function resetForm() {+ form.username = ''+ form.email = ''+ form.autoGenerate = true+ form.newPassword = ''+ form.confirmPassword = ''+ createUserSuccess.value = null+ formRef.value?.clearValidate?.()+}++async function submit() {+ if (submitting.value) return+ const valid = await formRef.value?.validate?.()+ if (valid !== true) return++ submitting.value = true+ try {+ const payload: CreateSystemUserRequest = {+ username: form.username.trim(),+ email: form.email.trim(),+ }+ if (!form.autoGenerate) {+ payload.password = form.newPassword+ }+ const response = await createSystemUser(payload)+ const generated = response.generated_password ?? ''+ if (generated) {+ // One-time plaintext password: keep the dialog open on the reveal+ // view until the admin explicitly acknowledges.+ createUserSuccess.value = {+ username: payload.username,+ email: payload.email,+ generatedPassword: generated,+ }+ emit('announced', t('system.globalSettings.createUser.success'))+ } else if (!form.autoGenerate) {+ // TODO: a fresh 201 create and an idempotent 200 retry return+ // identical bodies (the API client drops the HTTP status), so the+ // message is worded to be true for both.+ const msg = t('system.globalSettings.createUser.successSuppliedPassword')+ emit('announced', msg)+ MessagePlugin.success(msg)+ emit('update:visible', false)+ } else {+ // Idempotent path: identity already existed, nothing was minted.+ const msg = t('system.globalSettings.createUser.successIdempotent')+ emit('announced', msg)+ MessagePlugin.success(msg)+ emit('update:visible', false)+ }+ } catch (err: any) {+ const msg = err?.message || t('system.globalSettings.createUser.failed')+ emit('announced', msg)+ MessagePlugin.error(msg)+ } finally {+ submitting.value = false+ }+}++async function copyGeneratedPassword() {+ if (!createUserSuccess.value) return+ await copyWithToast(+ createUserSuccess.value.generatedPassword,+ 'system.globalSettings.createUser.generated.copySuccess',+ )+}++function acknowledge() {+ if (!createUserSuccess.value) return+ MessagePlugin.success(t('system.globalSettings.createUser.success'))+ emit('update:visible', false)+}+</script>++<style lang="less">+/*+ * Per-flow styles on top of the shared shell in systemAdminDialog.less+ * (imported by SystemSettings.vue).+ */+.create-user-dialog {+ .create-user-reveal {+ display: flex;+ flex-direction: column;+ gap: 12px;+ margin-bottom: 20px;+ }++ .create-user-reveal-row {+ display: flex;+ align-items: baseline;+ gap: 12px;++ &--password {+ flex-direction: column;+ align-items: stretch;+ gap: 6px;+ }+ }++ .create-user-reveal-label {+ flex-shrink: 0;+ min-width: 80px;+ font-size: 13px;+ color: var(--td-text-color-secondary);+ }++ .create-user-reveal-value {+ font-size: 14px;+ color: var(--td-text-color-primary);+ word-break: break-all;+ }++ .create-user-reveal-password {+ display: flex;+ gap: 8px;+ align-items: stretch;+ }++ .create-user-reveal-password-field {+ flex: 1;+ }++ .create-user-acknowledge {+ display: flex;+ flex-direction: column;+ gap: 8px;+ padding: 16px 0;+ border-top: 1px solid var(--td-component-stroke);+ }+}+</style>diff --git a/frontend/src/views/system/SystemSettings.vue b/frontend/src/views/system/SystemSettings.vueindex 02bb34537..39ab726cf 100644--- a/frontend/src/views/system/SystemSettings.vue+++ b/frontend/src/views/system/SystemSettings.vue@@ -180,6 +180,29 @@</div></div>+ <div v-if="activeSettingsSection === 'access'" class="setting-row setting-row--create-user">+ <div class="setting-info">+ <div class="setting-label">+ <span>{{ t('system.globalSettings.createUser.label') }}</span>+ <t-tag theme="danger" variant="light" size="small" class="setting-badge">+ {{ t('system.globalSettings.badgeHighRisk') }}+ </t-tag>+ </div>+ <p class="desc">{{ t('system.globalSettings.createUser.description') }}</p>+ </div>+ <div class="setting-control">+ <t-button+ theme="primary"+ variant="text"+ class="create-user-trigger"+ @click="createUserVisible = true"+ >+ <template #icon><t-icon name="user-add" /></template>+ {{ t('system.globalSettings.createUser.action') }}+ </t-button>+ </div>+ </div>+<divv-for="item in activeSectionSettings":key="item.key"@@ -501,6 +524,8 @@</t-form-item></t-form></t-dialog>++ <CreateUserDialog v-model:visible="createUserVisible" @announced="saveAnnouncement = $event" /></div></template>@@ -521,6 +546,7 @@ import {type SystemSettingItem,} from '@/api/system'import { getAuthConfig } from '@/api/auth'+import CreateUserDialog from './CreateUserDialog.vue'import { useAuthStore } from '@/stores/auth'import { useDeploymentCapabilitiesStore } from '@/stores/deploymentCapabilities'import { newPasswordRules, PASSWORD_SPECIAL_CHARS } from '@/utils/passwordPolicy'@@ -813,6 +839,10 @@ async function submitPasswordReset() {}}+// Create-user dialog lives in CreateUserDialog.vue (same Access row);+// only its visibility is owned here.+const createUserVisible = ref(false)+// Guards ssrf.whitelist while an async confirm roundtrip is in flight.const listConfirmBusyKey = ref<string | null>(null)@@ -1678,14 +1708,18 @@ onUnmounted(() => {width: 320px;}-.password-reset-trigger {+.password-reset-trigger,+.create-user-trigger {min-width: 112px;height: 32px;padding: 0 12px;- color: var(--td-error-color);- background: var(--td-error-color-light);border: 1px solid transparent;border-radius: 6px;+}++.password-reset-trigger {+ color: var(--td-error-color);+ background: var(--td-error-color-light);&:hover {color: var(--td-error-color-hover);@@ -1699,10 +1733,6 @@ onUnmounted(() => {}}-.password-reset-warning {- margin-bottom: 20px;-}-@media (max-width: 860px) {.settings-section-intro {align-items: flex-start;@@ -1766,95 +1796,5 @@ onUnmounted(() => {</style><style lang="less">-/* The dialog is teleported to body, so its visual shell cannot be- styled from the scoped block above. Keep this class specific to the- password-reset flow instead of changing every TDesign dialog. */-.password-reset-dialog {- padding: 0;- overflow: hidden;- border-color: var(--td-component-stroke);- border-radius: 12px;- box-shadow:- 0 12px 32px rgba(15, 23, 42, 0.12),- 0 2px 8px rgba(15, 23, 42, 0.08);-- .t-dialog__header {- min-height: 64px;- padding: 0 24px;- font-size: 18px;- line-height: 26px;- border-bottom: 1px solid var(--td-component-stroke);- }-- .t-dialog__close {- width: 28px;- height: 28px;- padding: 0;- justify-content: center;- border-radius: 6px;- }-- .t-dialog__body {- padding: 20px 24px 4px;- }-- .password-reset-warning {- padding: 12px 14px;- border-radius: 8px;-- .t-alert__content {- font-size: 13px;- line-height: 20px;- }- }-- .password-reset-form {- .t-form__item {- margin-bottom: 16px;- }-- .t-form__label--top {- min-height: 28px;- padding: 0;- font-size: 14px;- line-height: 22px;- }-- .t-input {- border-radius: 6px;- }- }-- .t-dialog__footer {- box-sizing: border-box;- padding: 16px 24px 20px;- border-top: 1px solid var(--td-component-stroke);-- .t-button {- min-width: 88px;- border-radius: 6px;- }- }-}--@media (max-width: 480px) {- .password-reset-dialog {- width: calc(100vw - 24px) !important;-- .t-dialog__header {- min-height: 56px;- padding: 0 20px;- font-size: 17px;- }-- .t-dialog__body {- padding: 16px 20px 4px;- }-- .t-dialog__footer {- padding: 14px 20px 18px;- }- }-}-+@import './systemAdminDialog.less';</style>diff --git a/frontend/src/views/system/systemAdminDialog.less b/frontend/src/views/system/systemAdminDialog.lessnew file mode 100644index 000000000..efbc82024--- /dev/null+++ b/frontend/src/views/system/systemAdminDialog.less@@ -0,0 +1,96 @@+/* Shared visual shell for the SystemAdmin action dialogs. The dialogs are+ teleported to body, so this must be global CSS (imported from an+ unscoped SFC style block), not scoped styles. */++.password-reset-dialog,+.create-user-dialog {+ padding: 0;+ overflow: hidden;+ border-color: var(--td-component-stroke);+ border-radius: 12px;+ box-shadow:+ 0 12px 32px rgba(15, 23, 42, 0.12),+ 0 2px 8px rgba(15, 23, 42, 0.08);++ .t-dialog__header {+ min-height: 64px;+ padding: 0 24px;+ font-size: 18px;+ line-height: 26px;+ border-bottom: 1px solid var(--td-component-stroke);+ }++ .t-dialog__close {+ width: 28px;+ height: 28px;+ padding: 0;+ justify-content: center;+ border-radius: 6px;+ }++ .t-dialog__body {+ padding: 20px 24px 4px;+ }++ .t-dialog__footer {+ box-sizing: border-box;+ padding: 16px 24px 20px;+ border-top: 1px solid var(--td-component-stroke);++ .t-button {+ min-width: 88px;+ border-radius: 6px;+ }+ }++ .password-reset-warning,+ .create-user-warning {+ padding: 12px 14px;+ margin-bottom: 20px;+ border-radius: 8px;++ .t-alert__content {+ font-size: 13px;+ line-height: 20px;+ }+ }++ .password-reset-form,+ .create-user-form {+ .t-form__item {+ margin-bottom: 16px;+ }++ .t-form__label--top {+ min-height: 28px;+ padding: 0;+ font-size: 14px;+ line-height: 22px;+ }++ .t-input {+ border-radius: 6px;+ }+ }+}++@media (max-width: 480px) {+ .password-reset-dialog,+ .create-user-dialog {+ width: calc(100vw - 24px) !important;++ .t-dialog__header {+ min-height: 56px;+ padding: 0 20px;+ font-size: 17px;+ }++ .t-dialog__body {+ padding: 16px 20px 4px;+ }++ .t-dialog__footer {+ padding: 14px 20px 18px;+ }+ }+}