Skip to content
Browse files

Maintain any attributes on the User object during the redirection to …

…the oauth server
  • Loading branch information...
1 parent b969980 commit 1fc9074c934e1ac217da500c1888ff335f4b9428 John Allison committed Jun 29, 2009
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/authlogic_oauth/acts_as_authentic.rb
View
4 lib/authlogic_oauth/acts_as_authentic.rb
@@ -58,6 +58,8 @@ def self.included(klass)
def save(perform_validation = true, &block)
if perform_validation && block_given? && redirecting_to_oauth_server?
+ # Save attributes so they aren't lost during the authentication with the oauth server
+ session_class.controller.session[:authlogic_oauth_attributes] = attributes.reject!{|k, v| v.blank?}
redirect_to_oauth
return false
end
@@ -83,6 +85,8 @@ def authenticating_with_oauth?
end
def authenticate_with_oauth
+ # Restore any attributes which were saved before redirecting to the oauth server
+ self.attributes = session_class.controller.session.delete(:authlogic_oauth_attributes)
access_token = generate_access_token
self.oauth_token = access_token.token

0 comments on commit 1fc9074

Please sign in to comment.
Something went wrong with that request. Please try again.