1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-17 00:37:39 +00:00

security start

This commit is contained in:
kepler155c@gmail.com
2017-05-05 07:34:20 -04:00
parent 2e5267896e
commit cc4f8a0afc
5 changed files with 148 additions and 8 deletions

View File

@@ -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