mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix user import error (#579)
This commit is contained in:
1 parent
15220f18b7
commit
58cab9919d
1 file changed
+6
-2
@@ -226,8 +226,12 @@ class SystemUserImportHandler extends SystemHandler {
|
||||
for (const i in users) {
|
||||
const u = users[i];
|
||||
if (!u.trim()) continue;
|
||||
let [email, username, password, displayName, extra] = u.split(',').map((t) => t.trim());
|
||||
if (!email || !username || !password) [email, username, password, displayName, extra] = u.split('\t').map((t) => t.trim());
|
||||
let [email, username, password, displayName, extra] = u.split('\t').map((t) => t.trim());
|
||||
if (!email || !username || !password) {
|
||||
const data = u.split(',').map((t) => t.trim());
|
||||
[email, username, password, displayName, extra] = data;
|
||||
if (data.length > 5) extra = data.slice(4).join(',');
|
||||
}
|
||||
if (email && username && password) {
|
||||
if (!Types.Email[1](email)) messages.push(`Line ${+i + 1}: Invalid email.`);
|
||||
else if (!Types.Username[1](username)) messages.push(`Line ${+i + 1}: Invalid username`);
|
||||
|
||||
Reference in new issue
Block a user