lib/generators/dailycred_generator.rb in dailycred-0.1.27 vs lib/generators/dailycred_generator.rb in dailycred-0.1.28
- old
+ new
@@ -7,12 +7,13 @@
APP_NAME = Rails.application.class.parent.name
APP_ROUTES_LINES =<<-EOS
match '/auth/:provider/callback' => 'sessions#create'
match "/logout" => "sessions#destroy", :as => :logout
- match "/auth" => "sessions#info", :as => :auth
- match "/auth/dailycred"
+ match "/auth" => "sessions#info", :as => :auth_info
+ match "/auth/dailycred", :as => :auth
+ match "/auth/failure" => "sessions#failure"
EOS
APP_CONTROLLER_LINES =<<-EOS
helper_method :current_user, :login_path, :dailycred, :signup_path
@@ -40,9 +41,15 @@
#
# for more documentation, visit https://www.dailycred.com/api/ruby
def dailycred
config = Rails.configuration
@dailycred ||= Dailycred.new(config.DAILYCRED_CLIENT_ID, config.DAILYCRED_SECRET_KEY, config.dc_options)
+ end
+
+ # when making oauth calls, we may need to redirect to our oauth callback url
+ # make sure we have the correct state passed back and forth
+ def set_state
+ @state = session["omniauth.state"] = SecureRandom.uuid
end
EOS
APP_HELPER_LINES = <<-EOS
def connect_path(provider)