diff --git a/admin/src/views/account/login.vue b/admin/src/views/account/login.vue index 5f6f061cf..1619c10de 100644 --- a/admin/src/views/account/login.vue +++ b/admin/src/views/account/login.vue @@ -19,14 +19,6 @@ + +
+ + + + + +

使用统一身份平台账号登录

+
@@ -359,6 +365,82 @@ onMounted(async () => { - + diff --git a/server/tests/IamLoginPlacementTest.mjs b/server/tests/IamLoginPlacementTest.mjs new file mode 100644 index 000000000..377b80f5b --- /dev/null +++ b/server/tests/IamLoginPlacementTest.mjs @@ -0,0 +1,24 @@ +import assert from 'node:assert/strict' +import fs from 'node:fs' +import { createRequire } from 'node:module' + +const require = createRequire(new URL('../../admin/package.json', import.meta.url)) +const { parse, compileScript, compileTemplate } = require('@vue/compiler-sfc') +const filename = new URL('../../admin/src/views/account/login.vue', import.meta.url).pathname +const source = fs.readFileSync(filename, 'utf8') +const { descriptor, errors } = parse(source, { filename }) +assert.deepEqual(errors, []) +const template = descriptor.template.content +assert.equal((template.match(/@click="handleIamLogin"/g) || []).length, 1, 'exactly one IAM entry') +const section = template.match(/
/)?.[0] +assert.ok(section, 'IAM alternative is enabled only by iamEnabled') +assert.match(section, /@click="handleIamLogin"/) +assert.ok(template.indexOf(section) > template.indexOf('@click="lockLogin"'), 'IAM follows local login') +assert.ok(template.indexOf(section) > template.indexOf('请使用企业微信扫描二维码登录'), 'IAM follows WeCom region') +assert.ok(template.indexOf(section) > template.indexOf(''), 'no IAM above mode switch') +assert.match(template, /账号登录<\/el-radio-button>/) +assert.match(template, /企业微信<\/el-radio-button>/) +const script = compileScript(descriptor, { id: 'iam-login-placement' }) +const compiled = compileTemplate({ source: template, filename, id: 'iam-login-placement', compilerOptions: { bindingMetadata: script.bindings } }) +assert.deepEqual(compiled.errors, []) +console.log('PASS IAM placement: single optional bottom entry, original handler, account/WeCom switch, local/WeCom ordering, SFC script/template compilation')