Class: OmniAuth::Strategies::Lightning

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy
Defined in:
lib/omniauth/strategies/lightning.rb

Instance Method Summary collapse

Instance Method Details

#callback_phaseObject



44
45
46
47
48
49
50
51
52
# File 'lib/omniauth/strategies/lightning.rb', line 44

def callback_phase
  r = validate_invoice!(request['invoice'])

  if r == :ok
    super
  else
    return fail!(*r)
  end
end

#request_phaseObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/omniauth/strategies/lightning.rb', line 25

def request_phase
  if options[:on_login]
    options[:on_login].call(self.env)
  else
    OmniAuth::Form.build(
      title: (options[:title]),
      url: callback_path
    ) do |f|
      f.html """
          <p>
            Create an invoice for #{options[:invoice_sats_amount]}
            satoshis that starts with \"#{options[:validating_text]}\".
          </p>
        """
      f.text_field 'Invoice', 'invoice'
    end.to_response
  end
end