feat(安全): 添加管理员账户创建和登录验证功能

在安装过程中添加管理员账户创建流程,并在系统启动时进行登录验证
更新系统版本号为 LeonOS Alpha 1.1
This commit is contained in:
2025-08-31 21:26:08 +08:00
parent 60f00f6dcb
commit d0b30feca9
2 changed files with 48 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
_G._HOST = _G._HOST .. " (LeonOS 1.6.0)"
_G._HOST = _G._HOST .. " (LeonOS Alpha 1.1)"
local fs = rawget(_G, "fs")
@@ -184,6 +184,31 @@ end
expect = require("cc.expect").expect
-- Admin login verification
local tu = require("rom.apis.textutils")
local admin_username = settings.get("LeonOS.users.admin.username")
local admin_password = settings.get("LeonOS.users.admin.password")
if admin_username then
term.clear()
tu.coloredPrint(colors.yellow, "LeonOS Login\n=======================")
tu.coloredPrint("Username: ", colors.lightBlue, admin_username)
if admin_password then
tu.coloredPrint("Password: ")
local input_password = read(nil, {}, nil, true) -- Use password mode
while input_password ~= admin_password do
tu.coloredPrint(colors.red, "Incorrect password!\n")
tu.coloredPrint("Password: ")
input_password = read(nil, {}, nil, true)
end
else
tu.coloredPrint(colors.green, "No password set. Press Enter to continue.")
read()
end
end
local thread = require("rc.thread")
thread.start()