Module: AuthlogicRpx::ActsAsAuthentic::Methods
- Defined in:
- lib/authlogic_rpx/acts_as_authentic.rb
Class Method Summary collapse
-
.included(klass) ⇒ Object
Set up some simple validations.
Instance Method Summary collapse
-
#save(perform_validation = true) {|result| ... } ⇒ Object
support a block given to the save.
-
#using_password? ⇒ Boolean
test if account it using normal password authentication.
-
#using_rpx? ⇒ Boolean
test if account it using RPX authentication.
Class Method Details
.included(klass) ⇒ Object
Set up some simple validations
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/authlogic_rpx/acts_as_authentic.rb', line 33 def self.included(klass) klass.class_eval do validates_uniqueness_of :rpx_identifier, :scope => validations_scope, :if => :using_rpx? .merge(:if => :validate_password_with_rpx?) .merge(:if => :validate_password_with_rpx?) .merge(:if => :validate_password_with_rpx?) before_validation :adding_rpx_identifier after_create :map_rpx_identifier end end |
Instance Method Details
#save(perform_validation = true) {|result| ... } ⇒ Object
support a block given to the save
45 46 47 48 49 |
# File 'lib/authlogic_rpx/acts_as_authentic.rb', line 45 def save(perform_validation = true, &block) result = super perform_validation yield(result) if block_given? result end |
#using_password? ⇒ Boolean
test if account it using normal password authentication
57 58 59 |
# File 'lib/authlogic_rpx/acts_as_authentic.rb', line 57 def using_password? !send(crypted_password_field).blank? end |
#using_rpx? ⇒ Boolean
test if account it using RPX authentication
52 53 54 |
# File 'lib/authlogic_rpx/acts_as_authentic.rb', line 52 def using_rpx? self.column_names.include?("rpx_identifier") || !rpx_identifier.blank? end |