core: 导入用户:支持tab分隔数据

This commit is contained in:
undefined committed 2021-08-01 16:22:09 +08:00
1 parent 289b4da1fe
commit b542f92f6a
1 file changed
+2 -1
+2 -1
View File
@@ -198,7 +198,8 @@ class SystemUserImportHandler extends SystemHandler {
for (const i in users) { for (const i in users) {
const u = users[i]; const u = users[i];
if (!u.trim()) continue; if (!u.trim()) continue;
const [email, username, password, displayName] = u.split(',').map((t) => t.trim()); let [email, username, password, displayName] = u.split(',').map((t) => t.trim());
if (!email || !username || !password) [email, username, password, displayName] = u.split('\t').map((t) => t.trim());
if (email && username && password) { if (email && username && password) {
if (!isEmail(email)) messages.push(`Line ${+i + 1}: Invalid email.`); if (!isEmail(email)) messages.push(`Line ${+i + 1}: Invalid email.`);
else if (!isUname(username)) messages.push(`Line ${+i + 1}: Invalid username`); else if (!isUname(username)) messages.push(`Line ${+i + 1}: Invalid username`);