Skip to content

Commit

Permalink
fix auth code for web pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mose committed Mar 1, 2016
1 parent 0c5ede8 commit 9572b05
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions app/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,15 @@ def check_authorization

helpers do
def check_authorization
access_token = session['access_token']
oauth = settings.oauth
redirect oauth.login_url(request) unless access_token
return init_session(oauth, access_token) if oauth.authorized?(access_token)
sorry
if session_info['username']
session_info['username']
else
access_token = session['access_token']
oauth = settings.oauth
redirect oauth.login_url(request) unless access_token
return init_session(oauth, access_token) if oauth.authorized?(access_token)
sorry
end
end

def session_info
Expand Down

0 comments on commit 9572b05

Please sign in to comment.