1
0
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:
Jaime Melis 2016-09-07 15:32:56 +02:00
parent dda2dffa1d
commit 388c183562
2 changed files with 5 additions and 2 deletions

View File

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

View File

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