feat: minor improved security measures
This commit is contained in:
parent
27d7a4e6b5
commit
d1b2117fa2
3 changed files with 29 additions and 11 deletions
|
|
@ -120,8 +120,10 @@ function M.logout(platform)
|
|||
local ok, data = pcall(vim.fn.json_decode, vim.fn.readfile(cookie_file, 'b'))
|
||||
if ok and type(data) == 'table' then
|
||||
data[platform] = nil
|
||||
vim.fn.writefile({ vim.fn.json_encode(data) }, cookie_file)
|
||||
vim.fn.setfperm(cookie_file, 'rw-------')
|
||||
local tmpfile = vim.fn.tempname()
|
||||
vim.fn.writefile({ vim.fn.json_encode(data) }, tmpfile)
|
||||
vim.fn.setfperm(tmpfile, 'rw-------')
|
||||
vim.uv.fs_rename(tmpfile, cookie_file)
|
||||
end
|
||||
end
|
||||
logger.log(display .. ' credentials cleared', { level = vim.log.levels.INFO, override = true })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue