Module: DeviseBasecamper::Confirmable::ClassMethods

Defined in:
lib/devise-basecamper/confirmable.rb

Instance Method Summary collapse

Instance Method Details

#confirm_with_login?(attributes = {}) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
# File 'lib/devise-basecamper/confirmable.rb', line 23

def confirm_with_login?(attributes={})
  if attributes.any?
    attributes.include?( basecamper[:login_attribute] ) && confirmation_keys.include?( basecamper[:login_attribute] )
  else
    reset_password_keys.include?( basecamper[:login_attribute] )
  end
end

#send_confirmation_instructions(attributes = {}) ⇒ Object

Override for password resets ——————-



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/devise-basecamper/confirmable.rb', line 7

def send_confirmation_instructions(attributes={})
  if confirm_with_login?
    subdomain_resource                      = find_resource_by_subdomain(attributes)
    attributes[ basecamper[:scope_field] ]  = subdomain_resource.nil? ? nil : subdomain_resource.id
    recoverable                             = (reset_password_keys, attributes, :not_found)
  else
    recoverable = find_or_initialize_with_errors(reset_password_keys, attributes, :not_found)
  end

  ## Now that we have found the recoverable, we are going to call the
  ## send_reset_password_instructions on the specific recoverable
  ##
  recoverable.send_confirmation_instructions if recoverable.persisted?
  recoverable
end