Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Fix bug caused by invalid token
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Oct 31, 2014
1 parent a6e838a commit 604f6ac
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@
installer.size = params[:size]
session[:config] = installer.as_json
if installer.auth_token = session[:token]
installer.go!
session[:config] = installer.as_json
redirect '/status'
begin
installer.go!
rescue RestClient::Unauthorized
session[:token] = nil
redirect "https://cloud.digitalocean.com/v1/oauth/authorize?response_type=code&client_id=#{CLIENT_ID}&redirect_uri=#{CALLBACK_URL}&scope=read+write"
else
session[:config] = installer.as_json
redirect '/status'
end
else
redirect "https://cloud.digitalocean.com/v1/oauth/authorize?response_type=code&client_id=#{CLIENT_ID}&redirect_uri=#{CALLBACK_URL}&scope=read+write"
end
Expand Down

0 comments on commit 604f6ac

Please sign in to comment.