mirror of
https://github.com/kepler155c/opus
synced 2025-10-17 00:37:39 +00:00
security start
This commit is contained in:
@@ -7,8 +7,6 @@ local config = {
|
||||
distance = 8,
|
||||
}
|
||||
|
||||
Config.load('lock', config)
|
||||
|
||||
local lockId
|
||||
|
||||
function lockScreen()
|
||||
@@ -40,6 +38,7 @@ function lockScreen()
|
||||
|
||||
function page:eventHandler(event)
|
||||
if event.type == 'key' and event.key == 'enter' then
|
||||
Config.load('os', config)
|
||||
if SHA1.sha1(self.password.value) == config.password then
|
||||
os.locked = false
|
||||
Event.exitPullEvents()
|
||||
@@ -56,6 +55,18 @@ function lockScreen()
|
||||
Event.pullEvents()
|
||||
end
|
||||
|
||||
function os.verifyPassword(password)
|
||||
Config.load('os', config)
|
||||
return config.password and password == config.password
|
||||
end
|
||||
|
||||
function os.getSecretKey()
|
||||
if not fs.exists('.secret') then
|
||||
Util.writeFile('.secret', math.random(100000, 999999))
|
||||
end
|
||||
return Util.readFile('.secret')
|
||||
end
|
||||
|
||||
os.lock = function()
|
||||
--os.locked = true
|
||||
|
||||
|
Reference in New Issue
Block a user