mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Feature #4714: fix bugs: remove auth file and find forever tokens
This commit is contained in:
parent
dda2dffa1d
commit
388c183562
@ -394,8 +394,10 @@ class OneUserHelper < OpenNebulaHelper::OneHelper
|
||||
valid_tokens.map do |e|
|
||||
next unless e["TOKEN"].start_with?(token)
|
||||
|
||||
exp_time = e["EXPIRATION_TIME"].to_i
|
||||
|
||||
if !show_expired
|
||||
next unless Time.at(e["EXPIRATION_TIME"].to_i) > Time.now
|
||||
next if exp_time != -1 && Time.now > Time.at(exp_time)
|
||||
end
|
||||
|
||||
e["TOKEN"]
|
||||
|
@ -641,12 +641,13 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
puts rc.message
|
||||
exit_with_code 1, rc.message
|
||||
else
|
||||
exit_with_code 0, "Token removed."
|
||||
puts "Token removed."
|
||||
end
|
||||
|
||||
# Remove the token files
|
||||
Dir[ENV['HOME'] + "/.one/*.token"].each do |f|
|
||||
auth = File.read(f).strip
|
||||
|
||||
if auth == "#{user['NAME']}:#{token}"
|
||||
puts "Removing #{f}"
|
||||
File.unlink(f)
|
||||
|
Loading…
x
Reference in New Issue
Block a user