mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
feat(安全): 添加管理员账户创建和登录验证功能
在安装过程中添加管理员账户创建流程,并在系统启动时进行登录验证 更新系统版本号为 LeonOS Alpha 1.1
This commit is contained in:
@@ -86,6 +86,28 @@ if #ROM_DIR == 0 then ROM_DIR = DEFAULT_ROM_DIR end
|
||||
ROM_DIR = "/"..shell.resolve(ROM_DIR)
|
||||
|
||||
settings.set("LeonOS.rom_dir", ROM_DIR)
|
||||
|
||||
-- Create admin user
|
||||
print("")
|
||||
tu.coloredPrint(colors.yellow, "Create Administrator Account\n=======================")
|
||||
tu.coloredPrint("Enter admin username: ")
|
||||
local admin_username = read()
|
||||
while #admin_username == 0 do
|
||||
tu.coloredPrint(colors.red, "Username cannot be empty!\n")
|
||||
tu.coloredPrint("Enter admin username: ")
|
||||
admin_username = read()
|
||||
end
|
||||
|
||||
tu.coloredPrint("Enter admin password (leave empty for no password): ")
|
||||
local admin_password = read(nil, {}, nil, true) -- Use password mode
|
||||
|
||||
-- Save user info
|
||||
settings.set("LeonOS.users.admin.username", admin_username)
|
||||
if #admin_password > 0 then
|
||||
settings.set("LeonOS.users.admin.password", admin_password)
|
||||
else
|
||||
settings.set("LeonOS.users.admin.password", nil)
|
||||
end
|
||||
settings.save()
|
||||
|
||||
tu.coloredPrint(colors.white, "Installing LeonOS to ", colors.lightBlue,
|
||||
|
||||
Reference in New Issue
Block a user