lib/travis/tools/github.rb in travis-1.6.4.travis.413.4 vs lib/travis/tools/github.rb in travis-1.6.4.travis.414.4

- old
+ new

@@ -194,13 +194,13 @@ def login(user, password, die = true, otp = nil) opt = { :username => user, :password => password } opt[:headers] = { "X-GitHub-OTP" => otp } if otp gh = GH.with(opt) reply = gh.post('/authorizations', :scopes => scopes, :note => note) - self.callback = proc { gh.delete reply['_links']['self']['href'] } + self.callback = proc { gh.delete reply['_links']['self']['href'] } if drop_token reply['token'] rescue GH::Error => error - if error.info[:response_status] == 401 + if error.info[:response_status] == 401 and error.info[:response_headers]['x-github-otp'].to_s =~ /required/ login(user, password, die, ask_otp.call(user)) elsif die raise gh_error(error) end end