mirror of
https://github.com/kepler155c/opus
synced 2025-10-24 04:07:40 +00:00
The big Anavrins security update (round 1)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
local Security = require('security')
|
||||
local SHA1 = require('sha1')
|
||||
local SHA2 = require('crypto.sha2')
|
||||
local UI = require('ui')
|
||||
|
||||
local colors = _G.colors
|
||||
@@ -40,11 +40,11 @@ function passwordTab:eventHandler(event)
|
||||
if #self.newPass.value == 0 then
|
||||
self:emit({ type = 'error_message', message = 'Invalid password' })
|
||||
|
||||
elseif Security.getPassword() and not Security.verifyPassword(SHA1.sha1(self.oldPass.value)) then
|
||||
elseif Security.getPassword() and not Security.verifyPassword(SHA2.digest(self.oldPass.value):toHex()) then
|
||||
self:emit({ type = 'error_message', message = 'Passwords do not match' })
|
||||
|
||||
else
|
||||
Security.updatePassword(SHA1.sha1(self.newPass.value))
|
||||
Security.updatePassword(SHA2.digest(self.newPass.value):toHex())
|
||||
self.oldPass.inactive = false
|
||||
self:emit({ type = 'success_message', message = 'Password updated' })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user