mirror of
https://github.com/kepler155c/opus
synced 2025-01-15 18:05:42 +00:00
fix for new text entry behaviour + oc relay fix
This commit is contained in:
parent
25bfce0e40
commit
7e8dc5bd49
@ -7,13 +7,6 @@ local colors = _G.colors
|
|||||||
local passwordTab = UI.Tab {
|
local passwordTab = UI.Tab {
|
||||||
tabTitle = 'Password',
|
tabTitle = 'Password',
|
||||||
description = 'Wireless network password',
|
description = 'Wireless network password',
|
||||||
oldPass = UI.TextEntry {
|
|
||||||
x = 3, ex = -3, y = 2,
|
|
||||||
limit = 32,
|
|
||||||
mask = true,
|
|
||||||
shadowText = 'old password',
|
|
||||||
inactive = not Security.getPassword(),
|
|
||||||
},
|
|
||||||
newPass = UI.TextEntry {
|
newPass = UI.TextEntry {
|
||||||
x = 3, ex = -3, y = 3,
|
x = 3, ex = -3, y = 3,
|
||||||
limit = 32,
|
limit = 32,
|
||||||
@ -37,15 +30,11 @@ local passwordTab = UI.Tab {
|
|||||||
}
|
}
|
||||||
function passwordTab:eventHandler(event)
|
function passwordTab:eventHandler(event)
|
||||||
if event.type == 'update_password' then
|
if event.type == 'update_password' then
|
||||||
if #self.newPass.value == 0 then
|
if not self.newPass.value or #self.newPass.value == 0 then
|
||||||
self:emit({ type = 'error_message', message = 'Invalid password' })
|
self:emit({ type = 'error_message', message = 'Invalid password' })
|
||||||
|
|
||||||
elseif Security.getPassword() and not Security.verifyPassword(SHA.compute(self.oldPass.value)) then
|
|
||||||
self:emit({ type = 'error_message', message = 'Passwords do not match' })
|
|
||||||
|
|
||||||
else
|
else
|
||||||
Security.updatePassword(SHA.compute(self.newPass.value))
|
Security.updatePassword(SHA.compute(self.newPass.value))
|
||||||
self.oldPass.inactive = false
|
|
||||||
self:emit({ type = 'success_message', message = 'Password updated' })
|
self:emit({ type = 'success_message', message = 'Password updated' })
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
@ -8,10 +8,9 @@ local function register(v)
|
|||||||
local dev = v.getMethodsRemote(name)
|
local dev = v.getMethodsRemote(name)
|
||||||
if dev then
|
if dev then
|
||||||
dev.name = name
|
dev.name = name
|
||||||
dev.side = name
|
dev.side = v.side
|
||||||
dev.type = v.getTypeRemote(name)
|
dev.type = v.getTypeRemote(name)
|
||||||
device[name] = dev
|
device[name] = dev
|
||||||
table.insert(v._children, dev)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user