Skip to content

Commit

Permalink
added debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffdonthemic committed Dec 4, 2011
1 parent 50d3f13 commit bd7a740
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def current_access_token
access_token = client.authenticate :username => sfdc_username, :password => current_user.password
current_user.access_token = access_token
current_user.save
logger.info "[ApplicationController]==== returning new access token from authentication"
return current_user.access_token

# seem to get this error for brand new users after they are created
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def callback
else
# try and create the user in sfdc
new_member_create_results = Services.new_member(current_access_token, as.get_hash)

logger.info "[SessionsController]==== tried creating a user in sfdc: #{new_member_create_results}"
if new_member_create_results[:success].eql?('true')

user = User.new(:username => new_member_create_results[:username],
Expand All @@ -166,10 +166,12 @@ def callback

if user.save
sign_in user
logger.info "[SessionsController]==== #{results[:sfdc_username]} created and signed in successfully. redirecting..."
# send the 'welcome' email
Resque.enqueue(WelcomeEmailSender, current_access_token, results[:sfdc_username]) unless ENV['MAILER_ENABLED'].eql?('false')
redirect_to session[:redirect_to_after_auth]
else
logger.error "[SessionsController]==== error saving new #{results[:sfdc_username]} member to database: #{user.errors.full_messages} "
render :inline => user.errors.full_messages
end

Expand Down

0 comments on commit bd7a740

Please sign in to comment.