auth: 邮箱注册/登录补全 Linux 账号创建
registerByEmail / loginByEmail 漏掉 ensureLinuxAccount,开 CLAW_ENABLE_LINUX_ACCOUNTS=1 时邮箱用户既不会建 Linux 账号、createAccountDirectories 的 chown 也会失败。 照搬 username 路径的位置补上即可。同时删掉后端 server.py 里同逻辑的 dead code (_XIAOMI_EMAIL_RE / _account_id_from_email),实际拆分发生在 TS 层。
This commit is contained in:
@@ -103,6 +103,7 @@ export async function registerByEmail(email: string, password: string) {
|
||||
createdAt: new Date().toISOString(),
|
||||
};
|
||||
usersFile.users.push(account);
|
||||
await ensureLinuxAccount(account.id, password);
|
||||
await writeUsers(usersFile);
|
||||
await createAccountDirectories(account.id);
|
||||
return createSession(account);
|
||||
@@ -121,6 +122,7 @@ export async function loginByEmail(email: string, password: string) {
|
||||
if (!verifyPassword(password, account.passwordHash)) {
|
||||
throw new Error("邮箱或密码错误");
|
||||
}
|
||||
await ensureLinuxAccount(account.id, password);
|
||||
await createAccountDirectories(account.id);
|
||||
return createSession(account);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user