Class: OmniAuth::Strategies::Td
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Td
- Includes:
- OmniAuth::Strategy
- Defined in:
- lib/omniauth/strategies/td.rb
Constant Summary collapse
- VIEW_DIR =
File.dirname(__FILE__) + "/../../../view/"
Instance Method Summary collapse
Instance Method Details
#callback_phase ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/omniauth/strategies/td.rb', line 22 def callback_phase mail = request['email'] pass = request['password'] begin api = TreasureData::Client.authenticate(mail, pass) cln = TreasureData::Client.new(api.apikey) @identity ||= { :account_id => cln.account.account_id, :apikey => api.apikey, :email => request['email'] } rescue => e return fail!(:invalid_credentials) end super end |
#request_phase ⇒ Object
16 17 18 19 20 |
# File 'lib/omniauth/strategies/td.rb', line 16 def request_phase tmpl = VIEW_DIR + 'form.erb' html = ERB.new(open(tmpl).read).result(binding) Rack::Response.new(html).finish end |