:first_name => omniauth['info']['first_name'],
:last_name => omniauth['info']['last_name'],
:identity_url => omniauth['info']['identity_url'])
- Thread.current[:user] = user # prevents OrvosModel#before_create
- # from throwing "unauthorized"
- user.save!
else
user.email = omniauth['info']['email']
user.first_name = omniauth['info']['first_name']
user.last_name = omniauth['info']['last_name']
- user.save
end
+ # prevent OrvosModel#before_create and _update from throwing
+ # "unauthorized":
+ Thread.current[:user] = user
+
+ user.save!
+
omniauth.delete('extra')
# Give the authenticated user a cookie for direct API access
session[:user_id] = nil
flash[:notice] = 'You have logged off'
- redirect_to "#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{root_url}"
+ return_to = params[:return_to] || root_url
+ redirect_to "#{CUSTOM_PROVIDER_URL}/users/sign_out?redirect_uri=#{CGI.escape return_to}"
end
# login - Just bounce to /auth/joshid. The only purpose of this function is