This commit is contained in:
danielgrippi 2011-08-09 18:49:07 -07:00 committed by Maxwell Salzberg
parent 27049e52b5
commit a7d9bbed84
5 changed files with 9 additions and 7 deletions

View file

@ -59,7 +59,7 @@ PATH
activerecord
faraday
jwt (>= 0.1.3)
oauth2
oauth2 (= 0.4.1)
sinatra
GEM

View file

@ -12,9 +12,10 @@ class AuthorizationsController < ApplicationController
@requested_scopes = params["scope"].split(',')
@client = oauth2_authorization_request.client
if current_user.applications.present?
tokens = current_user.authorizations.first.access_tokens.first
redirect_to "#{params[:redirect_uri]}&access_token=#{tokens.access_token}&refresh_token=#{tokens.refresh_token}"
if authorization = current_user.authorizations.where(:client_id => @client.id).first
ac = authorization.authorization_codes.create(:redirect_uri => params[:redirect_uri])
#tokens = current_user.authorizations.first.access_tokens.first
redirect_to "#{params[:redirect_uri]}&code=#{ac.code}"
end
end

View file

@ -100,6 +100,7 @@ Feature: oauth
And I fill in my Diaspora ID to connect
And I press "Connect to Diaspora"
And I debug
Then I should be on "/account" on Chubbies
And I should have 1 user on Chubbies

View file

@ -80,7 +80,7 @@ class Chubbies
end
def self.nullify
"2> /dev/null > /dev/null"
# "2> /dev/null > /dev/null"
end
def self.kill

View file

@ -75,8 +75,8 @@ module Chubbies
def account_const
User
end
def create_account(*args)
account_const.create(args)
def create_account(hash)
account_const.create(hash)
end
get '/account' do