// 浏览器端随机初始密码(管理员未显式给定密码时): // crypto.getRandomValues 拒绝易混淆字符(0/O/1/l/I),保证可抄写。 const ALPHABET = 'abcdefghjkmnpqrstuvwxyz23456789' export function randomPassword(length = 12): string { const buf = new Uint32Array(length) crypto.getRandomValues(buf) let out = '' for (let i = 0; i < length; i++) out += ALPHABET[buf[i] % ALPHABET.length] return out }