Module: AuthlogicConnect::Oauth::User::InstanceMethods
- Includes:
- Process
- Defined in:
- lib/authlogic_connect/oauth/user.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
Set up some simple validations.
Instance Method Summary collapse
-
#save_with_oauth(perform_validation = true, &block) ⇒ Object
NEED TO GIVE A BLOCK.
- #update_attributes(attributes, &block) ⇒ Object
Methods included from Variables
#oauth_consumer, #oauth_key, #oauth_provider, #oauth_response, #oauth_token, #oauth_version
Class Method Details
.included(base) ⇒ Object
Set up some simple validations
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/authlogic_connect/oauth/user.rb', line 12 def self.included(base) base.class_eval do has_many :tokens, :class_name => "Token", :dependent => :destroy belongs_to :active_token, :class_name => "Token", :dependent => :destroy accepts_nested_attributes_for :tokens, :active_token validate :validate_by_oauth, :if => :authenticating_with_oauth? # need these validation options if you don't want it to choke # on password length, which you don't need if you're using oauth .merge(:if => :validate_password_with_oauth?) .merge(:if => :validate_password_with_oauth?) .merge(:if => :validate_password_with_oauth?) .merge(:if => :validate_password_with_oauth?) .merge(:if => :validate_password_with_oauth?) end # email needs to be optional for oauth base.validate_email_field = false end |
Instance Method Details
#save_with_oauth(perform_validation = true, &block) ⇒ Object
NEED TO GIVE A BLOCK
39 40 41 42 43 44 45 46 47 |
# File 'lib/authlogic_connect/oauth/user.rb', line 39 def save_with_oauth(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 auth_session[:authlogic_oauth_attributes] = attributes.reject!{|k, v| v.blank?} redirect_to_oauth return false end return true end |
#update_attributes(attributes, &block) ⇒ Object
33 34 35 36 |
# File 'lib/authlogic_connect/oauth/user.rb', line 33 def update_attributes(attributes, &block) self.attributes = attributes save(true, &block) end |